Skip to content

Invalid yaml when creating service account with no annotations

What does this MR do?

Fixes a case where the chart may have generated invalid YAML.

Why was this MR needed?

If .Values.rbac.create is true, but no .Values.rbac.serviceAccountAnnotations exist, the generated service account yaml will be invalid.

What's the best way to test this MR?

Compare the templated chart with and without setting values for .Values.rbac.serviceAccountAnnotations. Notice that without this fix, it's easy to create a service account that looks like this:

# Source: gitlab-runner/templates/service-account.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  annotations:           # <<< metadata.annotations has no value, not `null`, not `{}`, just nothing.
  name: gitlab-runner
...

What are the relevant issue numbers?

Didn't create one.

Merge request reports