Say I want to map git branches to k8s namespaces, like this:
ERROR Rendering Code Block
for my Gitlab CI pipeline to deploy helm charts to the right namespaces,
based on the branch.
Where do I put this mapping?
I tried with a bash If in the CI script and with Gitlab CI variables.
Both worked but both were kludges.
I was told to use something like values_prd.yaml
and values_dev.yaml
(I belive they meant values_master.yaml
and values_devel.yaml
)
but that makes no sense to me right now,
as I don't belive you can't tell helm what namespace to install charts to by passing values
(can you?).
TLDR: How/Where do I map branches to namespaces?
Edit: Here's my .gitlab-ci.yml
.
We're missing some context here. Assuming you're running helm from your gitab-ci.yml: you may be able to have helm loading its values file based on your environment: eg values\_${CI\_COMMIT\_REF\_NAME}.yml
(and then, yes, _master or _devel, instead of _prd and _dev ... unless you rename your branches otherwise). Beyond GitLab CI specifics, for such a task, note that ArgoCD could be a good candidate - and won't lock you with some git vendor.
Added my .gitlab-ci.yml
.
It's for a "toy" project for learning.