mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
IngressTLS: allow secretName to be blank for SNI routing
This commit is contained in:
@@ -523,13 +523,6 @@ func ValidateIngressName(name string, prefix bool) (bool, string) {
|
||||
|
||||
func validateIngressTLS(spec *extensions.IngressSpec, fldPath *field.Path) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
// Currently the Ingress only supports HTTP(S), so a secretName is required.
|
||||
// This will not be the case if we support SSL routing at L4 via SNI.
|
||||
for i, t := range spec.TLS {
|
||||
if t.SecretName == "" {
|
||||
allErrs = append(allErrs, field.Required(fldPath.Index(i).Child("secretName"), spec.TLS[i].SecretName))
|
||||
}
|
||||
}
|
||||
// TODO: Perform a more thorough validation of spec.TLS.Hosts that takes
|
||||
// the wildcard spec from RFC 6125 into account.
|
||||
return allErrs
|
||||
|
||||
@@ -1320,8 +1320,6 @@ func TestValidateIngress(t *testing.T) {
|
||||
badHostIP := newValid()
|
||||
badHostIP.Spec.Rules[0].Host = hostIP
|
||||
badHostIPErr := fmt.Sprintf("spec.rules[0].host: Invalid value: '%v'", hostIP)
|
||||
noSecretName := newValid()
|
||||
noSecretName.Spec.TLS = []extensions.IngressTLS{{SecretName: ""}}
|
||||
|
||||
errorCases := map[string]extensions.Ingress{
|
||||
"spec.backend.serviceName: Required value": servicelessBackend,
|
||||
@@ -1330,7 +1328,6 @@ func TestValidateIngress(t *testing.T) {
|
||||
"spec.rules[0].host: Invalid value": badHost,
|
||||
"spec.rules[0].http.paths: Required value": noPaths,
|
||||
"spec.rules[0].http.paths[0].path: Invalid value": noForwardSlashPath,
|
||||
"spec.tls[0].secretName: Required value": noSecretName,
|
||||
}
|
||||
errorCases[badPathErr] = badRegexPath
|
||||
errorCases[badHostIPErr] = badHostIP
|
||||
|
||||
Reference in New Issue
Block a user