fix: create role, rolebinding in jobNamespace if variable is not empty
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
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.