kubernetes/cmd/kubeadm/app
Kubernetes Submit Queue 6a3d3a42db
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
```
2017-11-16 07:22:16 -08:00
..
apis/kubeadm Merge pull request #55581 from yuexiao-wang/remove-redundant 2017-11-16 07:22:16 -08:00
cmd Merge pull request #55152 from fabriziopandini/kubeadm-doc-preflight 2017-11-16 06:32:21 -08:00
constants Use const instead of hard-code for kubeadm usages 2017-11-09 16:03:47 +08:00
discovery Merge pull request #47699 from supereagle/fix-typos 2017-10-17 02:35:52 -07:00
features Merge pull request #54862 from lioncruise/patch-4 2017-11-16 03:09:16 -08:00
images update BUILD files 2017-10-15 18:18:13 -07:00
phases Merge pull request #51990 from madhukar32/get_dns_ip 2017-11-16 03:09:25 -08:00
preflight Merge pull request #55055 from runcom/check-with-crictl 2017-11-09 07:38:45 -08:00
util Adds Support for Configurable Kubeadm Probes. 2017-11-03 10:42:29 -07:00
BUILD update BUILD files 2017-10-15 18:18:13 -07:00
kubeadm.go kubeadm-doc-preflight 2017-11-16 10:20:22 +01:00