-
Notifications
You must be signed in to change notification settings - Fork 118
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
Add NginxProxy CRD #1815
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cbf449d
Add NginxProxy CRD
sjberman 9f285d0
Add default links; validation
sjberman e845bf0
Update validation and attribute structure
sjberman bb94947
Require minLength for attributes
sjberman 574d385
List type fields
sjberman 95369f5
Merge branch 'main' into enh/gateway-settings-crd
sjberman c821cf0
Merge branch 'main' into enh/gateway-settings-crd
sjberman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
package v1alpha1 | ||
|
||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:storageversion | ||
// +kubebuilder:resource:categories=nginx-gateway-fabric,scope=Cluster | ||
// +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. | ||
type NginxProxy struct { //nolint:govet // standard field alignment, don't change it | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// Spec defines the desired state of the NginxProxy. | ||
Spec NginxProxySpec `json:"spec"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// NginxProxyList contains a list of NginxProxies. | ||
type NginxProxyList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []NginxProxy `json:"items"` | ||
} | ||
|
||
// NginxProxySpec defines the desired state of the NginxProxy. | ||
type NginxProxySpec struct { | ||
// Telemetry specifies the OpenTelemetry configuration. | ||
// | ||
// +optional | ||
Telemetry *Telemetry `json:"telemetry,omitempty"` | ||
} | ||
|
||
// Telemetry specifies the OpenTelemetry configuration. | ||
type Telemetry struct { | ||
// Exporter specifies OpenTelemetry export parameters. | ||
// | ||
// +optional | ||
Exporter *TelemetryExporter `json:"exporter,omitempty"` | ||
|
||
// ServiceName is the "service.name" attribute of the OpenTelemetry resource. | ||
// Default is 'ngf:<gateway-namespace>:<gateway-name>'. If a value is provided by the user, | ||
// then the default becomes a prefix to that value. | ||
// | ||
// +optional | ||
// +kubebuilder:validation:MaxLength=127 | ||
sjberman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// +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 | ||
// +listType=map | ||
// +listMapKey=key | ||
// +kubebuilder:validation:MaxItems=64 | ||
SpanAttributes []SpanAttribute `json:"spanAttributes,omitempty"` | ||
} | ||
|
||
// TelemetryExporter specifies OpenTelemetry export parameters. | ||
type TelemetryExporter struct { | ||
// Interval is the maximum interval between two exports. | ||
// Default: https://nginx.org/en/docs/ngx_otel_module.html#otel_exporter | ||
// | ||
// +optional | ||
Interval *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 | ||
// | ||
// +optional | ||
// +kubebuilder:validation:Minimum=0 | ||
BatchSize *int32 `json:"batchSize,omitempty"` | ||
|
||
// BatchCount is the number of pending batches per worker, spans exceeding the limit are dropped. | ||
// Default: https://nginx.org/en/docs/ngx_otel_module.html#otel_exporter | ||
// | ||
// +optional | ||
// +kubebuilder:validation:Minimum=0 | ||
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})?$` | ||
sjberman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Endpoint string `json:"endpoint"` | ||
kate-osborn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
// 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:MinLength=1 | ||
// +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:MinLength=1 | ||
// +kubebuilder:validation:MaxLength=255 | ||
// +kubebuilder:validation:Pattern=`^[a-zA-Z0-9_-]+$` | ||
Value string `json:"value"` | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package v1alpha1 | ||
|
||
// Duration is a string value representing a duration in time. | ||
// Duration can be specified in milliseconds (ms) or seconds (s) A value without a suffix is seconds. | ||
// Examples: 120s, 50ms. | ||
// | ||
// +kubebuilder:validation:Pattern=`^\d{1,4}(ms|s)?$` | ||
type Duration string |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.