Skip to content

Allow to set extra hosts on kubernetes executor

What does this MR do?

It adds the possibility to define additional hosts in containers of the Kubernetes executor, similar to the extra_hosts setting in the docker executor.

This is a MR based on !1570 (closed) and adds:

  • the rebase on master
  • enhancement to merge the generated services HostAliases for IP 127.0.0.1 with the configured extra_hosts.
  • Multiple host for the same IP are supported and can be provided by defining multiple host entries for the same IP and each entry accepts a list of hosts as a space separated string.

Why was this MR needed?

Sometimes projects make use of hostnames to differentiate between different configurations, such as a webserver serving different content for different domains. As of right now, it is not possible to have additional host entries in /etc/hosts, as that file is managed/mounted by Kubernetes and not possible to edit during runtime.

This change will make it easier to migrate workloads currently using the docker executor to the kubernetes executor.

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

  • Should this be called extra_hosts to keep it the same as in docker?
  • Is it preferable to keep the same syntax as in docker?

answered in !1570 (comment 346576316)

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

Closes #2818 (closed)

Edited by Horatiu Eugen Vlad

Merge request reports