Skip to content

Commit 8e83ad6

Browse files
authored
Merge pull request #17505 from hakman/azure-test
chore: Use constants for default network CIDRs
2 parents 1a0d074 + 2663df7 commit 8e83ad6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

upup/pkg/fi/cloudup/defaults.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ import (
3333
kopsversion "k8s.io/kops"
3434
)
3535

36+
const (
37+
defaultAWSNetworkCIDR = "172.20.0.0/16"
38+
defaultAzureNetworkCIDR = "10.0.0.0/16"
39+
defaultNonMasqueradeCIDR = "100.64.0.0/10"
40+
)
41+
3642
// PerformAssignments populates values that are required and immutable
3743
// For example, it assigns stable Keys to InstanceGroups & Masters, and
3844
// it assigns CIDRs to subnets
@@ -85,7 +91,7 @@ func PerformAssignments(c *kops.Cluster, vfsContext *vfs.VFSContext, cloud fi.Cl
8591
}
8692
} else {
8793
// TODO: Choose non-overlapping networking CIDRs for VPCs, using vpcInfo
88-
c.Spec.Networking.NetworkCIDR = "172.20.0.0/16"
94+
c.Spec.Networking.NetworkCIDR = defaultAWSNetworkCIDR
8995
}
9096

9197
// Amazon VPC CNI uses the same network
@@ -111,12 +117,12 @@ func PerformAssignments(c *kops.Cluster, vfsContext *vfs.VFSContext, cloud fi.Cl
111117
return fmt.Errorf("unable to infer NetworkCIDR from Network ID, please specify --network-cidr")
112118
}
113119
} else {
114-
c.Spec.Networking.NetworkCIDR = "10.0.0.0/16"
120+
c.Spec.Networking.NetworkCIDR = defaultAzureNetworkCIDR
115121
}
116122
}
117123

118124
if c.Spec.Networking.NonMasqueradeCIDR == "" {
119-
c.Spec.Networking.NonMasqueradeCIDR = "100.64.0.0/10"
125+
c.Spec.Networking.NonMasqueradeCIDR = defaultNonMasqueradeCIDR
120126
}
121127

122128
// TODO: Unclear this should be here - it isn't too hard to change

0 commit comments

Comments
 (0)