-
Notifications
You must be signed in to change notification settings - Fork 146
Add ProxySettingPolicy API and CRDs #4266
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
ciarams87
merged 5 commits into
feat/proxy-settings-policy
from
feat/proxy-settings-api
Nov 13, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3ca99a2
Add ProxySettingPolicy API and CRDs
ciarams87 2ea19ec
Add missing field comments
ciarams87 b850fce
Add in CEL validation for TargetRefs
ciarams87 8fff74a
Move size type; remove duplicates strings; regen crds
ciarams87 176aee4
Update the proposal to reflect the implemented API
ciarams87 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
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,99 @@ | ||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" | ||
| ) | ||
|
|
||
| // +genclient | ||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:storageversion | ||
| // +kubebuilder:subresource:status | ||
| // +kubebuilder:resource:categories=nginx-gateway-fabric,shortName=pspolicy | ||
| // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` | ||
| // +kubebuilder:metadata:labels="gateway.networking.k8s.io/policy=inherited" | ||
|
|
||
| // ProxySettingsPolicy is an Inherited Attached Policy. It provides a way to configure the behavior of the connection | ||
| // between NGINX Gateway Fabric and the upstream applications (backends). | ||
| type ProxySettingsPolicy struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| // Spec defines the desired state of the ProxySettingsPolicy. | ||
| Spec ProxySettingsPolicySpec `json:"spec"` | ||
|
|
||
| // Status defines the state of the ProxySettingsPolicy. | ||
| Status gatewayv1.PolicyStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
| // ProxySettingsPolicyList contains a list of ProxySettingsPolicies. | ||
| type ProxySettingsPolicyList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []ProxySettingsPolicy `json:"items"` | ||
| } | ||
|
|
||
| // ProxySettingsPolicySpec defines the desired state of the ProxySettingsPolicy. | ||
| type ProxySettingsPolicySpec struct { | ||
| // Buffering configures the buffering of responses from the proxied server. | ||
| // | ||
| // +optional | ||
| Buffering *ProxyBuffering `json:"buffering,omitempty"` | ||
|
|
||
| // TargetRefs identifies the API object(s) to apply the policy to. | ||
| // Objects must be in the same namespace as the policy. | ||
| // Support: Gateway, HTTPRoute, GRPCRoute | ||
| // | ||
| // +kubebuilder:validation:MinItems=1 | ||
| // +kubebuilder:validation:MaxItems=16 | ||
ciarams87 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // +kubebuilder:validation:XValidation:message="TargetRefs entries must have kind Gateway, HTTPRoute, or GRPCRoute",rule="self.all(t, t.kind == 'Gateway' || t.kind == 'HTTPRoute' || t.kind == 'GRPCRoute')" | ||
| // +kubebuilder:validation:XValidation:message="TargetRefs entries must have group gateway.networking.k8s.io",rule="self.all(t, t.group == 'gateway.networking.k8s.io')" | ||
| // +kubebuilder:validation:XValidation:message="TargetRefs must be unique",rule="self.all(t1, self.exists_one(t2, t1.group == t2.group && t1.kind == t2.kind && t1.name == t2.name))" | ||
| //nolint:lll | ||
| TargetRefs []gatewayv1.LocalPolicyTargetReference `json:"targetRefs"` | ||
| } | ||
|
|
||
| // ProxyBuffering contains the settings for proxy buffering. | ||
| type ProxyBuffering struct { | ||
bjee19 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // Disable enables or disables buffering of responses from the proxied server. | ||
| // If Disable is true, buffering is disabled. If Disable is false, or if Disable is not set, buffering is enabled. | ||
| // Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering | ||
| // | ||
| // +optional | ||
| Disable *bool `json:"disable,omitempty"` | ||
|
|
||
| // BufferSize sets the size of the buffer used for reading the first part of the response received from | ||
| // the proxied server. This part usually contains a small response header. | ||
| // Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size | ||
| // | ||
| // +optional | ||
| BufferSize *Size `json:"bufferSize,omitempty"` | ||
|
|
||
| // Buffers sets the number and size of buffers used for reading a response from the proxied server, | ||
| // for a single connection. | ||
| // Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers | ||
| // | ||
| // +optional | ||
| Buffers *ProxyBuffers `json:"buffers,omitempty"` | ||
|
|
||
| // BusyBuffersSize sets the total size of buffers that can be busy sending a response to the client, | ||
| // while the response is not yet fully read. | ||
| // Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_busy_buffers_size | ||
| // | ||
| // +optional | ||
| BusyBuffersSize *Size `json:"busyBuffersSize,omitempty"` | ||
| } | ||
|
|
||
| // ProxyBuffers defines the number and size of the proxy buffers. | ||
| type ProxyBuffers struct { | ||
| // Size sets the size of each buffer. | ||
| Size Size `json:"size"` | ||
ciarams87 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // Number sets the number of buffers. | ||
| // | ||
| // +kubebuilder:validation:Minimum=2 | ||
| // +kubebuilder:validation:Maximum=256 | ||
| Number int32 `json:"number"` | ||
| } | ||
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
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.