Skip to content

Commit 70e4c6c

Browse files
authored
Merge pull request #28 from mbaldessari/custom-gitops-on-spokes
Support customizing spoke gitops channel and source and release 0.1.13
2 parents 8813471 + c127d63 commit 70e4c6c

File tree

5 files changed

+89
-9
lines changed

5 files changed

+89
-9
lines changed

Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ description: A Helm chart to configure Advanced Cluster Manager for OpenShift.
33
keywords:
44
- pattern
55
name: acm
6-
version: 0.1.12
6+
version: 0.1.13

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# acm
22

3-
![Version: 0.1.12](https://img.shields.io/badge/Version-0.1.12-informational?style=flat-square)
3+
![Version: 0.1.13](https://img.shields.io/badge/Version-0.1.13-informational?style=flat-square)
44

55
A Helm chart to configure Advanced Cluster Manager for OpenShift.
66

@@ -11,6 +11,8 @@ This chart is used by the Validated Patterns to configure ACM and manage remote
1111
| Key | Type | Default | Description |
1212
|-----|------|---------|-------------|
1313
| acm.mce_operator | object | Uses the official redhat sources | Just used for IIB testing, drives the source and channel for the MCE subscription triggered by ACM |
14+
| acm.spokeGitops.channel | string | `"gitops-1.18"` | Default gitops channel to install on remote clusters |
15+
| acm.spokeGitops.source | string | `"redhat-operators"` | |
1416
| clusterGroup | object | depends on the individual settings | Dictionary of all the clustergroups of the pattern |
1517
| clusterGroup.managedClusterGroups | object | `{}` | The set of cluters managed by ACM which is running inside this clusterGroup |
1618
| clusterGroup.subscriptions | object | `{"acm":{"source":"redhat-operators"}}` | Dictionary of subscriptions for this specific clusterGroup |
@@ -22,7 +24,8 @@ This chart is used by the Validated Patterns to configure ACM and manage remote
2224
| global.repoURL | string | `"none"` | Repository URL pointing to the pattern |
2325
| global.secretStore.backend | string | `"vault"` | |
2426
| global.targetRevision | string | `"main"` | The branch or Git reference to use to deploy the pattern |
25-
| main.gitops.channel | string | `"gitops-1.18"` | Default gitops channel to install on remote clusters |
27+
| main | object | `{"gitops":{"channel":"gitops-1.18"}}` | Deprecated: Use acm.spokeGitops which takes precedence |
28+
| main.gitops.channel | string | `"gitops-1.18"` | DEPRECATED: Default gitops channel to install on remote clusters (Use acm.spokeGitops.channel) |
2629
| secretStore | object | depends on the individual settings | Default secretstore configuration variables |
2730
| secretStore.name | string | `"vault-backend"` | Name of the clustersecretstore to be used for secrets |
2831

templates/policies/ocp-gitops-policy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ spec:
3737
labels:
3838
operators.coreos.com/openshift-gitops-operator.openshift-operators: ''
3939
spec:
40-
channel: {{ default "gitops-1.17" $.Values.main.gitops.channel }}
40+
channel: {{- if and $.Values.acm.spokeGitops $.Values.acm.spokeGitops.channel }} {{ $.Values.acm.spokeGitops.channel }}{{- else if and $.Values.main $.Values.main.gitops $.Values.main.gitops.channel }} {{ $.Values.main.gitops.channel }}{{- else }} gitops-1.18{{- end }}
4141
installPlanApproval: Automatic
4242
name: openshift-gitops-operator
43-
source: {{ default "redhat-operators" $.Values.main.gitops.operatorSource }}
43+
source: {{- if and $.Values.acm.spokeGitops $.Values.acm.spokeGitops.source }} {{ $.Values.acm.spokeGitops.source }}{{- else if and $.Values.main $.Values.main.gitops $.Values.main.gitops.operatorSource }} {{ $.Values.main.gitops.operatorSource }}{{- else }} redhat-operators{{- end }}
4444
sourceNamespace: openshift-marketplace
4545
config:
4646
env:

tests/ocp_gitops_policy_test.yaml

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ tests:
1111
- hasDocuments:
1212
count: 6
1313

14-
- it: Should change the channel when specified
14+
- it: Should change the channel when specified (legacy test updated to use spokeGitops)
1515
values:
1616
- ./clusterselector_values.yaml
1717
set:
18-
main:
19-
gitops:
18+
acm:
19+
spokeGitops:
2020
channel: gitops-9.9.9
2121
asserts:
2222
- documentSelector:
@@ -25,3 +25,73 @@ tests:
2525
equal:
2626
path: spec.policy-templates[0].objectDefinition.spec.object-templates[0].objectDefinition.spec.channel
2727
value: gitops-9.9.9
28+
29+
- it: Should use spokeGitops channel when specified
30+
values:
31+
- ./clusterselector_values.yaml
32+
set:
33+
acm:
34+
spokeGitops:
35+
channel: gitops-2.0.0
36+
asserts:
37+
- documentSelector:
38+
path: metadata.name
39+
value: group-one-gitops-policy
40+
equal:
41+
path: spec.policy-templates[0].objectDefinition.spec.object-templates[0].objectDefinition.spec.channel
42+
value: gitops-2.0.0
43+
44+
- it: Should use spokeGitops source when specified
45+
values:
46+
- ./clusterselector_values.yaml
47+
set:
48+
acm:
49+
spokeGitops:
50+
source: custom-operators
51+
asserts:
52+
- documentSelector:
53+
path: metadata.name
54+
value: group-one-gitops-policy
55+
equal:
56+
path: spec.policy-templates[0].objectDefinition.spec.object-templates[0].objectDefinition.spec.source
57+
value: custom-operators
58+
59+
- it: Should use spokeGitops channel and source when both specified
60+
values:
61+
- ./clusterselector_values.yaml
62+
set:
63+
acm:
64+
spokeGitops:
65+
channel: gitops-2.1.0
66+
source: my-custom-catalog
67+
asserts:
68+
- documentSelector:
69+
path: metadata.name
70+
value: group-one-gitops-policy
71+
equal:
72+
path: spec.policy-templates[0].objectDefinition.spec.object-templates[0].objectDefinition.spec.channel
73+
value: gitops-2.1.0
74+
- documentSelector:
75+
path: metadata.name
76+
value: group-one-gitops-policy
77+
equal:
78+
path: spec.policy-templates[0].objectDefinition.spec.object-templates[0].objectDefinition.spec.source
79+
value: my-custom-catalog
80+
81+
- it: Should prioritize spokeGitops over main gitops settings
82+
values:
83+
- ./clusterselector_values.yaml
84+
set:
85+
main:
86+
gitops:
87+
channel: gitops-fallback
88+
acm:
89+
spokeGitops:
90+
channel: gitops-priority
91+
asserts:
92+
- documentSelector:
93+
path: metadata.name
94+
value: group-one-gitops-policy
95+
equal:
96+
path: spec.policy-templates[0].objectDefinition.spec.object-templates[0].objectDefinition.spec.channel
97+
value: gitops-priority

values.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
# -- Deprecated: Use acm.spokeGitops which takes precedence
12
main:
23
gitops:
3-
# -- Default gitops channel to install on remote clusters
4+
# -- DEPRECATED: Default gitops channel to install on remote clusters (Use acm.spokeGitops.channel)
45
channel: "gitops-1.18"
56

67
global:
@@ -64,6 +65,12 @@ acm:
6465
source: redhat-operators
6566
channel: null
6667

68+
# @default -- Uses the official redhat source and some default channel
69+
spokeGitops:
70+
source: redhat-operators
71+
# -- Default gitops channel to install on remote clusters
72+
channel: "gitops-1.18"
73+
6774

6875
# -- Default secretstore configuration variables
6976
# @default -- depends on the individual settings

0 commit comments

Comments
 (0)