diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index 78e11bbfbca..afc7075664b 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: common sources: null type: library -version: 8.9.4 +version: 8.9.5 diff --git a/charts/library/common/templates/classes/_ingress.tpl b/charts/library/common/templates/classes/_ingress.tpl index 8bc3a33cd27..928d806b2a4 100644 --- a/charts/library/common/templates/classes/_ingress.tpl +++ b/charts/library/common/templates/classes/_ingress.tpl @@ -85,7 +85,7 @@ spec: - {{ tpl . $ | quote }} {{- end }} {{- if $tlsValues.scaleCert }} - secretName: {{ ( printf "%v-%v-%v-%v-%v" $ingressName "tls" $index "ixcert" $tlsValues.scaleCert ) }} + secretName: {{ ( printf "%v-%v-%v-%v-%v-%v" $ingressName "tls" $index "ixcert" $tlsValues.scaleCert $.Release.Revision ) }} {{- else if .secretName }} secretName: {{ tpl .secretName $ | quote}} {{- end }} diff --git a/charts/library/common/templates/lib/cert/_certSecret.tpl b/charts/library/common/templates/lib/cert/_certSecret.tpl index 07e2e42cb90..908edf39ffd 100644 --- a/charts/library/common/templates/lib/cert/_certSecret.tpl +++ b/charts/library/common/templates/lib/cert/_certSecret.tpl @@ -20,7 +20,7 @@ apiVersion: v1 kind: Secret metadata: - name: {{ $secretName }} + name: {{ $secretName }}-{{ .Release.Revision }} labels: {{ include "common.labels" . | nindent 4 }} type: kubernetes.io/tls data: diff --git a/tests/library/common/cert_spec.rb b/tests/library/common/cert_spec.rb index 977f6d2c7cc..9b9ac6254e8 100644 --- a/tests/library/common/cert_spec.rb +++ b/tests/library/common/cert_spec.rb @@ -88,7 +88,7 @@ class Test < ChartTest chart.value values refute_nil(resource('Secret')) secret = chart.resources(kind: "Secret").first - assert_equal("common-test-tls-0-ixcert-1", secret["metadata"]["name"]) + assert_equal("common-test-tls-0-ixcert-1-1", secret["metadata"]["name"]) refute_nil(secret["data"]["tls.crt"]) refute_nil(secret["data"]["tls.key"]) end @@ -166,13 +166,13 @@ class Test < ChartTest chart.value values refute_nil(resource('Secret')) secret = chart.resources(kind: "Secret").first - assert_equal("common-test-tls-0-ixcert-1", secret["metadata"]["name"]) + assert_equal("common-test-tls-0-ixcert-1-1", secret["metadata"]["name"]) refute_nil(secret["data"]["tls.crt"]) refute_nil(secret["data"]["tls.key"]) ingress = chart.resources(kind: "Ingress").find{ |s| s["metadata"]["name"] == "common-test" } refute_nil(ingress) - assert_equal("common-test-tls-0-ixcert-1", ingress["spec"]["tls"][0]["secretName"]) + assert_equal("common-test-tls-0-ixcert-1-1", ingress["spec"]["tls"][0]["secretName"]) end it 'multiple tls sections generate multiple secrets' do values = { @@ -304,18 +304,18 @@ class Test < ChartTest chart.value values refute_nil(resource('Secret')) secret1 = chart.resources(kind: "Secret").first - assert_equal("common-test-tls-0-ixcert-1", secret1["metadata"]["name"]) + assert_equal("common-test-tls-0-ixcert-1-1", secret1["metadata"]["name"]) refute_nil(secret1["data"]["tls.crt"]) refute_nil(secret1["data"]["tls.key"]) - secret2 = chart.resources(kind: "Secret").find{ |s| s["metadata"]["name"] == "common-test-tls-1-ixcert-2" } + secret2 = chart.resources(kind: "Secret").find{ |s| s["metadata"]["name"] == "common-test-tls-1-ixcert-2-1" } refute_nil(secret2) refute_nil(secret2["data"]["tls.crt"]) refute_nil(secret2["data"]["tls.key"]) ingress = chart.resources(kind: "Ingress").find{ |s| s["metadata"]["name"] == "common-test" } refute_nil(ingress) - assert_equal("common-test-tls-0-ixcert-1", ingress["spec"]["tls"][0]["secretName"]) - assert_equal("common-test-tls-1-ixcert-2", ingress["spec"]["tls"][1]["secretName"]) + assert_equal("common-test-tls-0-ixcert-1-1", ingress["spec"]["tls"][0]["secretName"]) + assert_equal("common-test-tls-1-ixcert-2-1", ingress["spec"]["tls"][1]["secretName"]) end end end