mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Merge pull request #98796 from pacoxu/kubeadm/dual-stack-1
kubeadm: improve error message about node subnet size validation
This commit is contained in:
commit
25d5d657c7
@ -397,7 +397,7 @@ func ValidateIPNetFromString(subnetStr string, minAddrs int64, isDualStack bool,
|
||||
for _, s := range subnets {
|
||||
numAddresses := utilnet.RangeSize(s)
|
||||
if numAddresses < minAddrs {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, s.String(), "subnet is too small"))
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, s.String(), fmt.Sprintf("subnet with %d address(es) is too small, the minimum is %d", numAddresses, minAddrs)))
|
||||
}
|
||||
}
|
||||
return allErrs
|
||||
@ -440,9 +440,9 @@ func ValidatePodSubnetNodeMask(subnetStr string, c *kubeadm.ClusterConfiguration
|
||||
// the pod subnet mask needs to allow one or multiple node-masks
|
||||
// i.e. if it has a /24 the node mask must be between 24 and 32 for ipv4
|
||||
if maskSize > nodeMask {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, podSubnet.String(), "pod subnet size is smaller than the node subnet size"))
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, podSubnet.String(), fmt.Sprintf("the size of pod subnet with mask %d is smaller than the size of node subnet with mask %d", maskSize, nodeMask)))
|
||||
} else if (nodeMask - maskSize) > constants.PodSubnetNodeMaskMaxDiff {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, podSubnet.String(), fmt.Sprintf("pod subnet mask and node-mask difference can not be greater than %d", constants.PodSubnetNodeMaskMaxDiff)))
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, podSubnet.String(), fmt.Sprintf("pod subnet mask (%d) and node-mask (%d) difference is greater than %d", maskSize, nodeMask, constants.PodSubnetNodeMaskMaxDiff)))
|
||||
}
|
||||
}
|
||||
return allErrs
|
||||
|
Loading…
Reference in New Issue
Block a user