Skip to content

Commit d083026

Browse files
author
Kate Osborn
committed
Small fixes
1 parent 2c03b60 commit d083026

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

apis/v1alpha1/clientsettingspolicy_types.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ type ClientSettingsPolicyList struct {
3636

3737
// ClientSettingsPolicySpec defines the desired state of ClientSettingsPolicy.
3838
type ClientSettingsPolicySpec struct {
39-
// TargetRef identifies an API object to apply the policy to.
40-
// Object must be in the same namespace as the policy.
41-
// Support: Gateway, HTTPRoute, GRPCRoute.
42-
//
43-
// +kubebuilder:validation:XValidation:message="TargetRef Kind must be one of: Gateway, HTTPRoute, or GRPCRoute",rule="(self.kind=='Gateway' || self.kind=='HTTPRoute' || self.kind=='GRPCRoute')"
44-
// +kubebuilder:validation:XValidation:message="TargetRef Group must be gateway.networking.k8s.io.",rule="(self.group=='gateway.networking.k8s.io')"
45-
//nolint:lll
46-
TargetRef gatewayv1alpha2.LocalPolicyTargetReference `json:"targetRef"`
47-
4839
// Body defines the client request body settings.
4940
//
5041
// +optional
@@ -54,6 +45,15 @@ type ClientSettingsPolicySpec struct {
5445
//
5546
// +optional
5647
KeepAlive *ClientKeepAlive `json:"keepAlive,omitempty"`
48+
49+
// TargetRef identifies an API object to apply the policy to.
50+
// Object must be in the same namespace as the policy.
51+
// Support: Gateway, HTTPRoute, GRPCRoute.
52+
//
53+
// +kubebuilder:validation:XValidation:message="TargetRef Kind must be one of: Gateway, HTTPRoute, or GRPCRoute",rule="(self.kind=='Gateway' || self.kind=='HTTPRoute' || self.kind=='GRPCRoute')"
54+
// +kubebuilder:validation:XValidation:message="TargetRef Group must be gateway.networking.k8s.io.",rule="(self.group=='gateway.networking.k8s.io')"
55+
//nolint:lll
56+
TargetRef gatewayv1alpha2.LocalPolicyTargetReference `json:"targetRef"`
5757
}
5858

5959
// ClientBody contains the settings for the client request body.

internal/mode/static/nginx/config/servers_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ func TestCreateServers(t *testing.T) {
999999
{
10001000
Path: "= /addition-path-only-match",
10011001
ProxyPass: "http://test_foo_80$request_uri",
1002-
ProxySetHeaders: baseHeaders,
1002+
ProxySetHeaders: httpBaseHeaders,
10031003
Includes: []http.Include{
10041004
{
10051005
Filename: includesFolder + "/path-only-match-addition.conf",

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (v *Validator) Validate(policy policies.Policy) error {
3232
panic(fmt.Sprintf("expected ClientSettingsPolicy, got: %T", policy))
3333
}
3434

35-
if err := validateTargetRef(csp.Spec.TargetRef, csp.Namespace); err != nil {
35+
if err := validateTargetRef(csp.Spec.TargetRef); err != nil {
3636
return err
3737
}
3838

@@ -79,7 +79,7 @@ func conflicts(a, b ngfAPI.ClientSettingsPolicySpec) bool {
7979
return false
8080
}
8181

82-
func validateTargetRef(ref v1alpha2.LocalPolicyTargetReference, policyNs string) error {
82+
func validateTargetRef(ref v1alpha2.LocalPolicyTargetReference) error {
8383
basePath := field.NewPath("spec").Child("targetRef")
8484

8585
if ref.Group != gatewayv1.GroupName {

0 commit comments

Comments
 (0)