Skip to content

Commit acec6b5

Browse files
committed
feat: Add option to override the gitops subscription on remote clusters
Change the default namespace value for gitops sub to the new recommended default.
1 parent 48b4d9a commit acec6b5

4 files changed

Lines changed: 20 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This chart is used by the Validated Patterns to configure ACM and manage remote
1414
| acm.mch_spec | object | `{}` | MultiClusterHub spec (empty by default) |
1515
| acm.spokeGitops.channel | string | `"gitops-1.18"` | Default gitops channel to install on remote clusters |
1616
| acm.spokeGitops.source | string | `"redhat-operators"` | |
17+
| acm.spokeGitops.subscriptionNamespace | string | `"openshift-gitops-operator"` | Default namespace for the gitops subscription on remote clusters |
1718
| clusterGroup | object | depends on the individual settings | Dictionary of all the clustergroups of the pattern |
1819
| clusterGroup.managedClusterGroups | object | `{}` | The set of cluters managed by ACM which is running inside this clusterGroup |
1920
| clusterGroup.subscriptions | object | `{"acm":{"source":"redhat-operators"}}` | Dictionary of subscriptions for this specific clusterGroup |

templates/policies/ocp-gitops-policy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ spec:
3333
kind: Subscription
3434
metadata:
3535
name: openshift-gitops-operator
36-
namespace: openshift-operators
36+
namespace: {{- if and $.Values.acm.spokeGitops $.Values.acm.spokeGitops.subscriptionNamespace }} {{ $.Values.acm.spokeGitops.subscriptionNamespace }}{{- else }} openshift-gitops-operator{{- end }}
3737
labels:
3838
operators.coreos.com/openshift-gitops-operator.openshift-operators: ''
3939
spec:

tests/ocp_gitops_policy_test.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,22 @@ tests:
5656
path: spec.policy-templates[0].objectDefinition.spec.object-templates[0].objectDefinition.spec.source
5757
value: custom-operators
5858

59+
- it: Should use subscriptionNamespace for subscription namespace when specified
60+
values:
61+
- ./clusterselector_values.yaml
62+
set:
63+
acm:
64+
spokeGitops:
65+
subscriptionNamespace: test-gitops-namespace
66+
asserts:
67+
- documentSelector:
68+
path: metadata.name
69+
value: group-one-gitops-policy
70+
equal:
71+
path: spec.policy-templates[0].objectDefinition.spec.object-templates[0].objectDefinition.metadata.namespace
72+
value: test-gitops-namespace
73+
74+
5975
- it: Should use spokeGitops channel and source when both specified
6076
values:
6177
- ./clusterselector_values.yaml

values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ acm:
7777
source: redhat-operators
7878
# -- Default gitops channel to install on remote clusters
7979
channel: "gitops-1.18"
80-
80+
# -- Default namespace for the gitops subscription on remote clusters
81+
subscriptionNamespace: openshift-gitops-operator
8182

8283
# -- Default secretstore configuration variables
8384
# @default -- depends on the individual settings

0 commit comments

Comments
 (0)