Skip to content

Add NginxProxy CRD #1815

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

Merged
merged 7 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update validation and attribute structure
  • Loading branch information
sjberman committed Apr 15, 2024
commit e845bf0cd7ea0c8797f02ba9815fc95ec0215782
24 changes: 18 additions & 6 deletions apis/v1alpha1/nginxproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@ type Telemetry struct {
//
// +optional
// +kubebuilder:validation:MaxLength=127
// +kubebuilder:validation:Pattern=`^[a-zA-Z0-9_-]+$`
ServiceName *string `json:"serviceName,omitempty"`

// SpanAttributes are custom key/value attributes that are added to each span.
//
// +optional
// +kubebuilder:validation:MaxProperties=64
SpanAttributes map[string]AttributeValue `json:"spanAttributes,omitempty"`
// +kubebuilder:validation:MaxItems=64
SpanAttributes []SpanAttribute `json:"spanAttributes,omitempty"`
}

// TelemetryExporter specifies OpenTelemetry export parameters.
Expand All @@ -79,13 +80,24 @@ type TelemetryExporter struct {
BatchCount *int32 `json:"batchCount,omitempty"`

// Endpoint is the address of OTLP/gRPC endpoint that will accept telemetry data.
// Format: alphanumeric hostname with optional http scheme and optional port.
//
//nolint:lll
// +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"`
}

// AttributeValue is a value paired with a key and attached to a tracing span.
//
// +kubebuilder:validation:MaxLength=255
type AttributeValue string
// SpanAttribute is a key value pair to be added to a tracing span.
type SpanAttribute struct {
// Key is the key for a span attribute.
//
// +kubebuilder:validation:MaxLength=255
// +kubebuilder:validation:Pattern=`^[a-zA-Z0-9_-]+$`
Key string `json:"key"`

// Value is the value for a span attribute.
//
// +kubebuilder:validation:MaxLength=255
// +kubebuilder:validation:Pattern=`^[a-zA-Z0-9_-]+$`
Value string `json:"value"`
}
21 changes: 17 additions & 4 deletions apis/v1alpha1/zz_generated.deepcopy.go

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

33 changes: 24 additions & 9 deletions config/crd/bases/gateway.nginx.org_nginxproxies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ spec:
minimum: 0
type: integer
endpoint:
description: Endpoint is the address of OTLP/gRPC endpoint
that will accept telemetry data.
description: |-
Endpoint is the address of OTLP/gRPC endpoint that will accept telemetry data.
Format: alphanumeric hostname with optional http scheme and optional port.
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})?$
type: string
interval:
Expand All @@ -87,17 +88,31 @@ spec:
Default is 'ngf:<gateway-namespace>:<gateway-name>'. If a value is provided by the user,
then the default becomes a prefix to that value.
maxLength: 127
pattern: ^[a-zA-Z0-9_-]+$
type: string
spanAttributes:
additionalProperties:
description: AttributeValue is a value paired with a key and
attached to a tracing span.
maxLength: 255
type: string
description: SpanAttributes are custom key/value attributes that
are added to each span.
maxProperties: 64
type: object
items:
description: SpanAttribute is a key value pair to be added to
a tracing span.
properties:
key:
description: Key is the key for a span attribute.
maxLength: 255
pattern: ^[a-zA-Z0-9_-]+$
type: string
value:
description: Value is the value for a span attribute.
maxLength: 255
pattern: ^[a-zA-Z0-9_-]+$
type: string
required:
- key
- value
type: object
maxItems: 64
type: array
type: object
type: object
required:
Expand Down