Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ generate: ## Run go generate
.PHONY: generate-crds
generate-crds: ## Generate CRDs and Go types using kubebuilder
go run sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION) crd object paths=./apis/... output:crd:artifacts:config=config/crd/bases
./scripts/strip-crd-excludes.sh config/crd/bases
kubectl kustomize config/crd >deploy/crds.yaml

.PHONY: install-crds
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The following table lists the software versions NGINX Gateway Fabric supports.

| NGINX Gateway Fabric | Gateway API | Kubernetes | NGINX OSS | NGINX Plus | NGINX Agent |
|----------------------|-------------|------------|-----------|------------|-------------|
| Edge | 1.3.0 | 1.25+ | 1.29.2 | R35 | v3.4.2 |
| Edge | 1.4.0 | 1.25+ | 1.29.2 | R35 | v3.4.2 |
| 2.2.0 | 1.3.0 | 1.25+ | 1.29.2 | R35 | v3.3.2 |
| 2.1.4 | 1.3.0 | 1.25+ | 1.29.1 | R35 | v3.3.1 |
| 2.1.3 | 1.3.0 | 1.25+ | 1.29.1 | R35 | v3.3.1 |
Expand Down
6 changes: 3 additions & 3 deletions apis/v1alpha1/clientsettingspolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
)

// +genclient
Expand All @@ -23,7 +23,7 @@ type ClientSettingsPolicy struct {
Spec ClientSettingsPolicySpec `json:"spec"`

// Status defines the state of the ClientSettingsPolicy.
Status gatewayv1alpha2.PolicyStatus `json:"status,omitempty"`
Status gatewayv1.PolicyStatus `json:"status,omitempty"`
}

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

// ClientBody contains the settings for the client request body.
Expand Down
6 changes: 3 additions & 3 deletions apis/v1alpha1/observabilitypolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
)

// +genclient
Expand All @@ -25,7 +25,7 @@ type ObservabilityPolicy struct {
Spec ObservabilityPolicySpec `json:"spec"`

// Status defines the state of the ObservabilityPolicy.
Status gatewayv1alpha2.PolicyStatus `json:"status,omitempty"`
Status gatewayv1.PolicyStatus `json:"status,omitempty"`
}

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

// Tracing allows for enabling and configuring OpenTelemetry tracing.
Expand Down
22 changes: 11 additions & 11 deletions apis/v1alpha1/policy_methods.go
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
package v1alpha1

import (
"sigs.k8s.io/gateway-api/apis/v1alpha2"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
)

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

