From cd459a04f3dce155773ca285021cc2b68feefdfe Mon Sep 17 00:00:00 2001
From: Alexander <payback159@gmail.com>
Date: Mon, 13 May 2024 12:25:09 +0200
Subject: [PATCH] Revert OCCM standard dnsPolicy to ClusterFirst and make
 dnsPolicy configurable to support 10618 (#11168)

---
 .../external_cloud_controller/openstack/defaults/main.yml     | 1 +
 .../external-openstack-cloud-controller-manager-ds.yml.j2     | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/roles/kubernetes-apps/external_cloud_controller/openstack/defaults/main.yml b/roles/kubernetes-apps/external_cloud_controller/openstack/defaults/main.yml
index 3affb19fc..05a3a882c 100644
--- a/roles/kubernetes-apps/external_cloud_controller/openstack/defaults/main.yml
+++ b/roles/kubernetes-apps/external_cloud_controller/openstack/defaults/main.yml
@@ -23,3 +23,4 @@ external_openstack_cacert: "{{ lookup('env', 'OS_CACERT') }}"
 external_openstack_cloud_controller_extra_args: {}
 external_openstack_cloud_controller_image_tag: "v1.28.2"
 external_openstack_cloud_controller_bind_address: 127.0.0.1
+external_openstack_cloud_controller_dns_policy: ClusterFirst
diff --git a/roles/kubernetes-apps/external_cloud_controller/openstack/templates/external-openstack-cloud-controller-manager-ds.yml.j2 b/roles/kubernetes-apps/external_cloud_controller/openstack/templates/external-openstack-cloud-controller-manager-ds.yml.j2
index d03be0bac..85df9975e 100644
--- a/roles/kubernetes-apps/external_cloud_controller/openstack/templates/external-openstack-cloud-controller-manager-ds.yml.j2
+++ b/roles/kubernetes-apps/external_cloud_controller/openstack/templates/external-openstack-cloud-controller-manager-ds.yml.j2
@@ -81,7 +81,9 @@ spec:
             - name: CLOUD_CONFIG
               value: /etc/config/cloud.conf
       hostNetwork: true
-      dnsPolicy: ClusterFirstWithHostNet
+{% if external_openstack_cloud_controller_dns_policy is defined %}
+      dnsPolicy: {{ external_openstack_cloud_controller_dns_policy }}
+{% endif %}
       volumes:
 {% if kubelet_flexvolumes_plugins_dir is defined %}
       - name: flexvolume-dir
-- 
GitLab