Skip to content
This repository was archived by the owner on Jul 23, 2026. It is now read-only.

Commit 69e6e1e

Browse files
committed
subscriptions: enable "auto" manageSubscription flag
tsf-subscriptions handles the "auto" value by listing cluster Subscriptions owned by this Helm release (via lookup and release annotations) and only merging catalog entries whose name is in that set. This allows subscriptions to not be created when it was installed without the installer. Assisted-by: Claude rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
1 parent eb00b8b commit 69e6e1e

5 files changed

Lines changed: 79 additions & 25 deletions

File tree

installer/charts/_common/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
4646
Need deleted labels
4747
*/}}
4848
{{- define "common.postDeployDeleteLabels" -}}
49-
helmet.t.t.t.t.t.t.t.t.t.redhat-appstudio.github.com/post-deploy: delete
49+
helmet.redhat-appstudio.github.com/post-deploy: delete
5050
{{- end }}
5151

5252
{{/*

installer/charts/tsf-pipelines/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ version: "0.1.0"
77
appVersion: "1.20"
88
annotations:
99
helmet.redhat-appstudio.github.com/product-name: OpenShift Pipelines
10-
helmet.redhat-appstudio.github.com/depends-on: tsf-openshift, tsf-subscriptions
10+
helmet.redhat-appstudio.github.com/depends-on: tsf-openshift, tsf-subscriptions, tsf-tas
1111
helmet.redhat-appstudio.github.com/integrations-required: tas

installer/charts/tsf-subscriptions/templates/_subscriptions.tpl

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,66 @@
1010
{{- end -}}
1111
{{- $enabled | toYaml -}}
1212
{{- end -}}
13+
{{- /*
14+
True if the Subscription object is owned by this Helm release.
15+
*/ -}}
16+
{{- define "subscriptions.itemOwnedByRelease" -}}
17+
{{- $root := .root -}}
18+
{{- $item := .item -}}
19+
{{- $meta := $item.metadata | default dict -}}
20+
{{- $labels := $meta.labels | default dict -}}
21+
{{- $ann := $meta.annotations | default dict -}}
22+
{{- $managedBy := index $labels "app.kubernetes.io/managed-by" | default "" -}}
23+
{{- $relName := index $ann "meta.helm.sh/release-name" | default "" -}}
24+
{{- $relNs := index $ann "meta.helm.sh/release-namespace" | default "" -}}
25+
{{- if and (eq $managedBy "Helm") (eq $relName $root.Release.Name) (eq $relNs $root.Release.Namespace) -}}
26+
true
27+
{{- else -}}
28+
false
29+
{{- end -}}
30+
{{- end -}}
31+
{{- /*
32+
Package names (.spec.name) of Subscriptions on the cluster that belong to this Helm release
33+
(cluster-wide list; see subscriptions.itemOwnedByRelease). Used for managed: auto.
34+
Renders YAML list; empty when lookup is unavailable (e.g. helm template without cluster).
35+
*/ -}}
36+
{{- define "subscriptions.managedSubscriptions" -}}
37+
{{- $root := . -}}
38+
{{- $names := list -}}
39+
{{- $subsList := lookup "operators.coreos.com/v1alpha1" "Subscription" "" "" -}}
40+
{{- if and $subsList ($subsList.items | default list) -}}
41+
{{- range $item := $subsList.items -}}
42+
{{- if eq (include "subscriptions.itemOwnedByRelease" (dict "root" $root "item" $item) | trim) "true" -}}
43+
{{- $spec := $item.spec | default dict -}}
44+
{{- $pkgName := $spec.name | default "" -}}
45+
{{- if $pkgName -}}
46+
{{- $names = append $names $pkgName -}}
47+
{{- end -}}
48+
{{- end -}}
49+
{{- end -}}
50+
{{- end -}}
51+
{{- $names | compact | uniq | toYaml -}}
52+
{{- end -}}
1353
{{- /*
1454
Select the managed subscriptions.
1555
*/ -}}
1656
{{- define "subscriptions.managed" -}}
1757
{{- $managed := dict -}}
58+
{{- $managedSubscriptions := include "subscriptions.managedSubscriptions" . | fromYaml | default list -}}
1859
{{- range $k, $v := .Values.subscriptions -}}
19-
{{- if $v.managed -}}
60+
{{- $isManaged := false -}}
61+
{{- if eq $v.managed "auto" -}}
62+
{{- if $v.name -}}
63+
{{- range $managedSubscriptions -}}
64+
{{- if eq . $v.name -}}
65+
{{- $isManaged = true -}}
66+
{{- end -}}
67+
{{- end -}}
68+
{{- end -}}
69+
{{- else -}}
70+
{{- $isManaged = eq $v.managed "true" -}}
71+
{{- end -}}
72+
{{- if $isManaged -}}
2073
{{- $managed = merge $managed (dict $k $v) -}}
2174
{{- end -}}
2275
{{- end -}}

