Set KUBERNETES_NODE_SELECTOR in gitlab-runner-chart by environment variable

Hi, we currently set up the gitlab runner on our GKE cluster. When trying to run the UI integration tests in the pipeline, which will take quite a lot cpu/memory, so I set up a dedicated node and use taint to make the runner only started in the specific node. That is all working but when the runner started and schedule a pod to execute the test because we are using dind service. But it is still started in the other nodes, and that is not what I expected.

The reason is that the created POD will not know the node_selector or node_tolearations, in the document link it is mentioned there, https://docs.gitlab.com/runner/executors/kubernetes.html

But because I am using the gitlab runner chart, so I won’t be able to set up the config.toml directly, I have to set it up them using the environment variable such as KUBERNETES_NODE_SELECTOR or KUBERNETES_NODE_TOLERATIONS. but those values are really a table type (map[string][string]), so how should I pass the string in the gitlab chart as environment variable?

I tried different ways but they are just ignored in the generated config.toml file when I added it in the _env_vars.tpl file such as

  • name: KUBERNETES_NODE_SELECTOR
    value: “sel=my_node”
    or
    value: “[‘abc=my_node’]”