Skip to content

Commit abccf00

Browse files
committed
Test GatewayAPI v1.4.0-rc2
1 parent cf38a6f commit abccf00

File tree

62 files changed

+971
-737
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+971
-737
lines changed

apis/v1alpha1/clientsettingspolicy_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package v1alpha1
22

33
import (
44
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5-
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
5+
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
66
)
77

88
// +genclient
@@ -23,7 +23,7 @@ type ClientSettingsPolicy struct {
2323
Spec ClientSettingsPolicySpec `json:"spec"`
2424

2525
// Status defines the state of the ClientSettingsPolicy.
26-
Status gatewayv1alpha2.PolicyStatus `json:"status,omitempty"`
26+
Status gatewayv1.PolicyStatus `json:"status,omitempty"`
2727
}
2828

2929
// +kubebuilder:object:root=true
@@ -54,7 +54,7 @@ type ClientSettingsPolicySpec struct {
5454
// +kubebuilder:validation:XValidation:message="TargetRef Kind must be one of: Gateway, HTTPRoute, or GRPCRoute",rule="(self.kind=='Gateway' || self.kind=='HTTPRoute' || self.kind=='GRPCRoute')"
5555
// +kubebuilder:validation:XValidation:message="TargetRef Group must be gateway.networking.k8s.io.",rule="(self.group=='gateway.networking.k8s.io')"
5656
//nolint:lll
57-
TargetRef gatewayv1alpha2.LocalPolicyTargetReference `json:"targetRef"`
57+
TargetRef gatewayv1.LocalPolicyTargetReference `json:"targetRef"`
5858
}
5959

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

apis/v1alpha1/observabilitypolicy_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package v1alpha1
22

33
import (
44
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5-
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
5+
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
66
)
77

88
// +genclient
@@ -25,7 +25,7 @@ type ObservabilityPolicy struct {
2525
Spec ObservabilityPolicySpec `json:"spec"`
2626

2727
// Status defines the state of the ObservabilityPolicy.
28-
Status gatewayv1alpha2.PolicyStatus `json:"status,omitempty"`
28+
Status gatewayv1.PolicyStatus `json:"status,omitempty"`
2929
}
3030

3131
// +kubebuilder:object:root=true
@@ -53,7 +53,7 @@ type ObservabilityPolicySpec struct {
5353
// +kubebuilder:validation:XValidation:message="TargetRef Kind must be: HTTPRoute or GRPCRoute",rule="(self.exists(t, t.kind=='HTTPRoute') || self.exists(t, t.kind=='GRPCRoute'))"
5454
// +kubebuilder:validation:XValidation:message="TargetRef Group must be gateway.networking.k8s.io",rule="self.all(t, t.group=='gateway.networking.k8s.io')"
5555
//nolint:lll
56-
TargetRefs []gatewayv1alpha2.LocalPolicyTargetReference `json:"targetRefs"`
56+
TargetRefs []gatewayv1.LocalPolicyTargetReference `json:"targetRefs"`
5757
}
5858

5959
// Tracing allows for enabling and configuring OpenTelemetry tracing.

apis/v1alpha1/policy_methods.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
11
package v1alpha1
22

33
import (
4-
"sigs.k8s.io/gateway-api/apis/v1alpha2"
4+
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
55
)
66

77
// FIXME(kate-osborn): https://github.com/nginx/nginx-gateway-fabric/issues/1939.
88
// Figure out a way to generate these methods for all our policies.
99
// These methods implement the policies.Policy interface which extends client.Object to add the following methods.
1010

