Skip to content

Commit f8057a7

Browse files
feat(chart): allow to run tpl on ServiceAccount annotations (#4958)
* Allow run tpl on serviceaccount annotations * updated the CHANGELOG * iterate over kv and tpl and update docs * fix multiline-string docs * add CI values * add more CI values * fix ci values
1 parent 909519f commit f8057a7

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

charts/external-dns/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2727

2828
- Fixed automatic addition of pod selector labels to `affinity` and `topologySpreadConstraints` if not defined. _@pvickery-ParamountCommerce_
2929

30+
### Changed
31+
32+
- 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_
33+
3034
## [v1.15.0] - 2023-09-10
3135

3236
### Changed

charts/external-dns/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ If `namespaced` is set to `true`, please ensure that `sources` my only contains
153153
| service.ipFamilies | list | `[]` | Service IP families. |
154154
| service.ipFamilyPolicy | string | `nil` | Service IP family policy. |
155155
| service.port | int | `7979` | Service HTTP port. |
156-
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account. |
156+
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account. Templates are allowed in both the key and the value. Example: `example.com/annotation/{{ .Values.nameOverride }}: {{ .Values.nameOverride }}` |
157157
| 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`. |
158158
| serviceAccount.create | bool | `true` | If `true`, create a new `ServiceAccount`. |
159159
| serviceAccount.labels | object | `{}` | Labels to add to the service account. |

charts/external-dns/ci/ci-values.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,9 @@ topologySpreadConstraints:
3434
- maxSkew: 1
3535
topologyKey: "topology.kubernetes.io/zone"
3636
whenUnsatisfiable: "ScheduleAnyway"
37+
38+
serviceAccount:
39+
annotations:
40+
notTemplated/version: "v1.2.3"
41+
justValueTemplated/version: "{{ .Chart.Version }}"
42+
"{{ .Chart.Name }}/chart": "{{ .Chart.Version }}"

charts/external-dns/templates/serviceaccount.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ metadata:
1111
{{- end }}
1212
{{- with .Values.serviceAccount.annotations }}
1313
annotations:
14-
{{- toYaml . | nindent 4 }}
14+
{{- range $k, $v := . }}
15+
{{- printf "%s: %s" (tpl $k $) (tpl $v $) | nindent 4 }}
16+
{{- end }}
1517
{{- end }}
1618
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
1719
{{- end }}

charts/external-dns/values.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ serviceAccount:
3131
create: true
3232
# -- Labels to add to the service account.
3333
labels: {}
34-
# -- Annotations to add to the service account.
34+
# -- Annotations to add to the service account. Templates are allowed in both the key and the value. Example: `example.com/annotation/{{ .Values.nameOverride }}: {{ .Values.nameOverride }}`
3535
annotations: {}
3636
# -- (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.
3737
name:

0 commit comments

Comments
 (0)