Skip to content

Commit

Permalink
feat: Render control plane ingress spec as template in helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
garryod committed Nov 22, 2024
1 parent f6d72d3 commit 416924c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chart/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ metadata:
{{ toYaml .Values.controlPlane.ingress.labels | indent 4 }}
{{- end }}
spec:
{{- if .Values.controlPlane.ingress.spec }}
{{ toYaml .Values.controlPlane.ingress.spec | indent 2 }}
{{- with .Values.controlPlane.ingress.spec }}
{{- tpl (toYaml .) $ | nindent 2 }}
{{- end }}
{{- if not .Values.controlPlane.ingress.spec.rules }}
rules:
Expand Down
28 changes: 28 additions & 0 deletions chart/tests/ingress_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,31 @@ tests:
- ingress-demo.example.com
secretName: ingress-demo-tls

- it: template ingress spec
set:
controlPlane:
ingress:
enabled: true
host: my-host
spec:
tls:
- hosts:
- ingress-demo.example.com
secretName: '{{ .Release.Name }}-ingress-demo-tls'
asserts:
- hasDocuments:
count: 1
- lengthEqual:
path: spec.tls
count: 1
- equal:
path: spec.rules[0].host
value: my-host
- contains:
path: spec.tls
count: 1
content:
hosts:
- ingress-demo.example.com
secretName: RELEASE-NAME-ingress-demo-tls

0 comments on commit 416924c

Please sign in to comment.