From acec6b519593e958819c3e047119ec148c0b361e Mon Sep 17 00:00:00 2001 From: Akos Eros Date: Thu, 5 Mar 2026 13:50:45 +0100 Subject: [PATCH] feat: Add option to override the gitops subscription on remote clusters Change the default namespace value for gitops sub to the new recommended default. --- README.md | 1 + templates/policies/ocp-gitops-policy.yaml | 2 +- tests/ocp_gitops_policy_test.yaml | 16 ++++++++++++++++ values.yaml | 3 ++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c7e0396..abfa0e4 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ This chart is used by the Validated Patterns to configure ACM and manage remote | acm.mch_spec | object | `{}` | MultiClusterHub spec (empty by default) | | acm.spokeGitops.channel | string | `"gitops-1.18"` | Default gitops channel to install on remote clusters | | acm.spokeGitops.source | string | `"redhat-operators"` | | +| acm.spokeGitops.subscriptionNamespace | string | `"openshift-gitops-operator"` | Default namespace for the gitops subscription on remote clusters | | clusterGroup | object | depends on the individual settings | Dictionary of all the clustergroups of the pattern | | clusterGroup.managedClusterGroups | object | `{}` | The set of cluters managed by ACM which is running inside this clusterGroup | | clusterGroup.subscriptions | object | `{"acm":{"source":"redhat-operators"}}` | Dictionary of subscriptions for this specific clusterGroup | diff --git a/templates/policies/ocp-gitops-policy.yaml b/templates/policies/ocp-gitops-policy.yaml index bae1861..166a525 100644 --- a/templates/policies/ocp-gitops-policy.yaml +++ b/templates/policies/ocp-gitops-policy.yaml @@ -33,7 +33,7 @@ spec: kind: Subscription metadata: name: openshift-gitops-operator - namespace: openshift-operators + namespace: {{- if and $.Values.acm.spokeGitops $.Values.acm.spokeGitops.subscriptionNamespace }} {{ $.Values.acm.spokeGitops.subscriptionNamespace }}{{- else }} openshift-gitops-operator{{- end }} labels: operators.coreos.com/openshift-gitops-operator.openshift-operators: '' spec: diff --git a/tests/ocp_gitops_policy_test.yaml b/tests/ocp_gitops_policy_test.yaml index 26918bb..cb65952 100644 --- a/tests/ocp_gitops_policy_test.yaml +++ b/tests/ocp_gitops_policy_test.yaml @@ -56,6 +56,22 @@ tests: path: spec.policy-templates[0].objectDefinition.spec.object-templates[0].objectDefinition.spec.source value: custom-operators + - it: Should use subscriptionNamespace for subscription namespace when specified + values: + - ./clusterselector_values.yaml + set: + acm: + spokeGitops: + subscriptionNamespace: test-gitops-namespace + asserts: + - documentSelector: + path: metadata.name + value: group-one-gitops-policy + equal: + path: spec.policy-templates[0].objectDefinition.spec.object-templates[0].objectDefinition.metadata.namespace + value: test-gitops-namespace + + - it: Should use spokeGitops channel and source when both specified values: - ./clusterselector_values.yaml diff --git a/values.yaml b/values.yaml index 7090f2c..1add581 100644 --- a/values.yaml +++ b/values.yaml @@ -77,7 +77,8 @@ acm: source: redhat-operators # -- Default gitops channel to install on remote clusters channel: "gitops-1.18" - + # -- Default namespace for the gitops subscription on remote clusters + subscriptionNamespace: openshift-gitops-operator # -- Default secretstore configuration variables # @default -- depends on the individual settings