mirror of https://github.com/k3s-io/k3s
Merge pull request #73059 from SataQiu/fix-20190118
Print more error details about CertSANs validationpull/564/head
commit
3fd7187b4c
|
@ -307,8 +307,10 @@ func ValidateEtcd(e *kubeadm.Etcd, fldPath *field.Path) field.ErrorList {
|
|||
func ValidateCertSANs(altnames []string, fldPath *field.Path) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
for _, altname := range altnames {
|
||||
if len(validation.IsDNS1123Subdomain(altname)) != 0 && net.ParseIP(altname) == nil {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, altname, "altname is not a valid dns label or ip address"))
|
||||
if errs := validation.IsDNS1123Subdomain(altname); len(errs) != 0 {
|
||||
if net.ParseIP(altname) == nil {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, altname, fmt.Sprintf("altname is not a valid IP address or DNS label: %s", strings.Join(errs, "; "))))
|
||||
}
|
||||
}
|
||||
}
|
||||
return allErrs
|
||||
|
|
Loading…
Reference in New Issue