mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
print more error details about CertSANs validation
This commit is contained in:
parent
6ce59dd1a2
commit
7bf6ff2ec1
@ -307,8 +307,10 @@ func ValidateEtcd(e *kubeadm.Etcd, fldPath *field.Path) field.ErrorList {
|
|||||||
func ValidateCertSANs(altnames []string, fldPath *field.Path) field.ErrorList {
|
func ValidateCertSANs(altnames []string, fldPath *field.Path) field.ErrorList {
|
||||||
allErrs := field.ErrorList{}
|
allErrs := field.ErrorList{}
|
||||||
for _, altname := range altnames {
|
for _, altname := range altnames {
|
||||||
if len(validation.IsDNS1123Subdomain(altname)) != 0 && net.ParseIP(altname) == nil {
|
if errs := validation.IsDNS1123Subdomain(altname); len(errs) != 0 {
|
||||||
allErrs = append(allErrs, field.Invalid(fldPath, altname, "altname is not a valid dns label or ip address"))
|
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
|
return allErrs
|
||||||
|
Loading…
Reference in New Issue
Block a user