Unverified Commit 6a3d3a42 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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: 's avataryuexiao-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 ```
parents 321b36c4 1d479356
...@@ -120,12 +120,6 @@ func ValidateDiscovery(c *kubeadm.NodeConfiguration, fldPath *field.Path) field. ...@@ -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
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment