mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #85367 from aramase/node-cidr-followup
[kube controller manager] add comments for compatibility
This commit is contained in:
commit
c3f8d700ac
@ -159,8 +159,12 @@ func startNodeIpamController(ctx ControllerContext) (http.Handler, bool, error)
|
|||||||
|
|
||||||
var nodeCIDRMaskSizeIPv4, nodeCIDRMaskSizeIPv6 int
|
var nodeCIDRMaskSizeIPv4, nodeCIDRMaskSizeIPv6 int
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(kubefeatures.IPv6DualStack) {
|
if utilfeature.DefaultFeatureGate.Enabled(kubefeatures.IPv6DualStack) {
|
||||||
|
// only --node-cidr-mask-size-ipv4 and --node-cidr-mask-size-ipv6 supported with dual stack clusters.
|
||||||
|
// --node-cidr-mask-size flag is incompatible with dual stack clusters.
|
||||||
nodeCIDRMaskSizeIPv4, nodeCIDRMaskSizeIPv6, err = setNodeCIDRMaskSizesDualStack(ctx.ComponentConfig.NodeIPAMController)
|
nodeCIDRMaskSizeIPv4, nodeCIDRMaskSizeIPv6, err = setNodeCIDRMaskSizesDualStack(ctx.ComponentConfig.NodeIPAMController)
|
||||||
} else {
|
} else {
|
||||||
|
// only --node-cidr-mask-size supported with single stack clusters.
|
||||||
|
// --node-cidr-mask-size-ipv4 and --node-cidr-mask-size-ipv6 flags are incompatible with dual stack clusters.
|
||||||
nodeCIDRMaskSizeIPv4, nodeCIDRMaskSizeIPv6, err = setNodeCIDRMaskSizes(ctx.ComponentConfig.NodeIPAMController)
|
nodeCIDRMaskSizeIPv4, nodeCIDRMaskSizeIPv6, err = setNodeCIDRMaskSizes(ctx.ComponentConfig.NodeIPAMController)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,12 +627,13 @@ func setNodeCIDRMaskSizesDualStack(cfg nodeipamconfig.NodeIPAMControllerConfigur
|
|||||||
// getNodeCIDRMaskSizes is a helper function that helps the generate the node cidr mask
|
// getNodeCIDRMaskSizes is a helper function that helps the generate the node cidr mask
|
||||||
// sizes slice based on the cluster cidr slice
|
// sizes slice based on the cluster cidr slice
|
||||||
func getNodeCIDRMaskSizes(clusterCIDRs []*net.IPNet, maskSizeIPv4, maskSizeIPv6 int) []int {
|
func getNodeCIDRMaskSizes(clusterCIDRs []*net.IPNet, maskSizeIPv4, maskSizeIPv6 int) []int {
|
||||||
nodeMaskCIDRs := []int{}
|
nodeMaskCIDRs := make([]int, len(clusterCIDRs))
|
||||||
for _, clusterCIDR := range clusterCIDRs {
|
|
||||||
|
for idx, clusterCIDR := range clusterCIDRs {
|
||||||
if netutils.IsIPv6CIDR(clusterCIDR) {
|
if netutils.IsIPv6CIDR(clusterCIDR) {
|
||||||
nodeMaskCIDRs = append(nodeMaskCIDRs, maskSizeIPv6)
|
nodeMaskCIDRs[idx] = maskSizeIPv6
|
||||||
} else {
|
} else {
|
||||||
nodeMaskCIDRs = append(nodeMaskCIDRs, maskSizeIPv4)
|
nodeMaskCIDRs[idx] = maskSizeIPv4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nodeMaskCIDRs
|
return nodeMaskCIDRs
|
||||||
|
@ -23,9 +23,12 @@ type NodeIPAMControllerConfiguration struct {
|
|||||||
// secondaryServiceCIDR is CIDR Range for Services in cluster. This is used in dual stack clusters. SecondaryServiceCIDR must be of different IP family than ServiceCIDR
|
// secondaryServiceCIDR is CIDR Range for Services in cluster. This is used in dual stack clusters. SecondaryServiceCIDR must be of different IP family than ServiceCIDR
|
||||||
SecondaryServiceCIDR string
|
SecondaryServiceCIDR string
|
||||||
// NodeCIDRMaskSize is the mask size for node cidr in single-stack cluster.
|
// NodeCIDRMaskSize is the mask size for node cidr in single-stack cluster.
|
||||||
|
// This can be used only with single stack clusters and is incompatible with dual stack clusters.
|
||||||
NodeCIDRMaskSize int32
|
NodeCIDRMaskSize int32
|
||||||
// NodeCIDRMaskSizeIPv4 is the mask size for node cidr in dual-stack cluster.
|
// NodeCIDRMaskSizeIPv4 is the mask size for IPv4 node cidr in dual-stack cluster.
|
||||||
|
// This can be used only with dual stack clusters and is incompatible with single stack clusters.
|
||||||
NodeCIDRMaskSizeIPv4 int32
|
NodeCIDRMaskSizeIPv4 int32
|
||||||
// NodeCIDRMaskSizeIPv6 is the mask size for node cidr in dual-stack cluster.
|
// NodeCIDRMaskSizeIPv6 is the mask size for IPv6 node cidr in dual-stack cluster.
|
||||||
|
// This can be used only with dual stack clusters and is incompatible with single stack clusters.
|
||||||
NodeCIDRMaskSizeIPv6 int32
|
NodeCIDRMaskSizeIPv6 int32
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user