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

Support NginxProxy at the Gateway level #3058

Merged
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
2 changes: 0 additions & 2 deletions apis/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&NginxGateway{},
&NginxGatewayList{},
&NginxProxy{},
&NginxProxyList{},
&ObservabilityPolicy{},
&ObservabilityPolicyList{},
&ClientSettingsPolicy{},
Expand Down
218 changes: 0 additions & 218 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: 6 additions & 0 deletions apis/v1alpha2/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Package v1alpha2 contains API Schema definitions for the
// gateway.nginx.org API group.
//
// +kubebuilder:object:generate=true
// +groupName=gateway.nginx.org
package v1alpha2
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
package v1alpha1
package v1alpha2

import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/nginxinc/nginx-gateway-fabric/apis/v1alpha1"
)

// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:resource:categories=nginx-gateway-fabric,scope=Cluster
// +kubebuilder:resource:categories=nginx-gateway-fabric,scope=Namespaced
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`

// NginxProxy is a configuration object that is attached to a GatewayClass parametersRef. It provides a way
// to configure global settings for all Gateways defined from the GatewayClass.
// NginxProxy is a configuration object that can be referenced from a GatewayClass parametersRef
// or a Gateway infrastructure.parametersRef. It provides a way to configure data plane settings.
// If referenced from a GatewayClass, the settings apply to all Gateways attached to the GatewayClass.
// If referenced from a Gateway, the settings apply to that Gateway alone. If both a Gateway and its GatewayClass
// reference an NginxProxy, the settings are merged. Settings specified on the Gateway NginxProxy override those
// set on the GatewayClass NginxProxy.
type NginxProxy struct { //nolint:govet // standard field alignment, don't change it
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down Expand Up @@ -50,14 +58,18 @@ type NginxProxySpec struct {
// +optional
Logging *NginxLogging `json:"logging,omitempty"`
// DisableHTTP2 defines if http2 should be disabled for all servers.
// Default is false, meaning http2 will be enabled for all servers.
// If not specified, or set to false, http2 will be enabled for all servers.
//
// +optional
DisableHTTP2 bool `json:"disableHTTP2,omitempty"`
DisableHTTP2 *bool `json:"disableHTTP2,omitempty"`
}

// Telemetry specifies the OpenTelemetry configuration.
type Telemetry struct {
// DisabledFeatures specifies OpenTelemetry features to be disabled.
//
// +optional
DisabledFeatures []DisableTelemetryFeature `json:"disabledFeatures,omitempty"`
// Exporter specifies OpenTelemetry export parameters.
//
// +optional
Expand All @@ -78,7 +90,7 @@ type Telemetry struct {
// +listType=map
// +listMapKey=key
// +kubebuilder:validation:MaxItems=64
SpanAttributes []SpanAttribute `json:"spanAttributes,omitempty"`
SpanAttributes []v1alpha1.SpanAttribute `json:"spanAttributes,omitempty"`
}

// TelemetryExporter specifies OpenTelemetry export parameters.
Expand All @@ -87,7 +99,7 @@ type TelemetryExporter struct {
// Default: https://nginx.org/en/docs/ngx_otel_module.html#otel_exporter
//
// +optional
Interval *Duration `json:"interval,omitempty"`
Interval *v1alpha1.Duration `json:"interval,omitempty"`

// BatchSize is the maximum number of spans to be sent in one batch per worker.
// Default: https://nginx.org/en/docs/ngx_otel_module.html#otel_exporter
Expand All @@ -107,8 +119,9 @@ type TelemetryExporter struct {
// Format: alphanumeric hostname with optional http scheme and optional port.
//
//nolint:lll
// +optional
// +kubebuilder:validation:Pattern=`^(?:http?:\/\/)?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*(?::\d{1,5})?$`
Endpoint string `json:"endpoint"`
Endpoint *string `json:"endpoint,omitempty"`
}

// RewriteClientIP specifies the configuration for rewriting the client's IP address.
Expand Down Expand Up @@ -139,15 +152,12 @@ type RewriteClientIP struct {
// If a request comes from a trusted address, NGINX will rewrite the client IP information,
// and forward it to the backend in the X-Forwarded-For* and X-Real-IP headers.
// If the request does not come from a trusted address, NGINX will not rewrite the client IP information.
// TrustedAddresses only supports CIDR blocks: 192.33.21.1/24, fe80::1/64.
// To trust all addresses (not recommended for production), set to 0.0.0.0/0.
// If no addresses are provided, NGINX will not rewrite the client IP information.
// Sets NGINX directive set_real_ip_from: https://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
// This field is required if mode is set.
//
// +optional
// +listType=map
// +listMapKey=type
// +kubebuilder:validation:MaxItems=16
TrustedAddresses []Address `json:"trustedAddresses,omitempty"`
}
Expand Down Expand Up @@ -249,3 +259,13 @@ const (
// NginxLogLevelEmerg is the emerg level for NGINX error logs.
NginxLogLevelEmerg NginxErrorLogLevel = "emerg"
)

// DisableTelemetryFeature is a telemetry feature that can be disabled.
//
// +kubebuilder:validation:Enum=DisableTracing
type DisableTelemetryFeature string

const (
// DisableTracing disables the OpenTelemetry tracing feature.
DisableTracing DisableTelemetryFeature = "DisableTracing"
)
Loading
Loading