Skip to content

Add DNSPolicy to Kubernetes executor config struct

What does this MR do?

Adds a config flag for the Kubernetes executor to specify a DNSPolicy that should be used for the build pod.

Why was this MR needed?

When running an Alpine-based image (ie., docker:dind), ClusterFirst DNS breaks presumably because of ndots in the /etc/resolv.conf, which can be fixed by setting dnsPolicy: Default in the PodSpec.

Previously encountered error sample:

Running with gitlab-ci-multi-runner 9.2.1 (f018144)
  on k8s-orch-priv (0dcbec7a)
Using Kubernetes namespace: gitlab
Using Kubernetes executor with image docker:git ...
Waiting for pod gitlab/runner-0dcbec7a-project-24-concurrent-0f61bt to be running, status is Pending
Waiting for pod gitlab/runner-0dcbec7a-project-24-concurrent-0f61bt to be running, status is Pending
Waiting for pod gitlab/runner-0dcbec7a-project-24-concurrent-0f61bt to be running, status is Pending
Waiting for pod gitlab/runner-0dcbec7a-project-24-concurrent-0f61bt to be running, status is Pending
Running on runner-0dcbec7a-project-24-concurrent-0f61bt via gitlab-runner-1789393614-909hc...
Cloning repository...
Cloning into '/persist/build/sjohnson/epitropos'...
fatal: unable to access 'https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@glow.dev.maio.me/sjohnson/epitropos.git/': Couldn't resolve host 'glow.dev.maio.me'
ERROR: Job failed: error executing remote command: command terminated with non-zero exit code: Error executing in Docker Container: 1

Are there points in the code the reviewer needs to double check?

I don't believe so.

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Tests
    • Added for this feature/bug
    • All builds are passing
  • Branch has no merge conflicts with master (if you do - rebase it please)

What are the relevant issue numbers?

Possibly related to #2577.

Edited by username-removed-558102

Merge request reports