diff --git a/charts/cdviz-collector/templates/extra-resources.yaml b/charts/cdviz-collector/templates/extra-resources.yaml index 8400d7e..8801ea0 100644 --- a/charts/cdviz-collector/templates/extra-resources.yaml +++ b/charts/cdviz-collector/templates/extra-resources.yaml @@ -1,4 +1,7 @@ -{{- range .Values.extraResources }} +{{- range $_, $extraResource := .Values.extraResources }} +{{- if $extraResource.enabled }} +{{- $def := unset $extraResource "enabled" }} --- -{{- tpl (toYaml .) $ }} +{{- tpl (toYaml $def) $ }} {{- end}} +{{- end }} diff --git a/charts/cdviz-collector/values.yaml b/charts/cdviz-collector/values.yaml index f1262ef..bef482b 100644 --- a/charts/cdviz-collector/values.yaml +++ b/charts/cdviz-collector/values.yaml @@ -113,5 +113,8 @@ config: | # Additional kubernetes resources to create. Helm template could be used. # you could use it to create secrets, or custom resources like external secrets, -# configmaps, gateways,... -extraResources: [] +# configmaps, gateways, volumes, keda, ... +# - the name/key of the resource is used just to access the definition more easily than an arrays's index +# - the 'enabled' field is used to enable/disable the resource (removed when the resource is templated) +# - user can add any other resource definition as child node of extraResources +extraResources: {} diff --git a/charts/cdviz-db/templates/extra-resources.yaml b/charts/cdviz-db/templates/extra-resources.yaml index 8400d7e..8801ea0 100644 --- a/charts/cdviz-db/templates/extra-resources.yaml +++ b/charts/cdviz-db/templates/extra-resources.yaml @@ -1,4 +1,7 @@ -{{- range .Values.extraResources }} +{{- range $_, $extraResource := .Values.extraResources }} +{{- if $extraResource.enabled }} +{{- $def := unset $extraResource "enabled" }} --- -{{- tpl (toYaml .) $ }} +{{- tpl (toYaml $def) $ }} {{- end}} +{{- end }} diff --git a/charts/cdviz-db/values.yaml b/charts/cdviz-db/values.yaml index 659ffe2..10c47b2 100644 --- a/charts/cdviz-db/values.yaml +++ b/charts/cdviz-db/values.yaml @@ -19,6 +19,36 @@ env: # Additional kubernetes resources to create. Helm template could be used. # you could use it to create secrets, or custom resources like external secrets, -# database definitions for an operator,... -# apiVersion: postgresql.cnpg.io/v1 -extraResources: [] +# configmaps, gateways, volumes, keda, ... +# - the name/key of the resource is used just to access the definition more easily than an arrays's index +# - the 'enabled' field is used to enable/disable the resource (removed when the resource is templated) +# - user can add any other resource definition as child node of extraResources +extraResources: + cloudnative-pg-basic: + enabled: false + apiVersion: postgresql.cnpg.io/v1 + kind: Cluster + metadata: + name: cdviz-db + spec: + instances: 1 + storage: + size: 100Mi + monitoring: + enablePodMonitor: true + bootstrap: + initdb: + database: cdviz + owner: cdviz + secret: + name: cdviz-db-owner-secret + cdviz-db-owner-secret: + enabled: false + apiVersion: v1 + kind: Secret + metadata: + name: cdviz-db-owner-secret + type: kubernetes.io/basic-auth + data: + username: '{{ "cdviz-su" b64enc }}' + password: '{{ "mysecretpassword" | b64enc }}' diff --git a/charts/cdviz-grafana/templates/extra-resources.yaml b/charts/cdviz-grafana/templates/extra-resources.yaml index 8400d7e..8801ea0 100644 --- a/charts/cdviz-grafana/templates/extra-resources.yaml +++ b/charts/cdviz-grafana/templates/extra-resources.yaml @@ -1,4 +1,7 @@ -{{- range .Values.extraResources }} +{{- range $_, $extraResource := .Values.extraResources }} +{{- if $extraResource.enabled }} +{{- $def := unset $extraResource "enabled" }} --- -{{- tpl (toYaml .) $ }} +{{- tpl (toYaml $def) $ }} {{- end}} +{{- end }} diff --git a/charts/cdviz-grafana/values.yaml b/charts/cdviz-grafana/values.yaml index fa05906..f0032fe 100644 --- a/charts/cdviz-grafana/values.yaml +++ b/charts/cdviz-grafana/values.yaml @@ -27,5 +27,13 @@ dashboards: # Additional kubernetes resources to create. Helm template could be used. # you could use it to create secrets, or custom resources like external secrets, -# configmaps, gateways,... -extraResources: [] +# configmaps, gateways, volumes, keda, ... +# - the name/key of the resource is used just to access the definition more easily than an arrays's index +# - the 'enabled' field is used to enable/disable the resource (removed when the resource is templated) +# - user can add any other resource definition as child node of extraResources +extraResources: {} + # sample: + # enabled: false + # apiVersion: v1 + # kind: Secret + # ... diff --git a/demos/stack-k8s/values/cdviz-collector.yml b/demos/stack-k8s/values/cdviz-collector.yml index 8ed89bb..37da7af 100644 --- a/demos/stack-k8s/values/cdviz-collector.yml +++ b/demos/stack-k8s/values/cdviz-collector.yml @@ -6,7 +6,9 @@ env: key: DATABASE_URL extraResources: - - apiVersion: v1 + secrets: + enabled: true + apiVersion: v1 kind: Secret metadata: name: cdviz-db-collector diff --git a/demos/stack-k8s/values/cdviz-db.yml b/demos/stack-k8s/values/cdviz-db.yml index d44b4a7..9dbe5e1 100644 --- a/demos/stack-k8s/values/cdviz-db.yml +++ b/demos/stack-k8s/values/cdviz-db.yml @@ -11,7 +11,9 @@ env: key: DATABASE_URL extraResources: - - apiVersion: postgresql.cnpg.io/v1 + postgresql: + enabled: true + apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: cdviz-db @@ -27,7 +29,9 @@ extraResources: owner: "{{ .Values.secrets.values.CDVIZ_SU_POSTGRES_USER }}" secret: name: cdviz-db-owner-secret - - apiVersion: v1 + cdviz-db-owner-secret: + enabled: true + apiVersion: v1 kind: Secret metadata: name: cdviz-db-owner-secret @@ -35,7 +39,9 @@ extraResources: data: username: "{{ .Values.secrets.values.CDVIZ_SU_POSTGRES_USER | b64enc }}" password: "{{ .Values.secrets.values.CDVIZ_SU_POSTGRES_PASSWORD | b64enc }}" - - apiVersion: v1 + migration-secret: + enabled: true + apiVersion: v1 kind: Secret metadata: name: cdviz-db-su