Add support for user-defined initContainers
In my environment, we have a mutating webhook which modifies the gitlab agent deployment in the cluster to retrieve the agent token from Azure Keyvault and place it in the environment.
For this to work, we could not use the helm chart directly, and instead used helm template
to generate the kubernetes manifests to deploy the agent, then modified them to suit our needs. We then created a container image which runs as an initContainer
, reads the secret out of the environment and places it in an emptyDir
volume shared with the gitlab-agent container. That emptyDir
volume is mounted in the gitlab-agent container at the same path where the agent expects the token file to be.
This works well in our cluster; however, we now want to adopt the helm chart which currently doesn't support any initContainers
.
This MR provides a method to add the custom initContainer we need.