diff --git a/charts/external-dns/README.md b/charts/external-dns/README.md index 0bbae92591..f5ec38d04e 100644 --- a/charts/external-dns/README.md +++ b/charts/external-dns/README.md @@ -187,6 +187,34 @@ If `namespaced` is set to `true`, please ensure that `sources` my only contains | txtPrefix | string | `nil` | Specify a prefix for the domain names of TXT records created for the `txt` registry. Mutually exclusive with `txtSuffix`. | | txtSuffix | string | `nil` | Specify a suffix for the domain names of TXT records created for the `txt` registry. Mutually exclusive with `txtPrefix`. | +## Usage + +### Configure `extraArgs` + +An array or map can be used, with maps allowing for value overrides; maps also support slice values to use the same arg multiple times. + +Example array: + +```yaml +extraArgs: + - --zone-id-filter=/hostedzone/Z00001 + - --zone-id-filter=/hostedzone/Z00002 + - --zone-id-filter=/hostedzone/Z00003 +``` + +Eample map: (supported values for map are strings, list of strings, and boolean) + +```yaml +extraArgs: + extraArgA: valueA # results: "--extraArgA=valueA" + extraArgB: # rendered: "--extraArgB=valueB-1 --extraArgB=valueB-2" + - valueB-1 + - valueB-2 + extraArgC: true # results: "--extraArgC" + extraArgD: false # results: "--no-extraArgD" + extraArgE: # results: "--extraArgE" +``` + ---------------------------------------------- Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs/). diff --git a/charts/external-dns/README.md.gotmpl b/charts/external-dns/README.md.gotmpl index fc4ada14be..8f7021e80a 100644 --- a/charts/external-dns/README.md.gotmpl +++ b/charts/external-dns/README.md.gotmpl @@ -89,6 +89,34 @@ If `namespaced` is set to `true`, please ensure that `sources` my only contains {{ template "chart.valuesSection" . }} +## Usage + +### Configure `extraArgs` + +An array or map can be used, with maps allowing for value overrides; maps also support slice values to use the same arg multiple times. + +Example array: + +```yaml +extraArgs: + - --zone-id-filter=/hostedzone/Z00001 + - --zone-id-filter=/hostedzone/Z00002 + - --zone-id-filter=/hostedzone/Z00003 +``` + +Eample map: (supported values for map are strings, list of strings, and boolean) + +```yaml +extraArgs: + extraArgA: valueA # results: "--extraArgA=valueA" + extraArgB: # rendered: "--extraArgB=valueB-1 --extraArgB=valueB-2" + - valueB-1 + - valueB-2 + extraArgC: true # results: "--extraArgC" + extraArgD: false # results: "--no-extraArgD" + extraArgE: # results: "--extraArgE" +``` + ---------------------------------------------- Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs/). diff --git a/charts/external-dns/templates/deployment.yaml b/charts/external-dns/templates/deployment.yaml index b213f754fd..a8877437a9 100644 --- a/charts/external-dns/templates/deployment.yaml +++ b/charts/external-dns/templates/deployment.yaml @@ -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 }} diff --git a/charts/external-dns/tests/deployment-flags_test.yaml b/charts/external-dns/tests/deployment-flags_test.yaml index 5ea1115304..f9b916bd6a 100644 --- a/charts/external-dns/tests/deployment-flags_test.yaml +++ b/charts/external-dns/tests/deployment-flags_test.yaml @@ -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 @@ -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 @@ -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 @@ -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: @@ -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: @@ -156,13 +154,37 @@ tests: - --extraArgC=valueC-1 - --extraArgC=valueC-2 + - it: should allow 'extraArgs' to be a map with its entries potentially being boolean + set: + extraArgs: + extraArgA: + no-extraArgB: + 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 + - --extraArgA + - --extraArgC + - --no-extraArgD + - --no-extraArgB - 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