Skip to content

Template values for rbac.serviceAccountAnnotations

Thorsten Huhn requested to merge thuhn/gitlab-runner:tpl-sa-annotations into main

What does this MR do?

This MR applies the tpl function on the value of any serviceAccount annotation.

Why was this MR needed?

I want to be able to refer to other values when specifying an annotation value like this:

  rbac:
    create: true
    serviceAccountAnnotations:
      eks.amazonaws.com/role-arn: "arn:aws:iam::{{ .Values.global.accountId }}:role/{{ .Values.global.iamRoleName }}"

By using the tpl function on the value, any variable reference inside the value string will resolve to its underlying value.

What's the best way to test this MR?

When running the following command in the charts directory,

helm template test . --set rbac.create=true --set rbac.serviceAccountAnnotations.foo='\{\{ .Values.imagePullPolicy \}\}' | yq 'select(.kind == "ServiceAccount")'

the output should give a real value (default "IfNotPresent" from values.yaml) for annotation foo instead of the variable reference {{ .Values.imagePullPolicy }}

What are the relevant issue numbers?

see issue #467 (closed)

Edited by Thorsten Huhn

Merge request reports