Change:
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the label and provide further guidance. The label can be by org members by writing in a comment. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
It looks like you are correct. Please feel free to submit a pull request to fix it. For information on contribute, please refer to:
/sig network /sig auth
/assign
when reporting issues please give more context to explain it, in this case it is required so it never can be nil in this comparison
Who wants to fix this? This whole block is suspect - it checks for nil later, too.
I'm working on it in !

Discussion:
return allErrs } <del> if params.Scope != nil || params.Namespace != nil { scope := utilpointer.StringDeref(params.Scope, "") </del> <ins> scope := utilpointer.StringDeref(params.Scope, "") </ins> <del> if !supportedIngressClassParametersReferenceScopes.Has(scope) { allErrs = append(allErrs, field.NotSupported(fldPath.Child("scope"), scope, supportedIngressClassParametersReferenceScopes.List())) } else { if scope == networking.IngressClassParametersReferenceScopeNamespace { if params.Namespace == nil { allErrs = append(allErrs, field.Required(fldPath.Child("namespace"), "`parameters.scope` is set to 'Namespace'")) } else { for _, msg := range apivalidation.ValidateNamespaceName(*params.Namespace, false) { allErrs = append(allErrs, field.Invalid(fldPath.Child("namespace"), *params.Namespace, msg)) } </del> <ins> if !supportedIngressClassParametersReferenceScopes.Has(scope) { allErrs = append(allErrs, field.NotSupported(fldPath.Child("scope"), scope, supportedIngressClassParametersReferenceScopes.List())) } else { if scope == networking.IngressClassParametersReferenceScopeNamespace { if params.Namespace == nil { allErrs = append(allErrs, field.Required(fldPath.Child("namespace"), "`parameters.scope` is set to 'Namespace'")) } else { for _, msg := range apivalidation.ValidateNamespaceName(*params.Namespace, false) { allErrs = append(allErrs, field.Invalid(fldPath.Child("namespace"), *params.Namespace, msg)) </ins> } } <ins> } </ins> <del> if scope == networking.IngressClassParametersReferenceScopeCluster && params.Namespace != nil { allErrs = append(allErrs, field.Forbidden(fldPath.Child("namespace"), "`parameters.scope` is set to 'Cluster'")) } </del> <ins> if scope == networking.IngressClassParametersReferenceScopeCluster && params.Namespace != nil { allErrs = append(allErrs, field.Forbidden(fldPath.Child("namespace"), "`parameters.scope` is set to 'Cluster'")) </ins> } }

), expectedErrs: field.ErrorList{}, }, <ins> "valid name, valid controller, invalid scope": { ingressClass: makeValidIngressClass("test123", "foo.co/bar", setParams(makeIngressClassParams(nil, "foo", "bar", nil, utilpointer.String("foo_ns"))), ), expectedErrs: field.ErrorList{ field.Required(field.NewPath("spec.parameters.scope"), ""), }, }, </ins> "namespace not set when scope is Namespace": { ingressClass: makeValidIngressClass("test123", "foo.co/bar", setParams(makeIngressClassParams(nil, "foo", "bar", utilpointer.String("Namespace"), nil)),