Created
June 6, 2023 17:24
-
-
Save lodotek/88ae2b5b84fb2c5926172d6af7bffdd1 to your computer and use it in GitHub Desktop.
Helm Templated Sealed Secrets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{- if and (.Values.sealedSecret) (.Capabilities.APIVersions.Has "bitnami.com/v1alpha1") }} | |
{{- range $nameSuffix, $config := .Values.sealedSecret.files }} | |
apiVersion: bitnami.com/v1alpha1 | |
kind: SealedSecret | |
metadata: | |
name: {{ template "application.name" $ }}-{{ $nameSuffix }} | |
namespace: {{ template "application.namespace" $ }} | |
labels: | |
{{- include "application.labels" $ | nindent 4 }} | |
{{- if $.Values.sealedSecret.additionalLabels }} | |
{{ toYaml $.Values.sealedSecret.additionalLabels | indent 4 }} | |
{{- end }} | |
{{- if $config.labels }} | |
{{ toYaml $config.labels | indent 4 }} | |
{{- end }} | |
{{- if or ($.Values.sealedSecret.annotations) ($config.annotations) ($config.clusterWide) }} | |
annotations: | |
{{- if $config.annotations }} | |
{{ toYaml $config.annotations | indent 4 }} | |
{{- end }} | |
{{- if $.Values.sealedSecret.annotations }} | |
{{ toYaml $.Values.sealedSecret.annotations | indent 4 }} | |
{{- end }} | |
{{- if $config.clusterWide}} | |
sealedsecrets.bitnami.com/cluster-wide: "true" | |
{{- end}} | |
{{- end }} | |
spec: | |
encryptedData: | |
{{- range $key, $value := $config.encryptedData }} | |
{{ $key }}: {{ $value }} | |
{{- end }} | |
template: | |
type: {{ $config.type | default "Opaque" }} | |
metadata: | |
name: {{ template "application.name" $ }}-{{ $nameSuffix }} | |
namespace: {{ template "application.namespace" $ }} | |
{{- if or ($.Values.sealedSecret.annotations) ($config.annotations) ($config.clusterWide) }} | |
annotations: | |
{{- if $config.annotations }} | |
{{ toYaml $config.annotations | indent 2 }} | |
{{- end }} | |
{{- if $.Values.sealedSecret.annotations }} | |
{{ toYaml $.Values.sealedSecret.annotations | indent 2 }} | |
{{- end }} | |
{{- if $config.clusterWide}} | |
sealedsecrets.bitnami.com/cluster-wide: "true" | |
{{- end}} | |
{{- end }} | |
{{- if or ($config.labels) ($.Values.sealedSecret.additionalLabels) }} | |
labels: | |
{{- if $config.labels }} | |
{{ toYaml $config.labels | indent 2 }} | |
{{- end }} | |
{{- if $.Values.sealedSecret.additionalLabels }} | |
{{ toYaml $.Values.sealedSecret.additionalLabels | indent 2 }} | |
{{- end }} | |
{{- end }} | |
--- | |
{{- end }} | |
{{- end }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment