Skip to content

Commit 6e932f7

Browse files
committed
Introduce optional components
Signed-off-by: Andrei Kvapil <[email protected]>
1 parent eda62ff commit 6e932f7

6 files changed

Lines changed: 28 additions & 7 deletions

File tree

‎packages/core/platform/bundles/distro-full.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,19 @@ releases:
140140
releaseName: traffic-manager
141141
chart: cozy-telepresence
142142
namespace: cozy-telepresence
143+
optional: true
143144
dependsOn: []
144145

145146
- name: external-dns
146147
releaseName: external-dns
147148
chart: cozy-external-dns
148149
namespace: cozy-external-dns
150+
optional: true
149151
dependsOn: [cilium]
150152

151153
- name: external-secrets-operator
152154
releaseName: external-secrets-operator
153155
chart: cozy-external-secrets-operator
154156
namespace: cozy-external-secrets-operator
157+
optional: true
155158
dependsOn: [cilium]

‎packages/core/platform/bundles/distro-hosted.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,19 @@ releases:
9191
releaseName: traffic-manager
9292
chart: cozy-telepresence
9393
namespace: cozy-telepresence
94+
optional: true
9495
dependsOn: []
9596

9697
- name: external-dns
9798
releaseName: external-dns
9899
chart: cozy-external-dns
99100
namespace: cozy-external-dns
101+
optional: true
100102
dependsOn: []
101103

102104
- name: external-secrets-operator
103105
releaseName: external-secrets-operator
104106
chart: cozy-external-secrets-operator
105107
namespace: cozy-external-secrets-operator
108+
optional: true
106109
dependsOn: []

‎packages/core/platform/bundles/paas-full.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,19 @@ releases:
215215
chart: cozy-capi-providers
216216
namespace: cozy-cluster-api
217217
privileged: true
218+
optional: true
218219
dependsOn: [cilium,kubeovn,capi-operator]
219220

220221
- name: external-dns
221222
releaseName: external-dns
222223
chart: cozy-external-dns
223224
namespace: cozy-external-dns
225+
optional: true
224226
dependsOn: [cilium,kubeovn]
225227

226228
- name: external-secrets-operator
227229
releaseName: external-secrets-operator
228230
chart: cozy-external-secrets-operator
229231
namespace: cozy-external-secrets-operator
232+
optional: true
230233
dependsOn: [cilium,kubeovn]

‎packages/core/platform/bundles/paas-hosted.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,21 @@ releases:
9797
releaseName: traffic-manager
9898
chart: cozy-telepresence
9999
namespace: cozy-telepresence
100+
optional: true
100101
dependsOn: []
101102

102103
- name: external-dns
103104
releaseName: external-dns
104105
chart: cozy-external-dns
105106
namespace: cozy-external-dns
107+
optional: true
106108
dependsOn: [cilium,kubeovn]
107109

108110
- name: external-secrets-operator
109111
releaseName: external-secrets-operator
110112
chart: cozy-external-secrets-operator
111113
namespace: cozy-external-secrets-operator
114+
optional: true
112115
dependsOn: []
113116

114117
- name: dashboard

‎packages/core/platform/templates/helmreleases.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{{- $bundle := tpl (.Files.Get (printf "bundles/%s.yaml" $bundleName)) . | fromYaml }}
44
{{- $dependencyNamespaces := dict }}
55
{{- $disabledComponents := splitList "," ((index $cozyConfig.data "bundle-disable") | default "") }}
6+
{{- $enabledComponents := splitList "," ((index $cozyConfig.data "bundle-enable") | default "") }}
67

78
{{/* collect dependency namespaces from releases */}}
89
{{- range $x := $bundle.releases }}
@@ -11,6 +12,7 @@
1112

1213
{{- range $x := $bundle.releases }}
1314
{{- if not (has $x.name $disabledComponents) }}
15+
{{- if and ($x.optional) (has $x.name $enabledComponents) }}
1416
---
1517
apiVersion: helm.toolkit.fluxcd.io/v2
1618
kind: HelmRelease
@@ -65,3 +67,4 @@ spec:
6567
{{- end }}
6668
{{- end }}
6769
{{- end }}
70+
{{- end }}

‎packages/core/platform/templates/namespaces.yaml‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
{{- $cozyConfig := lookup "v1" "ConfigMap" "cozy-system" "cozystack" }}
22
{{- $bundleName := index $cozyConfig.data "bundle-name" }}
33
{{- $bundle := tpl (.Files.Get (printf "bundles/%s.yaml" $bundleName)) . | fromYaml }}
4+
{{- $disabledComponents := splitList "," ((index $cozyConfig.data "bundle-disable") | default "") }}
5+
{{- $enabledComponents := splitList "," ((index $cozyConfig.data "bundle-enable") | default "") }}
46
{{- $namespaces := dict }}
57

68
{{/* collect namespaces from releases */}}
79
{{- range $x := $bundle.releases }}
8-
{{- if not (hasKey $namespaces $x.namespace) }}
9-
{{- $_ := set $namespaces $x.namespace false }}
10-
{{- end }}
11-
{{/* if at least one release requires a privileged namespace, then it should be privileged */}}
12-
{{- if or $x.privileged (index $namespaces $x.namespace) }}
13-
{{- $_ := set $namespaces $x.namespace true }}
14-
{{- end }}
10+
{{- if not (hasKey $namespaces $x.namespace) }}
11+
{{- if not (has $x.name $disabledComponents) }}
12+
{{- if and ($x.optional) (has $x.name $enabledComponents) }}
13+
{{- $_ := set $namespaces $x.namespace false }}
14+
{{- end }}
15+
{{- end }}
16+
{{- end }}
17+
{{/* if at least one release requires a privileged namespace, then it should be privileged */}}
18+
{{- if or $x.privileged (index $namespaces $x.namespace) }}
19+
{{- $_ := set $namespaces $x.namespace true }}
20+
{{- end }}
1521
{{- end }}
1622

1723
{{/* Add extra namespaces */}}

0 commit comments

Comments
 (0)