Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions charts/external-dns/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ spec:
{{- range $value }}
- --{{ $key }}={{ tpl (. | toString) $ }}
{{- end }}
{{- else if kindIs "bool" $value }}
{{- if $value }}
- --{{ $key }}
{{- else }}
- --no-{{ $key }}
{{- end }}
{{- else }}
- --{{ $key }}={{ tpl ($value | toString) $ }}
{{- end }}
Expand Down
46 changes: 32 additions & 14 deletions charts/external-dns/tests/deployment-flags_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ release:
tests:
- it: should provide expected default flags
asserts:
- exists :
- exists:
path: spec.template.spec.containers[?(@.name == "external-dns")]
- equal :
- equal:
path: spec.template.spec.containers[?(@.name == "external-dns")].args
value:
- --log-level=info
Expand All @@ -25,9 +25,9 @@ tests:
txtPrefix: ""
txtSuffix: "test-suffix"
asserts:
- exists :
- exists:
path: spec.template.spec.containers[?(@.name == "external-dns")]
- equal :
- equal:
path: spec.template.spec.containers[?(@.name == "external-dns")].args
value:
- --log-level=info
Expand All @@ -50,7 +50,7 @@ tests:
set:
txtSuffix: "custom-suffix"
asserts:
- exists :
- exists:
path: spec.template.spec.containers[?(@.name == "external-dns")]
- contains:
path: spec.template.spec.containers[?(@.name == "external-dns")].args
Expand Down Expand Up @@ -103,14 +103,13 @@ tests:
- --zone-id-filter=/hostedzone/Z00004
- --zone-id-filter=/hostedzone/Z00005


- it: should allow 'extraArgs' to be a slice
set:
extraArgs:
- --extraArgA=valueA
- --extraArgB=valueB
- --extraArgC=valueC-1
- --extraArgC=valueC-2
- --extraArgA=valueA
- --extraArgB=valueB
- --extraArgC=valueC-1
- --extraArgC=valueC-2

asserts:
- equal:
Expand All @@ -129,7 +128,6 @@ tests:
- --extraArgC=valueC-1
- --extraArgC=valueC-2


- it: should allow 'extraArgs' to be a map with its entries potentially being slices (lists) themselves
set:
extraArgs:
Expand All @@ -156,13 +154,33 @@ tests:
- --extraArgC=valueC-1
- --extraArgC=valueC-2

- it: should allow 'extraArgs' to be a map with its entries potentially being boolean
set:
extraArgs:
extraArgC: true
extraArgD: false

asserts:
- equal:
path: spec.template.spec.containers[?(@.name == "external-dns")].args
value:
- --log-level=info
- --log-format=text
- --interval=1m
- --source=service
- --source=ingress
- --policy=upsert-only
- --registry=txt
- --provider=aws
- --extraArgC
- --no-extraArgD

- it: should throw error when txtPrefix and txtSuffix are set
set:
txtPrefix: "test-prefix"
txtSuffix: "test-suffix"
txtPrefix: "test-prefix"
txtSuffix: "test-suffix"
asserts:
- failedTemplate:
- failedTemplate:
errorMessage: "'txtPrefix' and 'txtSuffix' are mutually exclusive"

- it: should configure custom annotation prefix
Expand Down