Skip to content

Commit 2d3c364

Browse files
author
Kate Osborn
committed
Fix condition type
1 parent 4412a21 commit 2d3c364

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

internal/mode/static/policies/clientsettings/validator.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package clientsettings
22

33
import (
4-
"fmt"
54
"slices"
65

76
"k8s.io/apimachinery/pkg/util/validation/field"
@@ -79,10 +78,10 @@ func validateTargetRef(ref v1alpha2.LocalPolicyTargetReference) error {
7978
if ref.Group != gatewayv1.GroupName {
8079
path := basePath.Child("group")
8180

82-
return field.Invalid(
81+
return field.NotSupported(
8382
path,
8483
ref.Group,
85-
fmt.Sprintf("unsupported targetRef Group %q; must be %s", ref.Group, gatewayv1.GroupName),
84+
[]string{gatewayv1.GroupName},
8685
)
8786
}
8887

@@ -91,10 +90,10 @@ func validateTargetRef(ref v1alpha2.LocalPolicyTargetReference) error {
9190
if !slices.Contains(supportedKinds, ref.Kind) {
9291
path := basePath.Child("kind")
9392

94-
return field.Invalid(
93+
return field.NotSupported(
9594
path,
9695
ref.Kind,
97-
fmt.Sprintf("unsupported targetRef Kind %q; Kind must be one of: %v", ref.Kind, supportedKinds),
96+
supportedKinds,
9897
)
9998
}
10099

0 commit comments

Comments
 (0)