fix: create role, rolebinding in jobNamespace if variable is not empty

What does this MR do?

Creates role, rolebinding in seprated job namespace if values is specified.

Why was this MR needed?

This chart supports specifying values.namespace for runner resources and values.jobNamespace for job resources to separate deployment from running job pods by namespace.

However, to create pods/service/secrets/etc. in separate namespace gitlab-runner need to have SA created in namespace with deployment, but role+rolebinding in that separate namespace.

Right now if you specify non-empty values.jobNamespace, enable rbac and add some rules - current latest version of chart won't have permissions to create resources in separate namespace due to SA/role/rolebinding being created in values.namespace or Release.Namespace, not values.jobNamespace.

This MR fixes this by creating role/rolebinding in correct namespace (in namespace where runner will create jobs) if jobNamespace is not empty.

What's the best way to test this MR?

What are the relevant issue numbers?

Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading