diff --git a/README.md b/README.md index aeabd428..219eeba4 100644 --- a/README.md +++ b/README.md @@ -676,6 +676,25 @@ $ oc adm policy add-scc-to-user privileged -z awx Again, this is the most relaxed SCC that is provided by OpenShift, so be sure to familiarize yourself with the security concerns that accompany this action. +#### Containers HostAliases Requirements + +Sometimes you might need to use [HostAliases](https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/) in web/task containers. + +| Name | Description | Default | +| ------------ | --------------------- | ------- | +| host_aliases | A list of HostAliases | None | + +Example of customization could be: + +```yaml +--- +spec: + ... + host_aliases: + - ip: + hostnames: + - +``` #### Containers Resource Requirements diff --git a/config/crd/bases/awx.ansible.com_awxs.yaml b/config/crd/bases/awx.ansible.com_awxs.yaml index 53bf64ff..55365f2e 100644 --- a/config/crd/bases/awx.ansible.com_awxs.yaml +++ b/config/crd/bases/awx.ansible.com_awxs.yaml @@ -1345,6 +1345,18 @@ spec: image_pull_secret: # deprecated description: (Deprecated) Image pull secret for app and database containers type: string + host_aliases: + description: HostAliases for app containers + type: array + items: + type: object + properties: + ip: + type: string + hostnames: + type: array + items: + type: string task_resource_requirements: description: Resource requirements for the task container properties: diff --git a/config/manifests/bases/awx-operator.clusterserviceversion.yaml b/config/manifests/bases/awx-operator.clusterserviceversion.yaml index eaeba90c..fc97ec0e 100644 --- a/config/manifests/bases/awx-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/awx-operator.clusterserviceversion.yaml @@ -323,6 +323,11 @@ spec: path: image_pull_secret x-descriptors: - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: HostAliases for app containers + path: host_aliases + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:text - displayName: Web Container Resource Requirements path: web_resource_requirements x-descriptors: diff --git a/roles/installer/defaults/main.yml b/roles/installer/defaults/main.yml index 70f27785..4900d6f9 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -425,3 +425,10 @@ set_self_labels: true # Disable web container's nginx ipv6 listener ipv6_disabled: false + +# Set hostAliases on deployments +# hostAliases: +# - ip: 10.10.0.10 +# hostnames: +# - hostname +host_aliases: '' diff --git a/roles/installer/templates/deployments/task.yaml.j2 b/roles/installer/templates/deployments/task.yaml.j2 index da2bde0c..55326e43 100644 --- a/roles/installer/templates/deployments/task.yaml.j2 +++ b/roles/installer/templates/deployments/task.yaml.j2 @@ -59,6 +59,16 @@ spec: - name: {{ secret }} {% endfor %} {% endif %} +{% if host_aliases is defined and host_aliases | length > 0 %} + hostAliases: +{% for item in host_aliases %} + - ip: {{ item.ip }} + hostnames: +{% for hostname in item.hostnames %} + - {{ hostname }} +{% endfor %} +{% endfor %} +{% endif %} {% if control_plane_priority_class is defined %} priorityClassName: '{{ control_plane_priority_class }}' {% endif %} diff --git a/roles/installer/templates/deployments/web.yaml.j2 b/roles/installer/templates/deployments/web.yaml.j2 index e166c591..41cdbc68 100644 --- a/roles/installer/templates/deployments/web.yaml.j2 +++ b/roles/installer/templates/deployments/web.yaml.j2 @@ -60,6 +60,16 @@ spec: - name: {{ secret }} {% endfor %} {% endif %} +{% if host_aliases is defined and host_aliases | length > 0 %} + hostAliases: +{% for item in host_aliases %} + - ip: {{ item.ip }} + hostnames: +{% for hostname in item.hostnames %} + - {{ hostname }} +{% endfor %} +{% endfor %} +{% endif %} {% if control_plane_priority_class is defined %} priorityClassName: '{{ control_plane_priority_class }}' {% endif %}