From 269ab7e37672c9a86103afcce705fdf57e97880e Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Fri, 13 Aug 2021 09:10:47 +0200 Subject: [PATCH] Using unique names for TLS secrets --- charts/cron-job/charts/common-0.1.0.tgz | Bin 1795 -> 1794 bytes charts/onechart/charts/common-0.1.0.tgz | Bin 1793 -> 1794 bytes charts/onechart/templates/ingress.yaml | 12 ++++++------ .../onechart/tests/ingress_domain_test.yaml | 18 ++++++++++++++++++ values.yaml | 2 ++ 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/charts/cron-job/charts/common-0.1.0.tgz b/charts/cron-job/charts/common-0.1.0.tgz index fefb316fb10beb8f337da5bc14b1a83f38607e71..c9f6ba2e444dcec59ab36025b057dcbe63705e3f 100644 GIT binary patch delta 1754 zcmV<01||7}4uTGlJb(XghdV(x@O#~$cNF+LesI|B`8(i$hJRQVEY*gp9siSkRUht& z7){tYD$S%A!1U0IP=|^o#@)YwKO>JJw0i?aQo&!-Au53ewI^td1ITudXKoT40B1u* z)r~hT=JQEFeD6y?VPnfI$G^ci;nbk+T!vDN*f^%i#^_)b{(Jpi1^>O?VT1pz*zIi_ zA{;S+(8~4#nSX5nlkgU_@9#a^i;aMsQ=XzGQ>rxF-+Oc95qMWjL<2Z+!(Y+Fi_y@C z8anU*GQPOIg<_{YxKnbNYV(@L*aC8j9H~ZPZ>@)HpiXF*jh^e^nzLS<4v}l?2*3p^ zLY_tltqJnD?HG(?eOf@^4g?bs3Ikm`Jd4o|Q&fx*_J6MM<^cAll*8cp!b4jJt_$4X zyO>p@<&2w9EOWUwX+F@sDEqqmuC{jy6RAEASr#{h*5fesJ92e;ZbV z|I!Ai5`a|jeeqMq#k1M1#!#X8LC_(`=-D%vwNsAKnft3QH`|5+?z!s$e4AfA#ykLR z2n(V)#eY$T{Ew!Y3QkK7=N_lyw&0TsEtEc~@m0Z01 z(i^_9Ia}oa5#yL`jxF)O-}Czm{D0JI_bZ+_2w85k5IVx27%P ze}X(grR}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^7gygvW0p8p2Ny{7)Z6RY9> z>IQi15V%qhSU3Z&WCf*j;L5o{IoJ@sE#I!LJ=mmtegs+;k+JPJ*i_CVmoCDHJG;tohLf@@}`@Q0@a ztc(FETu(bC%kRLMK;n@XXP0M2D)jc?#BEtPKRJVlDeaL7GadJtP2VG zV?T;pJrkYzKqDGnrBR7H`_|q8(btK0Kt}Y+J0K>u*HW>Gckpj-56-D#GS%>x7e8o^ uBuf5@q45ZdkajY6C4cqEOouYUPQ!zZHP+adZ2u1c0RR7iHz(WxH~;|IJcY;r diff --git a/charts/onechart/templates/ingress.yaml b/charts/onechart/templates/ingress.yaml index 2a53ef7..f7e952a 100644 --- a/charts/onechart/templates/ingress.yaml +++ b/charts/onechart/templates/ingress.yaml @@ -1,15 +1,15 @@ {{/* OneChart ingress snippet */}} {{- define "onechart.ingress" }} {{- $robustName := include "robustName" .root.Release.Name -}} +{{- $resourceName := $robustName -}} +{{- if .longName }} +{{- $resourceName = printf "%s-%s" $robustName (include "robustName" .ingress.host) -}} +{{- end }} --- apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: - {{- if .longName }} - name: {{ $robustName }}-{{ template "robustName" .ingress.host }} - {{- else }} - name: {{ $robustName }} - {{- end }} + name: {{ $resourceName }} namespace: {{ .root.Release.Namespace }} labels: {{- include "helm-chart.labels" .root | nindent 4 }} @@ -30,7 +30,7 @@ spec: tls: - hosts: - {{ template "robustName" .ingress.host | quote }} - secretName: {{ printf "tls-%s" $robustName }} + secretName: {{ printf "tls-%s" $resourceName }} {{- end }} rules: - host: {{ template "robustName" .ingress.host | quote }} diff --git a/charts/onechart/tests/ingress_domain_test.yaml b/charts/onechart/tests/ingress_domain_test.yaml index 33e7d21..cb011b5 100644 --- a/charts/onechart/tests/ingress_domain_test.yaml +++ b/charts/onechart/tests/ingress_domain_test.yaml @@ -83,3 +83,21 @@ tests: asserts: - hasDocuments: count: 3 + - it: Should have unique TLS secret names + set: + ingresses: + - host: chart-example.local + tlsEnabled: true + annotations: + kubernetes.io/ingress.class: nginx + - host: another.local + tlsEnabled: true + annotations: + kubernetes.io/ingress.class: nginx + asserts: + - equal: + path: spec.tls + value: + - hosts: + - chart-example.local + secretName: tls-release-name-chart-example.local diff --git a/values.yaml b/values.yaml index 6240a18..29924db 100644 --- a/values.yaml +++ b/values.yaml @@ -4,9 +4,11 @@ ingress: kubernetes.io/ingress.class: nginx ingresses: - host: chart-example.local + tlsEnabled: true annotations: kubernetes.io/ingress.class: nginx - host: another.local + tlsEnabled: true annotations: kubernetes.io/ingress.class: nginx