From 2579b49dc14aefed337c9505dc970c702fb8959c Mon Sep 17 00:00:00 2001 From: Gaspard FEREY Date: Wed, 23 Oct 2024 14:25:01 +0200 Subject: [PATCH] [library-chart] Template for cacerts secret --- charts/library-chart/Chart.yaml | 2 +- charts/library-chart/templates/_secret.tpl | 33 +++++++++++++++++++++- charts/library-chart/values.yaml | 1 - 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/charts/library-chart/Chart.yaml b/charts/library-chart/Chart.yaml index 74169d66..4aff5f6a 100644 --- a/charts/library-chart/Chart.yaml +++ b/charts/library-chart/Chart.yaml @@ -1,4 +1,4 @@ apiVersion: v2 name: library-chart -version: 1.5.27 +version: 1.5.28 type: library diff --git a/charts/library-chart/templates/_secret.tpl b/charts/library-chart/templates/_secret.tpl index 87d710f3..5176a5db 100644 --- a/charts/library-chart/templates/_secret.tpl +++ b/charts/library-chart/templates/_secret.tpl @@ -441,4 +441,35 @@ stringData: {{- end }} {{- end }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} + + +{{/* Name of the CA certificates secret */}} +{{- define "library-chart.secretNameCacerts" -}} +{{- if .Values.certificates }} +{{- $name:= (printf "%s-secretcacerts" (include "library-chart.fullname" .) ) }} +{{- default $name .Values.certificates.secretName }} +{{- else }} +{{- default "default" .Values.certificates.secretName }} +{{- end }} +{{- end }} + +{{/* Template to generate a secret for CA certificates */}} +{{- define "library-chart.secretCacerts" -}} +{{- if and .Values.certificates .Values.certificates.cacerts }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "library-chart.secretNameCacerts" . }} + labels: + {{- include "library-chart.labels" . | nindent 4 }} +type: Opaque +stringData: + {{- if regexMatch "^https?://" .Values.certificates.cacerts }} + ca-certs.url: {{ .Values.certificates.cacerts }} + {{- else }} + ca.pem: | + {{- .Values.certificates.cacerts | nindent 4 }} + {{- end }} +{{- end }} +{{- end }} diff --git a/charts/library-chart/values.yaml b/charts/library-chart/values.yaml index 8b137891..e69de29b 100644 --- a/charts/library-chart/values.yaml +++ b/charts/library-chart/values.yaml @@ -1 +0,0 @@ -