Skip to content

Support Pod DNS Config and Policy for Kubernetes executor

What does this MR do?

Adds support for Pod DNS Config.

Why was this MR needed?

#6562 (closed)

What's the best way to test this MR?

There are 2 new tests covering the parsing of the new options:

go test -count=1 -timeout=45s -v -run TestSetupBuildPod ./executors/kubernetes

Manual test

  1. Register a kubernetes runner and then merge the following with the executor configuration (note that we disable the default DNS policy so that we can add our own config):

    [[runners]]
      name = "kubernetes-runner"
      url = "https://gitlab.com/"
      executor = "kubernetes"
      [runners.kubernetes]
        dns_policy = "none"
        [runners.kubernetes.dns_config]
          nameservers = ["192.168.6.254"]
          options = [{ name = "single-request-reopen" }]
  2. Start the runner.

  3. Create a .gitlab-ci.yml file containing the following:

    start_evaluation:
      script:
        - cat /etc/resolv.conf
      tags: [kubernetes]
  4. The output of the CI job should be the following:

    image

Without this change, the output would be:

image

What are the relevant issue numbers?

Closes #6562 (closed)

Merge request reports