Skip to content

Commit e001276

Browse files
authored
Merge pull request kubernetes#74836 from yujuhong/update-win-cni-config
GCE/Windows: exclude gateways from the IPAM subnet
2 parents 3bb22ed + 1f86bce commit e001276

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cluster/gce/windows/k8s-node-setup.psm1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,9 +819,15 @@ function Configure-CniNetworking {
819819
Log-Output ("using mgmt IP ${mgmt_ip} and mgmt subnet ${mgmt_subnet} for " +
820820
"CNI config")
821821

822+
# We reserve .1 and .2 for gateways. Start the CIDR range from ".3" so that
823+
# IPAM does not allocate those IPs to pods.
824+
$cidr_range_start = `
825+
${env:POD_CIDR}.substring(0, ${env:POD_CIDR}.lastIndexOf('.')) + '.3'
826+
822827
# Explanation of the CNI config values:
823828
# CLUSTER_CIDR: the cluster CIDR from which pod CIDRs are allocated.
824829
# POD_CIDR: the pod CIDR assigned to this node.
830+
# CIDR_RANGE_START: start of the pod CIDR range.
825831
# MGMT_SUBNET: the subnet on which the Windows pods + kubelet will
826832
# communicate with the rest of the cluster without NAT (i.e. the subnet
827833
# that VM internal IPs are allocated from).
@@ -841,7 +847,8 @@ function Configure-CniNetworking {
841847
},
842848
"ipam": {
843849
"type": "host-local",
844-
"subnet": "POD_CIDR"
850+
"subnet": "POD_CIDR",
851+
"rangeStart": "CIDR_RANGE_START"
845852
},
846853
"dns": {
847854
"Nameservers": [
@@ -881,6 +888,7 @@ function Configure-CniNetworking {
881888
}
882889
]
883890
}'.replace('POD_CIDR', ${env:POD_CIDR}).`
891+
replace('CIDR_RANGE_START', ${cidr_range_start}).`
884892
replace('DNS_SERVER_IP', ${kube_env}['DNS_SERVER_IP']).`
885893
replace('DNS_DOMAIN', ${kube_env}['DNS_DOMAIN']).`
886894
replace('MGMT_IP', ${mgmt_ip}).`

0 commit comments

Comments
 (0)