mirror of
https://github.com/outbackdingo/cozystack.git
synced 2026-01-27 18:18:41 +00:00
Introduce optional components (#391)
This PR introduces an extra option to cozystack configmap. It allows to enable components that are optional to specific bundle name, example usage: ```yaml bundle-enable: telepresence,external-dns,external-secrets-operator ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added optional attributes to several release entries, allowing for more flexible deployment configurations. - Enhanced Helm release generation logic to consider both enabled and disabled states for components. - Improved namespace management by incorporating checks for optional components based on enablement and disablement. - **Bug Fixes** - Updated dependencies for `external-dns` to include `cilium` and `kubeovn`. - **Documentation** - Clarified the configurability of deployment components with the introduction of optional attributes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
This commit is contained in:
@@ -140,16 +140,19 @@ releases:
|
||||
releaseName: traffic-manager
|
||||
chart: cozy-telepresence
|
||||
namespace: cozy-telepresence
|
||||
optional: true
|
||||
dependsOn: []
|
||||
|
||||
- name: external-dns
|
||||
releaseName: external-dns
|
||||
chart: cozy-external-dns
|
||||
namespace: cozy-external-dns
|
||||
optional: true
|
||||
dependsOn: [cilium]
|
||||
|
||||
- name: external-secrets-operator
|
||||
releaseName: external-secrets-operator
|
||||
chart: cozy-external-secrets-operator
|
||||
namespace: cozy-external-secrets-operator
|
||||
optional: true
|
||||
dependsOn: [cilium]
|
||||
|
||||
@@ -91,16 +91,19 @@ releases:
|
||||
releaseName: traffic-manager
|
||||
chart: cozy-telepresence
|
||||
namespace: cozy-telepresence
|
||||
optional: true
|
||||
dependsOn: []
|
||||
|
||||
- name: external-dns
|
||||
releaseName: external-dns
|
||||
chart: cozy-external-dns
|
||||
namespace: cozy-external-dns
|
||||
optional: true
|
||||
dependsOn: []
|
||||
|
||||
- name: external-secrets-operator
|
||||
releaseName: external-secrets-operator
|
||||
chart: cozy-external-secrets-operator
|
||||
namespace: cozy-external-secrets-operator
|
||||
optional: true
|
||||
dependsOn: []
|
||||
|
||||
@@ -175,6 +175,7 @@ releases:
|
||||
releaseName: traffic-manager
|
||||
chart: cozy-telepresence
|
||||
namespace: cozy-telepresence
|
||||
optional: true
|
||||
dependsOn: [cilium,kubeovn]
|
||||
|
||||
- name: dashboard
|
||||
@@ -221,10 +222,12 @@ releases:
|
||||
releaseName: external-dns
|
||||
chart: cozy-external-dns
|
||||
namespace: cozy-external-dns
|
||||
optional: true
|
||||
dependsOn: [cilium,kubeovn]
|
||||
|
||||
- name: external-secrets-operator
|
||||
releaseName: external-secrets-operator
|
||||
chart: cozy-external-secrets-operator
|
||||
namespace: cozy-external-secrets-operator
|
||||
optional: true
|
||||
dependsOn: [cilium,kubeovn]
|
||||
|
||||
@@ -97,18 +97,21 @@ releases:
|
||||
releaseName: traffic-manager
|
||||
chart: cozy-telepresence
|
||||
namespace: cozy-telepresence
|
||||
optional: true
|
||||
dependsOn: []
|
||||
|
||||
- name: external-dns
|
||||
releaseName: external-dns
|
||||
chart: cozy-external-dns
|
||||
namespace: cozy-external-dns
|
||||
optional: true
|
||||
dependsOn: [cilium,kubeovn]
|
||||
|
||||
- name: external-secrets-operator
|
||||
releaseName: external-secrets-operator
|
||||
chart: cozy-external-secrets-operator
|
||||
namespace: cozy-external-secrets-operator
|
||||
optional: true
|
||||
dependsOn: []
|
||||
|
||||
- name: dashboard
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
{{- $bundle := tpl (.Files.Get (printf "bundles/%s.yaml" $bundleName)) . | fromYaml }}
|
||||
{{- $dependencyNamespaces := dict }}
|
||||
{{- $disabledComponents := splitList "," ((index $cozyConfig.data "bundle-disable") | default "") }}
|
||||
{{- $enabledComponents := splitList "," ((index $cozyConfig.data "bundle-enable") | default "") }}
|
||||
|
||||
{{/* collect dependency namespaces from releases */}}
|
||||
{{- range $x := $bundle.releases }}
|
||||
@@ -11,6 +12,7 @@
|
||||
|
||||
{{- range $x := $bundle.releases }}
|
||||
{{- if not (has $x.name $disabledComponents) }}
|
||||
{{- if and ($x.optional) (has $x.name $enabledComponents) }}
|
||||
---
|
||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||
kind: HelmRelease
|
||||
@@ -65,3 +67,4 @@ spec:
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
{{- $cozyConfig := lookup "v1" "ConfigMap" "cozy-system" "cozystack" }}
|
||||
{{- $bundleName := index $cozyConfig.data "bundle-name" }}
|
||||
{{- $bundle := tpl (.Files.Get (printf "bundles/%s.yaml" $bundleName)) . | fromYaml }}
|
||||
{{- $disabledComponents := splitList "," ((index $cozyConfig.data "bundle-disable") | default "") }}
|
||||
{{- $enabledComponents := splitList "," ((index $cozyConfig.data "bundle-enable") | default "") }}
|
||||
{{- $namespaces := dict }}
|
||||
|
||||
{{/* collect namespaces from releases */}}
|
||||
{{- range $x := $bundle.releases }}
|
||||
{{- if not (hasKey $namespaces $x.namespace) }}
|
||||
{{- $_ := set $namespaces $x.namespace false }}
|
||||
{{- end }}
|
||||
{{/* if at least one release requires a privileged namespace, then it should be privileged */}}
|
||||
{{- if or $x.privileged (index $namespaces $x.namespace) }}
|
||||
{{- $_ := set $namespaces $x.namespace true }}
|
||||
{{- end }}
|
||||
{{- if not (hasKey $namespaces $x.namespace) }}
|
||||
{{- if not (has $x.name $disabledComponents) }}
|
||||
{{- if and ($x.optional) (has $x.name $enabledComponents) }}
|
||||
{{- $_ := set $namespaces $x.namespace false }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{/* if at least one release requires a privileged namespace, then it should be privileged */}}
|
||||
{{- if or $x.privileged (index $namespaces $x.namespace) }}
|
||||
{{- $_ := set $namespaces $x.namespace true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* Add extra namespaces */}}
|
||||
|
||||
Reference in New Issue
Block a user