diff --git a/helm-toolkit/Chart.yaml b/helm-toolkit/Chart.yaml index a94b72386..a701e055a 100644 --- a/helm-toolkit/Chart.yaml +++ b/helm-toolkit/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Helm-Toolkit name: helm-toolkit -version: 0.2.63 +version: 0.2.64 home: https://docs.openstack.org/openstack-helm icon: https://www.openstack.org/themes/openstack/images/project-mascots/OpenStack-Helm/OpenStack_Project_OpenStackHelm_vertical.png sources: diff --git a/helm-toolkit/templates/manifests/_secret-registry.yaml.tpl b/helm-toolkit/templates/manifests/_secret-registry.yaml.tpl index 4854bb1ec..7ad505b55 100644 --- a/helm-toolkit/templates/manifests/_secret-registry.yaml.tpl +++ b/helm-toolkit/templates/manifests/_secret-registry.yaml.tpl @@ -17,6 +17,11 @@ abstract: | Creates a manifest for a authenticating a registry with a secret examples: - values: | + annotations: + secret: + oci_image_registry: + {{ $serviceName }}: + custom.tld/key: "value" secrets: oci_image_registry: {{ $serviceName }}: {{ $keyName }} @@ -36,30 +41,8 @@ examples: kind: Secret metadata: name: {{ $secretName }} - type: kubernetes.io/dockerconfigjson - data: - dockerconfigjson: {{ $dockerAuth }} - - - values: | - secrets: - oci_image_registry: - {{ $serviceName }}: {{ $keyName }} - endpoints: - oci_image_registry: - name: oci-image-registry - auth: - enabled: true - {{ $serviceName }}: - name: {{ $userName }} - password: {{ $password }} - usage: | - {{- include "helm-toolkit.manifests.secret_registry" ( dict "envAll" . "registryUser" .Chart.Name ) -}} - return: | - --- - apiVersion: v1 - kind: Secret - metadata: - name: {{ $secretName }} + annotations: + custom.tld/key: "value" type: kubernetes.io/dockerconfigjson data: dockerconfigjson: {{ $dockerAuth }} @@ -87,6 +70,8 @@ apiVersion: v1 kind: Secret metadata: name: {{ $secretName }} + annotations: +{{ tuple "oci_image_registry" $registryUser $envAll | include "helm-toolkit.snippets.custom_secret_annotations" | indent 4 }} type: kubernetes.io/dockerconfigjson data: .dockerconfigjson: {{ $dockerAuth }} diff --git a/helm-toolkit/templates/manifests/_secret-tls.yaml.tpl b/helm-toolkit/templates/manifests/_secret-tls.yaml.tpl index 24a70450c..c80034030 100644 --- a/helm-toolkit/templates/manifests/_secret-tls.yaml.tpl +++ b/helm-toolkit/templates/manifests/_secret-tls.yaml.tpl @@ -17,6 +17,11 @@ abstract: | Creates a manifest for a services public tls secret examples: - values: | + annotations: + secret: + tls: + key_manager_api_public: + custom.tld/key: "value" secrets: tls: key_manager: @@ -41,6 +46,8 @@ examples: kind: Secret metadata: name: barbican-tls-public + annotations: + custom.tld/key: "value" type: kubernetes.io/tls data: tls.key: Rk9PLUtFWQo= @@ -88,11 +95,15 @@ examples: {{- if kindIs "map" $endpointHost }} {{- if hasKey $endpointHost "tls" }} {{- if and $endpointHost.tls.key $endpointHost.tls.crt }} + +{{- $customAnnotationKey := printf "%s_%s_%s" ( $backendServiceType | replace "-" "_" ) $backendService $endpoint }} --- apiVersion: v1 kind: Secret metadata: name: {{ index $envAll.Values.secrets.tls ( $backendServiceType | replace "-" "_" ) $backendService $endpoint }} + annotations: +{{ tuple "tls" $customAnnotationKey $envAll | include "helm-toolkit.snippets.custom_secret_annotations" | indent 4 }} type: kubernetes.io/tls data: tls.key: {{ $endpointHost.tls.key | b64enc }} diff --git a/helm-toolkit/templates/snippets/_custom_secret_annotations.tpl b/helm-toolkit/templates/snippets/_custom_secret_annotations.tpl index f5c321148..19c438088 100644 --- a/helm-toolkit/templates/snippets/_custom_secret_annotations.tpl +++ b/helm-toolkit/templates/snippets/_custom_secret_annotations.tpl @@ -63,7 +63,7 @@ examples: {{- define "helm-toolkit.snippets.custom_secret_annotations" -}} {{- $secretType := index . 0 -}} -{{- $userClass := index . 1 -}} +{{- $userClass := index . 1 | replace "-" "_" -}} {{- $envAll := index . 2 -}} {{- if (hasKey $envAll.Values "annotations") -}} {{- if (hasKey $envAll.Values.annotations "secret") -}} diff --git a/releasenotes/notes/helm-toolkit.yaml b/releasenotes/notes/helm-toolkit.yaml index d5cb85182..9805c4ad8 100644 --- a/releasenotes/notes/helm-toolkit.yaml +++ b/releasenotes/notes/helm-toolkit.yaml @@ -70,4 +70,5 @@ helm-toolkit: - 0.2.61 Add custom pod annotations snippet - 0.2.62 Add custom secret annotations snippet - 0.2.63 Add custom job annotations snippet and wire it into job templates + - 0.2.64 Use custom secret annotations snippet in other secret templates ...