Skip to content

Commit db4134d

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request kubernetes#56069 from xiangpengzhao/change-kubeadm-validation
Automatic merge from submit-queue (batch tested with PRs 55839, 54495, 55884, 55983, 56069). 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>. Add condition "len(cfg.DiscoveryToken) != 0" to ValidateArgSelection. **What this PR does / why we need it**: as per kubernetes#54982 (comment) >only when the conditions having len(cfg.DiscoveryToken) != 0 means "using token-based discovery" as is mentioned in the error message. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: ref: kubernetes#54982 **Special notes for your reviewer**: /cc @kubernetes/sig-cluster-lifecycle-pr-reviews **Release note**: ```release-note NONE ```
2 parents 563edef + 35138ac commit db4134d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmd/kubeadm/app/apis/kubeadm/validation/validation.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ func ValidateArgSelection(cfg *kubeadm.NodeConfiguration, fldPath *field.Path) f
140140
allErrs = append(allErrs, field.Invalid(fldPath, "", "DiscoveryTokenCACertHashes cannot be used with DiscoveryFile"))
141141
}
142142

143-
if len(cfg.DiscoveryFile) == 0 && len(cfg.DiscoveryTokenCACertHashes) == 0 && !cfg.DiscoveryTokenUnsafeSkipCAVerification {
143+
if len(cfg.DiscoveryFile) == 0 && len(cfg.DiscoveryToken) != 0 &&
144+
len(cfg.DiscoveryTokenCACertHashes) == 0 && !cfg.DiscoveryTokenUnsafeSkipCAVerification {
144145
allErrs = append(allErrs, field.Invalid(fldPath, "", "using token-based discovery without DiscoveryTokenCACertHashes can be unsafe. set --discovery-token-unsafe-skip-ca-verification to continue"))
145146
}
146147

0 commit comments

Comments
 (0)