Skip to content

Allow pod security context to be unset

What does this MR do?

Allows helm install gitlab-runner . --set podSecurityContext=null to not set the pod security context if the user desires not having one; the values have not been changed, so this will still default to enabling it with the default values.yaml

Why was this MR needed?

In our environment, we need to have podSecurityContext.runAsUser and podSecurityContext.fsGroup both unset, but I was unable to force them to be removed from the deployment without using kustomize, so I hoped to support using --set podSecurityContext=null from the command line to override the defaults, but without the changes introduced by this MR, it's not possible.

What's the best way to test this MR?

In main: helm template gitlab-runner . --set podSecurityContext=null, observe that the pod security context fields are still set. Checkout this branch and run the same command, observe that the pod security context field is no longer present. In this branch again, run helm template gitlab-runner . without any --set flags, and observe that the default values are respected and the pod security context field is still set.

What are the relevant issue numbers?

Merge request reports