mirror of https://github.com/k3s-io/k3s
Merge pull request #55581 from yuexiao-wang/remove-redundant
Automatic merge from submit-queue (batch tested with PRs 54647, 55581). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. remove redundant code in ValidateDiscovery Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn> **What this PR does / why we need it**: Remove redundant code in ValidateDiscovery. It deplicated check for DiscoveryToken and DiscoveryFile as follows: func ValidateDiscovery(c *kubeadm.NodeConfiguration, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} if len(c.DiscoveryToken) != 0 { allErrs = append(allErrs, ValidateToken(c.DiscoveryToken, fldPath)...) } if len(c.DiscoveryFile) != 0 { allErrs = append(allErrs, ValidateDiscoveryFile(c.DiscoveryFile, fldPath)...) } allErrs = append(allErrs, ValidateArgSelection(c, fldPath)...) allErrs = append(allErrs, ValidateToken(c.TLSBootstrapToken, fldPath)...) allErrs = append(allErrs, ValidateJoinDiscoveryTokenAPIServer(c, fldPath)...) if len(c.DiscoveryToken) != 0 { allErrs = append(allErrs, ValidateToken(c.DiscoveryToken, fldPath)...) } if len(c.DiscoveryFile) != 0 { allErrs = append(allErrs, ValidateDiscoveryFile(c.DiscoveryFile, fldPath)...) } return allErrs } **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: cc @luxas **Release note**: ```release-note NONE ```pull/6/head
commit
6a3d3a42db
|
@ -120,12 +120,6 @@ func ValidateDiscovery(c *kubeadm.NodeConfiguration, fldPath *field.Path) field.
|
||||||
allErrs = append(allErrs, ValidateToken(c.TLSBootstrapToken, fldPath)...)
|
allErrs = append(allErrs, ValidateToken(c.TLSBootstrapToken, fldPath)...)
|
||||||
allErrs = append(allErrs, ValidateJoinDiscoveryTokenAPIServer(c, fldPath)...)
|
allErrs = append(allErrs, ValidateJoinDiscoveryTokenAPIServer(c, fldPath)...)
|
||||||
|
|
||||||
if len(c.DiscoveryToken) != 0 {
|
|
||||||
allErrs = append(allErrs, ValidateToken(c.DiscoveryToken, fldPath)...)
|
|
||||||
}
|
|
||||||
if len(c.DiscoveryFile) != 0 {
|
|
||||||
allErrs = append(allErrs, ValidateDiscoveryFile(c.DiscoveryFile, fldPath)...)
|
|
||||||
}
|
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue