From 0553814b4f575b0ef810c7e6b16e7f7612e0e0c4 Mon Sep 17 00:00:00 2001 From: Maxim Pogozhiy Date: Fri, 4 Sep 2020 21:53:41 +1000 Subject: [PATCH] Add selectable dns policy for kube-router (#6586) --- .../sample/group_vars/k8s-cluster/k8s-net-kube-router.yml | 3 +++ roles/network_plugin/kube-router/defaults/main.yml | 3 +++ roles/network_plugin/kube-router/templates/kube-router.yml.j2 | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/inventory/sample/group_vars/k8s-cluster/k8s-net-kube-router.yml b/inventory/sample/group_vars/k8s-cluster/k8s-net-kube-router.yml index c50132854..383280187 100644 --- a/inventory/sample/group_vars/k8s-cluster/k8s-net-kube-router.yml +++ b/inventory/sample/group_vars/k8s-cluster/k8s-net-kube-router.yml @@ -39,6 +39,9 @@ # https://github.com/cloudnativelabs/kube-router/blob/master/docs/user-guide.md#hairpin-mode # kube_router_support_hairpin_mode: false +# Select DNS Policy ClusterFirstWithHostNet, ClusterFirst, etc. +# kube_router_dns_policy: ClusterFirstWithHostNet + # Array of annotations for master # kube_router_annotations_master: [] diff --git a/roles/network_plugin/kube-router/defaults/main.yml b/roles/network_plugin/kube-router/defaults/main.yml index a1e68feea..441d80842 100644 --- a/roles/network_plugin/kube-router/defaults/main.yml +++ b/roles/network_plugin/kube-router/defaults/main.yml @@ -38,6 +38,9 @@ kube_router_peer_router_ports: ~ # https://github.com/cloudnativelabs/kube-router/blob/master/docs/user-guide.md#hairpin-mode kube_router_support_hairpin_mode: false +# Select DNS Policy ClusterFirstWithHostNet, ClusterFirst, etc. +kube_router_dns_policy: ClusterFirstWithHostNet + # Adds annotations to kubernetes nodes for advanced configuration of BGP Peers. # https://github.com/cloudnativelabs/kube-router/blob/master/docs/bgp.md diff --git a/roles/network_plugin/kube-router/templates/kube-router.yml.j2 b/roles/network_plugin/kube-router/templates/kube-router.yml.j2 index bce36cfbd..db6c31bed 100644 --- a/roles/network_plugin/kube-router/templates/kube-router.yml.j2 +++ b/roles/network_plugin/kube-router/templates/kube-router.yml.j2 @@ -109,7 +109,7 @@ spec: protocol: TCP {% endif %} hostNetwork: true - dnsPolicy: ClusterFirstWithHostNet + dnsPolicy: {{ kube_router_dns_policy }} {% if kube_router_enable_dsr %} hostIPC: true hostPID: true