11-
func (p *ClientSettingsPolicy) GetTargetRefs() []v1alpha2.LocalPolicyTargetReference {
12-
return []v1alpha2.LocalPolicyTargetReference{p.Spec.TargetRef}
11+
func (p *ClientSettingsPolicy) GetTargetRefs() []gatewayv1.LocalPolicyTargetReference {
12+
return []gatewayv1.LocalPolicyTargetReference{p.Spec.TargetRef}
1313
}
1414

15-
func (p *ClientSettingsPolicy) GetPolicyStatus() v1alpha2.PolicyStatus {
15+
func (p *ClientSettingsPolicy) GetPolicyStatus() gatewayv1.PolicyStatus {
1616
return p.Status
1717
}
1818

19-
func (p *ClientSettingsPolicy) SetPolicyStatus(status v1alpha2.PolicyStatus) {
19+
func (p *ClientSettingsPolicy) SetPolicyStatus(status gatewayv1.PolicyStatus) {
2020
p.Status = status
2121
}
2222

23-
func (p *ObservabilityPolicy) GetTargetRefs() []v1alpha2.LocalPolicyTargetReference {
23+
func (p *ObservabilityPolicy) GetTargetRefs() []gatewayv1.LocalPolicyTargetReference {
2424
return p.Spec.TargetRefs
2525
}
2626

27-
func (p *ObservabilityPolicy) GetPolicyStatus() v1alpha2.PolicyStatus {
27+
func (p *ObservabilityPolicy) GetPolicyStatus() gatewayv1.PolicyStatus {
2828
return p.Status
2929
}
3030

31-
func (p *ObservabilityPolicy) SetPolicyStatus(status v1alpha2.PolicyStatus) {
31+
func (p *ObservabilityPolicy) SetPolicyStatus(status gatewayv1.PolicyStatus) {
3232
p.Status = status
3333
}
3434

35-
func (p *UpstreamSettingsPolicy) GetTargetRefs() []v1alpha2.LocalPolicyTargetReference {
35+
func (p *UpstreamSettingsPolicy) GetTargetRefs() []gatewayv1.LocalPolicyTargetReference {
3636
return p.Spec.TargetRefs
3737
}
3838

39-
func (p *UpstreamSettingsPolicy) GetPolicyStatus() v1alpha2.PolicyStatus {
39+
func (p *UpstreamSettingsPolicy) GetPolicyStatus() gatewayv1.PolicyStatus {
4040
return p.Status
4141
}
4242

43-
func (p *UpstreamSettingsPolicy) SetPolicyStatus(status v1alpha2.PolicyStatus) {
43+
func (p *UpstreamSettingsPolicy) SetPolicyStatus(status gatewayv1.PolicyStatus) {
4444
p.Status = status
4545
}

apis/v1alpha1/upstreamsettingspolicy_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package v1alpha1
22

33
import (
44
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5-
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
5+
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
66
)
77

88
// +genclient
@@ -23,7 +23,7 @@ type UpstreamSettingsPolicy struct {
2323
Spec UpstreamSettingsPolicySpec `json:"spec"`
2424

2525
// Status defines the state of the UpstreamSettingsPolicy.
26-
Status gatewayv1alpha2.PolicyStatus `json:"status,omitempty"`
26+
Status gatewayv1.PolicyStatus `json:"status,omitempty"`
2727
}
2828

2929
// +kubebuilder:object:root=true
@@ -63,7 +63,7 @@ type UpstreamSettingsPolicySpec struct {
6363
// +kubebuilder:validation:XValidation:message="TargetRefs Group must be core",rule="self.exists(t, t.group=='') || self.exists(t, t.group=='core')"
6464
// +kubebuilder:validation:XValidation:message="TargetRef Name must be unique",rule="self.all(p1, self.exists_one(p2, p1.name == p2.name))"
6565
//nolint:lll
66-
TargetRefs []gatewayv1alpha2.LocalPolicyTargetReference `json:"targetRefs"`
66+
TargetRefs []gatewayv1.LocalPolicyTargetReference `json:"targetRefs"`
6767
}
6868

6969
// UpstreamKeepAlive defines the keep-alive settings for upstreams.

apis/v1alpha1/zz_generated.deepcopy.go

Lines changed: 6 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha2/observabilitypolicy_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package v1alpha2
22

33
import (
44
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5-
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
5+
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
66

77
ngfAPIv1alpha1 "github.com/nginx/nginx-gateway-fabric/v2/apis/v1alpha1"
88
)
@@ -26,7 +26,7 @@ type ObservabilityPolicy struct {
2626
Spec ObservabilityPolicySpec `json:"spec"`
2727

2828
// Status defines the state of the ObservabilityPolicy.
29-
Status gatewayv1alpha2.PolicyStatus `json:"status,omitempty"`
29+
Status gatewayv1.PolicyStatus `json:"status,omitempty"`
3030
}
3131

3232
// +kubebuilder:object:root=true
@@ -58,7 +58,7 @@ type ObservabilityPolicySpec struct {
5858
// +kubebuilder:validation:XValidation:message="TargetRef Group must be gateway.networking.k8s.io",rule="self.all(t, t.group=='gateway.networking.k8s.io')"
5959
// +kubebuilder:validation:XValidation:message="TargetRef Kind and Name combination must be unique",rule="self.all(p1, self.exists_one(p2, (p1.name == p2.name) && (p1.kind == p2.kind)))"
6060
//nolint:lll
61-
TargetRefs []gatewayv1alpha2.LocalPolicyTargetReference `json:"targetRefs"`
61+
TargetRefs []gatewayv1.LocalPolicyTargetReference `json:"targetRefs"`
6262
}
6363

6464
// Tracing allows for enabling and configuring OpenTelemetry tracing.

apis/v1alpha2/policy_methods.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
package v1alpha2
22

33
import (
4-
"sigs.k8s.io/gateway-api/apis/v1alpha2"
4+
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
55
)
66

77
// FIXME(kate-osborn): https://github.com/nginx/nginx-gateway-fabric/issues/1939.
88
// Figure out a way to generate these methods for all our policies.
99
// These methods implement the policies.Policy interface which extends client.Object to add the following methods.
1010

11-
func (p *ObservabilityPolicy) GetTargetRefs() []v1alpha2.LocalPolicyTargetReference {
11+
func (p *ObservabilityPolicy) GetTargetRefs() []gatewayv1.LocalPolicyTargetReference {
1212
return p.Spec.TargetRefs
1313
}
1414

15-
func (p *ObservabilityPolicy) GetPolicyStatus() v1alpha2.PolicyStatus {
15+
func (p *ObservabilityPolicy) GetPolicyStatus() gatewayv1.PolicyStatus {
1616
return p.Status
1717
}
1818

19-
func (p *ObservabilityPolicy) SetPolicyStatus(status v1alpha2.PolicyStatus) {
19+
func (p *ObservabilityPolicy) SetPolicyStatus(status gatewayv1.PolicyStatus) {
2020
p.Status = status
2121
}

apis/v1alpha2/zz_generated.deepcopy.go

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/gateway.nginx.org_clientsettingspolicies.yaml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,38 @@ spec:
353353
- name
354354
type: object
355355
conditions:
356-
description: Conditions describes the status of the Policy with
357-
respect to the given Ancestor.
356+
description: |-
357+
Conditions describes the status of the Policy with respect to the given Ancestor.
358+
359+
<gateway:util:excludeFromCRD>
360+
361+
Notes for implementors:
362+
363+
Conditions are a listType `map`, which means that they function like a
364+
map with a key of the `type` field _in the k8s apiserver_.
365+
366+
This means that implementations must obey some rules when updating this
367+
section.
368+
369+
* Implementations MUST perform a read-modify-write cycle on this field
370+
before modifying it. That is, when modifying this field, implementations
371+
must be confident they have fetched the most recent version of this field,
372+
and ensure that changes they make are on that recent version.
373+
* Implementations MUST NOT remove or reorder Conditions that they are not
374+
directly responsible for. For example, if an implementation sees a Condition
375+
with type `special.io/SomeField`, it MUST NOT remove, change or update that
376+
Condition.
377+
* Implementations MUST always _merge_ changes into Conditions of the same Type,
378+
rather than creating more than one Condition of the same Type.
379+
* Implementations MUST always update the `observedGeneration` field of the
380+
Condition to the `metadata.generation` of the Gateway at the time of update creation.
381+
* If the `observedGeneration` of a Condition is _greater than_ the value the
382+
implementation knows about, then it MUST NOT perform the update on that Condition,
383+
but must wait for a future reconciliation and status update. (The assumption is that
384+
the implementation's copy of the object is stale and an update will be re-triggered
385+
if relevant.)
386+
387+
</gateway:util:excludeFromCRD>
358388
items:
359389
description: Condition contains details for one aspect of
360390
the current state of this API Resource.
@@ -437,10 +467,12 @@ spec:
437467
type: string
438468
required:
439469
- ancestorRef
470+
- conditions
440471
- controllerName
441472
type: object
442473
maxItems: 16
443474
type: array
475+
x-kubernetes-list-type: atomic
444476
required:
445477
- ancestors
446478
type: object

0 commit comments

Comments
 (0)