installer/config.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,31 @@ tsf:
1515
enabled: true
1616
# Uses the installer's namespace.
1717
properties:
18-
manageSubscription: true
19-
# Red Hat Trusted Artifact Signer (TAS) enhances software supply chain
20-
# security by simplifying cryptographic signing and verification of software
21-
# artifacts like container images, binaries, and documents, leveraging an
22-
# OpenID Connect (OIDC) provider such as Keycloak for identity-based signing.
23-
- name: Trusted Artifact Signer
18+
manageSubscription: "auto"
19+
# Community Konflux Operator provides the CRDs for the Trusted Software Factory
20+
# platform.
21+
- name: Konflux
2422
enabled: true
25-
namespace: tsf-tas
23+
namespace: konflux-ui
2624
properties:
27-
manageSubscription: true
25+
manageSubscription: "true"
2826
# Red Hat OpenShift Pipelines is a cloud-native CI/CD (Continuous
2927
# Integration/Continuous Delivery) solution built on Tekton that automates
3028
# application delivery and reduces time to market on Red Hat OpenShift.
3129
- name: OpenShift Pipelines
3230
enabled: true
3331
# Uses the installer's namespace.
3432
properties:
35-
manageSubscription: true
36-
# Community Konflux Operator provides the CRDs for the Trusted Software Factory
37-
# platform.
38-
- name: Konflux
33+
manageSubscription: "true"
34+
# Red Hat Trusted Artifact Signer (TAS) enhances software supply chain
35+
# security by simplifying cryptographic signing and verification of software
36+
# artifacts like container images, binaries, and documents, leveraging an
37+
# OpenID Connect (OIDC) provider such as Keycloak for identity-based signing.
38+
- name: Trusted Artifact Signer
3939
enabled: true
40-
namespace: konflux-ui
40+
namespace: tsf-tas
4141
properties:
42-
manageSubscription: true
42+
manageSubscription: "true"
4343
# Red Hat Trusted Profile Analyzer (TPA), which leverages the community-driven
4444
# Trustification project, helps organizations manage their software supply
4545
# chain's security by analyzing Software Bills of Materials (SBOMs), vendor
@@ -49,4 +49,4 @@ tsf:
4949
enabled: true
5050
namespace: tsf-tpa
5151
properties:
52-
manageSubscription: true
52+
manageSubscription: "true"

installer/values.yaml.tpl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ openshift:
4646
{{- end }}
4747
{{- if $tpa.Enabled }}
4848
- {{ $tpa.Namespace }}
49-
{{- if $tpa.Properties.manageSubscription }}
49+
{{- $tpaMS := dig "manageSubscription" "false" ($tpa.Properties | default dict) -}}
50+
{{- if ne $tpaMS "false" }}
5051
- rhtpa-operator
5152
{{- end }}
5253
{{- end }}
@@ -59,25 +60,25 @@ openshift:
5960
subscriptions:
6061
konflux:
6162
enabled: {{ $konflux.Enabled }}
62-
managed: {{ and $konflux.Enabled $konflux.Properties.manageSubscription }}
63+
managed: '{{ if $konflux.Enabled }}{{ dig "manageSubscription" "auto" ($konflux.Properties | default dict) | toString }}{{ else }}false{{ end }}'
6364
openshiftCertManager:
6465
enabled: {{ $certManager.Enabled }}
65-
managed: {{ and $certManager.Enabled $certManager.Properties.manageSubscription }}
66+
managed: '{{ if $certManager.Enabled }}{{ dig "manageSubscription" "auto" ($certManager.Properties | default dict) | toString }}{{ else }}false{{ end }}'
6667
openshiftKeycloak:
6768
enabled: {{ $keycloakEnabled }}
68-
managed: {{ $keycloakEnabled }}
69+
managed: '{{ $keycloakEnabled }}'
6970
operatorGroup:
7071
targetNamespaces:
7172
- {{ default "empty" $keycloakNamespace }}
7273
openshiftPipelines:
7374
enabled: {{ $pipelines.Enabled }}
74-
managed: {{ and $pipelines.Enabled $pipelines.Properties.manageSubscription }}
75+
managed: '{{ if $pipelines.Enabled }}{{ dig "manageSubscription" "auto" ($pipelines.Properties | default dict) | toString }}{{ else }}false{{ end }}'
7576
openshiftTrustedArtifactSigner:
7677
enabled: {{ $tas.Enabled }}
77-
managed: {{ and $tas.Enabled $tas.Properties.manageSubscription }}
78+
managed: '{{ if $tas.Enabled }}{{ dig "manageSubscription" "auto" ($tas.Properties | default dict) | toString }}{{ else }}false{{ end }}'
7879
trustedProfileAnalyzer:
7980
enabled: {{ $tpa.Enabled }}
80-
managed: {{ and $tpa.Enabled $tpa.Properties.manageSubscription }}
81+
managed: '{{ if $tpa.Enabled }}{{ dig "manageSubscription" "auto" ($tpa.Properties | default dict) | toString }}{{ else }}false{{ end }}'
8182

8283
#
8384
# tsf-infrastructure

0 commit comments

Comments
 (0)