diff --git a/roles/kubernetes/master/defaults/main/kube-proxy.yml b/roles/kubernetes/master/defaults/main/kube-proxy.yml index d5bcdb16f..0452b2277 100644 --- a/roles/kubernetes/master/defaults/main/kube-proxy.yml +++ b/roles/kubernetes/master/defaults/main/kube-proxy.yml @@ -69,7 +69,7 @@ kube_proxy_min_sync_period: 0s kube_proxy_sync_period: 30s # A comma-separated list of CIDR's which the ipvs proxier should not touch when cleaning up IPVS rules. -kube_proxy_exclude_cidrs: 'null' +kube_proxy_exclude_cidrs: [] # The ipvs scheduler type when proxy mode is ipvs # rr: round-robin diff --git a/roles/kubernetes/master/templates/kubeadm-config.v1alpha3.yaml.j2 b/roles/kubernetes/master/templates/kubeadm-config.v1alpha3.yaml.j2 index 691834fea..4658537f6 100644 --- a/roles/kubernetes/master/templates/kubeadm-config.v1alpha3.yaml.j2 +++ b/roles/kubernetes/master/templates/kubeadm-config.v1alpha3.yaml.j2 @@ -277,7 +277,7 @@ iptables: minSyncPeriod: {{ kube_proxy_min_sync_period }} syncPeriod: {{ kube_proxy_sync_period }} ipvs: - excludeCIDRs: {{ kube_proxy_exclude_cidrs }} + excludeCIDRs: {{ "[]" if kube_proxy_exclude_cidrs is not defined or kube_proxy_exclude_cidrs == "null" or kube_proxy_exclude_cidrs | length == 0 else (kube_proxy_exclude_cidrs if kube_proxy_exclude_cidrs[0] == '[' else ("[" + kube_proxy_exclude_cidrs + "]" if (kube_proxy_exclude_cidrs[0] | length) == 1 else "[" + kube_proxy_exclude_cidrs | join(",") + "]")) }} minSyncPeriod: {{ kube_proxy_min_sync_period }} scheduler: {{ kube_proxy_scheduler }} syncPeriod: {{ kube_proxy_sync_period }} diff --git a/roles/kubernetes/master/templates/kubeadm-config.v1beta1.yaml.j2 b/roles/kubernetes/master/templates/kubeadm-config.v1beta1.yaml.j2 index 619ee829b..87c4f0b4f 100644 --- a/roles/kubernetes/master/templates/kubeadm-config.v1beta1.yaml.j2 +++ b/roles/kubernetes/master/templates/kubeadm-config.v1beta1.yaml.j2 @@ -326,7 +326,7 @@ iptables: minSyncPeriod: {{ kube_proxy_min_sync_period }} syncPeriod: {{ kube_proxy_sync_period }} ipvs: - excludeCIDRs: {{ kube_proxy_exclude_cidrs }} + excludeCIDRs: {{ "[]" if kube_proxy_exclude_cidrs is not defined or kube_proxy_exclude_cidrs == "null" or kube_proxy_exclude_cidrs | length == 0 else (kube_proxy_exclude_cidrs if kube_proxy_exclude_cidrs[0] == '[' else ("[" + kube_proxy_exclude_cidrs + "]" if (kube_proxy_exclude_cidrs[0] | length) == 1 else "[" + kube_proxy_exclude_cidrs | join(",") + "]")) }} minSyncPeriod: {{ kube_proxy_min_sync_period }} scheduler: {{ kube_proxy_scheduler }} syncPeriod: {{ kube_proxy_sync_period }}