diff --git a/charts/external-dns/CHANGELOG.md b/charts/external-dns/CHANGELOG.md index 7ab97520e3..5743f511b6 100644 --- a/charts/external-dns/CHANGELOG.md +++ b/charts/external-dns/CHANGELOG.md @@ -29,7 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Allow templatizing `serviceaccount.annotations` in values, by rendering them using `tpl` built-in function: [#4958](https://github.com/kubernetes-sigs/external-dns/pull/4958) @fcrespofastly +- Allow templating `serviceaccount.annotations` keys and values, by rendering them using the `tpl` built-in function. [#4958](https://github.com/kubernetes-sigs/external-dns/pull/4958) _@fcrespofastly_ ## [v1.15.0] - 2023-09-10 diff --git a/charts/external-dns/README.md b/charts/external-dns/README.md index d88545c383..1bdcc300e7 100644 --- a/charts/external-dns/README.md +++ b/charts/external-dns/README.md @@ -153,7 +153,7 @@ If `namespaced` is set to `true`, please ensure that `sources` my only contains | service.ipFamilies | list | `[]` | Service IP families. | | service.ipFamilyPolicy | string | `nil` | Service IP family policy. | | service.port | int | `7979` | Service HTTP port. | -| serviceAccount.annotations | object | `{}` | Annotations to add to the service account. | +| serviceAccount.annotations | object | `{}` | Annotations to add to the service account. Templates are allowed here. Example: annotations: example.com/annotation: {{ .Values.nameOverride }} | | serviceAccount.automountServiceAccountToken | string | `nil` | Set this to `false` to [opt out of API credential automounting](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#opt-out-of-api-credential-automounting) for the `ServiceAccount`. | | serviceAccount.create | bool | `true` | If `true`, create a new `ServiceAccount`. | | serviceAccount.labels | object | `{}` | Labels to add to the service account. | diff --git a/charts/external-dns/templates/serviceaccount.yaml b/charts/external-dns/templates/serviceaccount.yaml index f427917f68..37eebb41ac 100644 --- a/charts/external-dns/templates/serviceaccount.yaml +++ b/charts/external-dns/templates/serviceaccount.yaml @@ -11,7 +11,9 @@ metadata: {{- end }} {{- with .Values.serviceAccount.annotations }} annotations: - {{- tpl (toYaml .) $ | nindent 4 }} + {{- range $k, $v := . }} + {{- printf "%s: %s" (tpl $k $) (tpl $v $) | nindent 4 }} + {{- end }} {{- end }} automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} {{- end }} diff --git a/charts/external-dns/values.yaml b/charts/external-dns/values.yaml index dc12cdd65b..6fd488ba35 100644 --- a/charts/external-dns/values.yaml +++ b/charts/external-dns/values.yaml @@ -31,7 +31,9 @@ serviceAccount: create: true # -- Labels to add to the service account. labels: {} - # -- Annotations to add to the service account. + # -- Annotations to add to the service account. Templates are allowed here. Example: + # annotations: + # example.com/annotation: {{ .Values.nameOverride }} annotations: {} # -- (string) If this is set and `serviceAccount.create` is `true` this will be used for the created `ServiceAccount` name, if set and `serviceAccount.create` is `false` then this will define an existing `ServiceAccount` to use. name: