Skip to content

Commit 176aee4

Browse files
committed
Update the proposal to reflect the implemented API
1 parent 8fff74a commit 176aee4

File tree

1 file changed

+74
-92
lines changed

1 file changed

+74
-92
lines changed

docs/proposals/proxy-settings.md

Lines changed: 74 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -64,119 +64,101 @@ Below is the Golang API for the `ProxySettingsPolicy` API:
6464
package v1alpha1
6565

6666
import (
67-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
68-
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
67+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
68+
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
6969
)
7070

71-
// ProxySettingsPolicy is an Inherited Attached Policy. It provides a way to configure the behavior of the
72-
// connection between NGINX and the upstream applications.
73-
//
7471
// +genclient
7572
// +kubebuilder:object:root=true
7673
// +kubebuilder:storageversion
7774
// +kubebuilder:subresource:status
78-
// +kubebuilder:resource:categories=gateway-api,scope=Namespaced
75+
// +kubebuilder:resource:categories=nginx-gateway-fabric,shortName=pspolicy
7976
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
8077
// +kubebuilder:metadata:labels="gateway.networking.k8s.io/policy=inherited"
78+
79+
// ProxySettingsPolicy is an Inherited Attached Policy. It provides a way to configure the behavior of the connection
80+
// between NGINX Gateway Fabric and the upstream applications (backends).
8181
type ProxySettingsPolicy struct {
82-
metav1.TypeMeta `json:",inline"`
83-
metav1.ObjectMeta `json:"metadata,omitempty"`
82+
metav1.TypeMeta `json:",inline"`
83+
metav1.ObjectMeta `json:"metadata,omitempty"`
8484

85-
// Spec defines the desired state of the ProxySettingsPolicy.
86-
Spec ProxySettingsPolicySpec `json:"spec"`
85+
// Spec defines the desired state of the ProxySettingsPolicy.
86+
Spec ProxySettingsPolicySpec `json:"spec"`
87+
88+
// Status defines the state of the ProxySettingsPolicy.
89+
Status gatewayv1.PolicyStatus `json:"status,omitempty"`
90+
}
8791

88-
// Status defines the state of the ProxySettingsPolicy.
89-
Status gatewayv1.PolicyStatus `json:"status,omitempty"`
92+
// +kubebuilder:object:root=true
93+
94+
// ProxySettingsPolicyList contains a list of ProxySettingsPolicies.
95+
type ProxySettingsPolicyList struct {
96+
metav1.TypeMeta `json:",inline"`
97+
metav1.ListMeta `json:"metadata,omitempty"`
98+
Items []ProxySettingsPolicy `json:"items"`
9099
}
91100

92101
// ProxySettingsPolicySpec defines the desired state of the ProxySettingsPolicy.
93102
type ProxySettingsPolicySpec struct {
94-
// TargetRefs identifies API object(s) to apply the policy to.
95-
// Objects must be in the same namespace as the policy.
96-
//
97-
// Support: Gateway, HTTPRoute, GRPCRoute
98-
//
99-
// +kubebuilder:validation:MinItems=1
100-
// +kubebuilder:validation:MaxItems=16
101-
// +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')"
102-
// +kubebuilder:validation:XValidation:message="TargetRefs entries must have group gateway.networking.k8s.io",rule="self.all(t, t.group == 'gateway.networking.k8s.io')"
103-
// +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))"
104-
TargetRefs []gatewayv1.LocalPolicyTargetReference `json:"targetRefs"`
105-
106-
// Buffering defines the proxy buffering settings.
107-
//
108-
// +optional
109-
Buffering *ProxyBuffering `json:"buffering,omitempty"`
103+
// Buffering configures the buffering of responses from the proxied server.
104+
//
105+
// +optional
106+
Buffering *ProxyBuffering `json:"buffering,omitempty"`
107+
108+
// TargetRefs identifies the API object(s) to apply the policy to.
109+
// Objects must be in the same namespace as the policy.
110+
// Support: Gateway, HTTPRoute, GRPCRoute
111+
//
112+
// +kubebuilder:validation:MinItems=1
113+
// +kubebuilder:validation:MaxItems=16
114+
// +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')"
115+
// +kubebuilder:validation:XValidation:message="TargetRefs entries must have group gateway.networking.k8s.io",rule="self.all(t, t.group == 'gateway.networking.k8s.io')"
116+
// +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))"
117+
//nolint:lll
118+
TargetRefs []gatewayv1.LocalPolicyTargetReference `json:"targetRefs"`
110119
}
111120

112-
// ProxyBuffering contains settings for proxy buffering.
121+
// ProxyBuffering contains the settings for proxy buffering.
113122
type ProxyBuffering struct {
114-
// Disable disables buffering of responses from the proxied server.
115-
// When not disabled, NGINX receives a response from the proxied server as soon as possible,
116-
// saving it into buffers. When disabled, the response is passed to a client synchronously,
117-
// immediately as it is received.
118-
//
119-
// Default: false (buffering is enabled by default in NGINX)
120-
// Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering
121-
//
122-
// +optional
123-
Disable *bool `json:"disable,omitempty"`
124-
125-
// BufferSize sets the size of the buffer used for reading the first part of the response
126-
// received from the proxied server. This part usually contains a small response header.
127-
//
128-
// Default: "4k|8k" (one memory page, platform dependent)
129-
// Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size
130-
//
131-
// +optional
132-
BufferSize *Size `json:"bufferSize,omitempty"`
133-
134-
// Buffers sets the number and size of the buffers used for reading a response from the
135-
// proxied server, for a single connection.
136-
//
137-
// Default: "8 4k|8k" (8 buffers of one memory page, platform dependent)
138-
// Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers
139-
//
140-
// +optional
141-
Buffers *ProxyBuffers `json:"buffers,omitempty"`
142-
143-
// BusyBuffersSize limits the total size of buffers that can be busy sending a response
144-
// to the client while the response is not yet fully read.
145-
//
146-
// Default: "8k|16k" (platform dependent)
147-
// Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_busy_buffers_size
148-
//
149-
// +optional
150-
// +kubebuilder:validation:XValidation:message="BusyBuffersSize must be greater than or equal to BufferSize",rule="!has(self.busyBuffersSize) || !has(self.bufferSize) || self.busyBuffersSize >= self.bufferSize"
151-
BusyBuffersSize *Size `json:"busyBuffersSize,omitempty"`
123+
// Disable enables or disables buffering of responses from the proxied server.
124+
// If Disable is true, buffering is disabled. If Disable is false, or if Disable is not set, buffering is enabled.
125+
// Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering
126+
//
127+
// +optional
128+
Disable *bool `json:"disable,omitempty"`
129+
130+
// BufferSize sets the size of the buffer used for reading the first part of the response received from
131+
// the proxied server. This part usually contains a small response header.
132+
// Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size
133+
//
134+
// +optional
135+
BufferSize *Size `json:"bufferSize,omitempty"`
136+
137+
// Buffers sets the number and size of buffers used for reading a response from the proxied server,
138+
// for a single connection.
139+
// Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers
140+
//
141+
// +optional
142+
Buffers *ProxyBuffers `json:"buffers,omitempty"`
143+
144+
// BusyBuffersSize sets the total size of buffers that can be busy sending a response to the client,
145+
// while the response is not yet fully read.
146+
// Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_busy_buffers_size
147+
//
148+
// +optional
149+
BusyBuffersSize *Size `json:"busyBuffersSize,omitempty"`
152150
}
153151

154-
// ProxyBuffers defines the number and size of buffers.
152+
// ProxyBuffers defines the number and size of the proxy buffers.
155153
type ProxyBuffers struct {
156-
// Number sets the number of buffers.
157-
//
158-
// +kubebuilder:validation:Minimum=2
159-
// +kubebuilder:validation:Maximum=256
160-
Number int32 `json:"number"`
161-
162-
// Size sets the size of each buffer.
163-
Size Size `json:"size"`
164-
}
165-
166-
// Size is a string value representing a size. Size can be specified in bytes, kilobytes (suffix k),
167-
// or megabytes (suffix m).
168-
// Examples: 1024, 8k, 1m.
169-
//
170-
// +kubebuilder:validation:Pattern=`^\d+[kKmM]?$`
171-
type Size string
172-
173-
// ProxySettingsPolicyList contains a list of ProxySettingsPolicies.
174-
//
175-
// +kubebuilder:object:root=true
176-
type ProxySettingsPolicyList struct {
177-
metav1.TypeMeta `json:",inline"`
178-
metav1.ListMeta `json:"metadata,omitempty"`
179-
Items []ProxySettingsPolicy `json:"items"`
154+
// Size sets the size of each buffer.
155+
Size Size `json:"size"`
156+
157+
// Number sets the number of buffers.
158+
//
159+
// +kubebuilder:validation:Minimum=2
160+
// +kubebuilder:validation:Maximum=256
161+
Number int32 `json:"number"`
180162
}
181163
```
182164

0 commit comments

Comments
 (0)