Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ClientSettingsPolicy #1940

Merged
merged 38 commits into from
May 20, 2024
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c953477
Implement ClientSettingsPolicy Attachment
Apr 24, 2024
b5a13a4
Change example files
May 7, 2024
294b347
Mark proposal as completed
May 7, 2024
7eeb012
Generate CRDs
May 7, 2024
b9f0c13
Remove PolicyAncestorRef
May 7, 2024
530cf7d
Use v1 ParentRef
May 7, 2024
77fd3ae
Update template formatting
May 8, 2024
cb2cb7f
Move routeKeyForKind
May 8, 2024
23c2465
Fix route type in test
May 8, 2024
41517dc
Add constant for ancestor max
May 8, 2024
ca228aa
Reduce rbac privs
May 8, 2024
da6afda
Add test to the names of test functions
May 8, 2024
a2e42d3
Fix comment for sort.ClientObject
May 8, 2024
65eb514
Remove newline
May 8, 2024
08e53b9
Add comments to RouteKey fields
May 8, 2024
f3938cf
Add space after includes and before locations
May 8, 2024
e6ea1bd
Add CEL validation for target ref kind
May 8, 2024
4b7e914
Add CEL validation for target ref group
May 8, 2024
fadd9e5
Remove content from Include
May 16, 2024
dbebb53
testData -> assertData
May 16, 2024
1a461aa
use real upstream in test
May 16, 2024
24e6507
Remove unnecessary validation
May 16, 2024
5986149
Extract function for adding includes to locations
May 16, 2024
a0d0c5f
Create MustExtractGVK type
May 16, 2024
0a172d1
Small fixes
May 16, 2024
f045cc7
Generate CRDs
May 17, 2024
f71d296
Add fixme
May 17, 2024
4ca2334
Run generate manifests
May 17, 2024
b37f578
Make Includes a list of strings
May 17, 2024
a287332
Refactor change processor to accept MustExtractGVK
May 17, 2024
d37c2da
Panic if addition is nil
May 17, 2024
4412a21
Use MustcastObject helper method
May 17, 2024
2d3c364
Fix condition type
May 17, 2024
f25e9fd
Address issues with sort package and tests
May 17, 2024
c28a52b
Addition does not need to be a pointer
May 17, 2024
c071435
Panic when policy is nil in isrelevant
May 17, 2024
5c41398
Simplify ancestorsFull
May 17, 2024
2842083
Reinstate header/server validation
May 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix condition type
Kate Osborn committed May 20, 2024
commit 2d3c364e4a5d4a9308b5499c0578dfc1191daf21
9 changes: 4 additions & 5 deletions internal/mode/static/policies/clientsettings/validator.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package clientsettings

import (
"fmt"
"slices"

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

return field.Invalid(
return field.NotSupported(
path,
ref.Group,
fmt.Sprintf("unsupported targetRef Group %q; must be %s", ref.Group, gatewayv1.GroupName),
[]string{gatewayv1.GroupName},
)
}

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

return field.Invalid(
return field.NotSupported(
path,
ref.Kind,
fmt.Sprintf("unsupported targetRef Kind %q; Kind must be one of: %v", ref.Kind, supportedKinds),
supportedKinds,
)
}