func (p *ClientSettingsPolicy) GetTargetRefs() []v1alpha2.LocalPolicyTargetReference {
return []v1alpha2.LocalPolicyTargetReference{p.Spec.TargetRef}
func (p *ClientSettingsPolicy) GetTargetRefs() []gatewayv1.LocalPolicyTargetReference {
return []gatewayv1.LocalPolicyTargetReference{p.Spec.TargetRef}
}

func (p *ClientSettingsPolicy) GetPolicyStatus() v1alpha2.PolicyStatus {
func (p *ClientSettingsPolicy) GetPolicyStatus() gatewayv1.PolicyStatus {
return p.Status
}

func (p *ClientSettingsPolicy) SetPolicyStatus(status v1alpha2.PolicyStatus) {
func (p *ClientSettingsPolicy) SetPolicyStatus(status gatewayv1.PolicyStatus) {
p.Status = status
}

func (p *ObservabilityPolicy) GetTargetRefs() []v1alpha2.LocalPolicyTargetReference {
func (p *ObservabilityPolicy) GetTargetRefs() []gatewayv1.LocalPolicyTargetReference {
return p.Spec.TargetRefs
}

func (p *ObservabilityPolicy) GetPolicyStatus() v1alpha2.PolicyStatus {
func (p *ObservabilityPolicy) GetPolicyStatus() gatewayv1.PolicyStatus {
return p.Status
}

func (p *ObservabilityPolicy) SetPolicyStatus(status v1alpha2.PolicyStatus) {
func (p *ObservabilityPolicy) SetPolicyStatus(status gatewayv1.PolicyStatus) {
p.Status = status
}

func (p *UpstreamSettingsPolicy) GetTargetRefs() []v1alpha2.LocalPolicyTargetReference {
func (p *UpstreamSettingsPolicy) GetTargetRefs() []gatewayv1.LocalPolicyTargetReference {
return p.Spec.TargetRefs
}

func (p *UpstreamSettingsPolicy) GetPolicyStatus() v1alpha2.PolicyStatus {
func (p *UpstreamSettingsPolicy) GetPolicyStatus() gatewayv1.PolicyStatus {
return p.Status
}

func (p *UpstreamSettingsPolicy) SetPolicyStatus(status v1alpha2.PolicyStatus) {
func (p *UpstreamSettingsPolicy) SetPolicyStatus(status gatewayv1.PolicyStatus) {
p.Status = status
}
6 changes: 3 additions & 3 deletions apis/v1alpha1/upstreamsettingspolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
)

// +genclient
Expand All @@ -23,7 +23,7 @@ type UpstreamSettingsPolicy struct {
Spec UpstreamSettingsPolicySpec `json:"spec"`

// Status defines the state of the UpstreamSettingsPolicy.
Status gatewayv1alpha2.PolicyStatus `json:"status,omitempty"`
Status gatewayv1.PolicyStatus `json:"status,omitempty"`
}

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

// UpstreamKeepAlive defines the keep-alive settings for upstreams.
Expand Down
16 changes: 6 additions & 10 deletions apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions apis/v1alpha2/observabilitypolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package v1alpha2

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

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

// Status defines the state of the ObservabilityPolicy.
Status gatewayv1alpha2.PolicyStatus `json:"status,omitempty"`
Status gatewayv1.PolicyStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -58,7 +58,7 @@ type ObservabilityPolicySpec struct {
// +kubebuilder:validation:XValidation:message="TargetRef Group must be gateway.networking.k8s.io",rule="self.all(t, t.group=='gateway.networking.k8s.io')"
// +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)))"
//nolint:lll
TargetRefs []gatewayv1alpha2.LocalPolicyTargetReference `json:"targetRefs"`
TargetRefs []gatewayv1.LocalPolicyTargetReference `json:"targetRefs"`
}

// Tracing allows for enabling and configuring OpenTelemetry tracing.
Expand Down
8 changes: 4 additions & 4 deletions apis/v1alpha2/policy_methods.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package v1alpha2

import (
"sigs.k8s.io/gateway-api/apis/v1alpha2"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
)

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

func (p *ObservabilityPolicy) GetTargetRefs() []v1alpha2.LocalPolicyTargetReference {
func (p *ObservabilityPolicy) GetTargetRefs() []gatewayv1.LocalPolicyTargetReference {
return p.Spec.TargetRefs
}

func (p *ObservabilityPolicy) GetPolicyStatus() v1alpha2.PolicyStatus {
func (p *ObservabilityPolicy) GetPolicyStatus() gatewayv1.PolicyStatus {
return p.Status
}

func (p *ObservabilityPolicy) SetPolicyStatus(status v1alpha2.PolicyStatus) {
func (p *ObservabilityPolicy) SetPolicyStatus(status gatewayv1.PolicyStatus) {
p.Status = status
}
8 changes: 3 additions & 5 deletions apis/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions charts/nginx-gateway-fabric/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ rules:
- httproutes
- referencegrants
- grpcroutes
{{- if .Values.nginxGateway.gwAPIExperimentalFeatures.enable }}
- backendtlspolicies
{{- if .Values.nginxGateway.gwAPIExperimentalFeatures.enable }}
- tlsroutes
{{- end }}
verbs:
Expand All @@ -108,8 +108,8 @@ rules:
- gateways/status
- gatewayclasses/status
- grpcroutes/status
{{- if .Values.nginxGateway.gwAPIExperimentalFeatures.enable }}
- backendtlspolicies/status
{{- if .Values.nginxGateway.gwAPIExperimentalFeatures.enable }}
- tlsroutes/status
{{- end }}
verbs:
Expand Down
2 changes: 1 addition & 1 deletion cmd/gateway/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

const (
// Regex from: https://github.com/kubernetes-sigs/gateway-api/blob/v1.3.0/apis/v1/shared_types.go#L660
// Regex from: https://github.com/kubernetes-sigs/gateway-api/blob/v1.4.0/apis/v1/shared_types.go#L660
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

controllerNameRegex = `^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$` //nolint:lll
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,9 @@ spec:
- name
type: object
conditions:
description: Conditions describes the status of the Policy with
respect to the given Ancestor.
description: |-
Conditions describes the status of the Policy with respect to the given Ancestor.

items:
description: Condition contains details for one aspect of
the current state of this API Resource.
Expand Down Expand Up @@ -437,10 +438,12 @@ spec:
type: string
required:
- ancestorRef
- conditions
- controllerName
type: object
maxItems: 16
type: array
x-kubernetes-list-type: atomic
required:
- ancestors
type: object
Expand Down
14 changes: 10 additions & 4 deletions config/crd/bases/gateway.nginx.org_observabilitypolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,9 @@ spec:
- name
type: object
conditions:
description: Conditions describes the status of the Policy with
respect to the given Ancestor.
description: |-
Conditions describes the status of the Policy with respect to the given Ancestor.

items:
description: Condition contains details for one aspect of
the current state of this API Resource.
Expand Down Expand Up @@ -463,10 +464,12 @@ spec:
type: string
required:
- ancestorRef
- conditions
- controllerName
type: object
maxItems: 16
type: array
x-kubernetes-list-type: atomic
required:
- ancestors
type: object
Expand Down Expand Up @@ -841,8 +844,9 @@ spec:
- name
type: object
conditions:
description: Conditions describes the status of the Policy with
respect to the given Ancestor.
description: |-
Conditions describes the status of the Policy with respect to the given Ancestor.

items:
description: Condition contains details for one aspect of
the current state of this API Resource.
Expand Down Expand Up @@ -925,10 +929,12 @@ spec:
type: string
required:
- ancestorRef
- conditions
- controllerName
type: object
maxItems: 16
type: array
x-kubernetes-list-type: atomic
required:
- ancestors
type: object
Expand Down
Loading
Loading