Skip to content

Commit 8547c49

Browse files
committed
Move size type; remove duplicates strings; regen crds
1 parent ef23d9b commit 8547c49

File tree

5 files changed

+29
-16
lines changed

5 files changed

+29
-16
lines changed

apis/v1alpha1/clientsettingspolicy_types.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,3 @@ type ClientKeepAliveTimeout struct {
121121
// +optional
122122
Header *Duration `json:"header,omitempty"`
123123
}
124-
125-
// Size is a string value representing a size. Size can be specified in bytes, kilobytes (k), megabytes (m),
126-
// or gigabytes (g).
127-
// Examples: 1024, 8k, 1m.
128-
//
129-
// +kubebuilder:validation:Pattern=`^\d{1,4}(k|m|g)?$`
130-
type Size string

apis/v1alpha1/proxysettingspolicy_types.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,20 @@ type ProxyBuffering struct {
6666

6767
// BufferSize sets the size of the buffer used for reading the first part of the response received from
6868
// the proxied server. This part usually contains a small response header.
69-
// Default: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size
7069
// Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size
7170
//
7271
// +optional
7372
BufferSize *Size `json:"bufferSize,omitempty"`
7473

7574
// Buffers sets the number and size of buffers used for reading a response from the proxied server,
7675
// for a single connection.
77-
// Default: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers
7876
// Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers
7977
//
8078
// +optional
8179
Buffers *ProxyBuffers `json:"buffers,omitempty"`
8280

8381
// BusyBuffersSize sets the total size of buffers that can be busy sending a response to the client,
8482
// while the response is not yet fully read.
85-
// Default: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_busy_buffers_size
8683
// Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_busy_buffers_size
8784
//
8885
// +optional

apis/v1alpha1/shared_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,10 @@ type SpanAttribute struct {
2626
// +kubebuilder:validation:Pattern=`^([^"$\\]|\\[^$])*$`
2727
Value string `json:"value"`
2828
}
29+
30+
// Size is a string value representing a size. Size can be specified in bytes, kilobytes (k), megabytes (m),
31+
// or gigabytes (g).
32+
// Examples: 1024, 8k, 1m.
33+
//
34+
// +kubebuilder:validation:Pattern=`^\d{1,4}(k|m|g)?$`
35+
type Size string

config/crd/bases/gateway.nginx.org_proxysettingspolicies.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,19 @@ spec:
5959
description: |-
6060
BufferSize sets the size of the buffer used for reading the first part of the response received from
6161
the proxied server. This part usually contains a small response header.
62-
Default: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size
6362
Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size
6463
pattern: ^\d{1,4}(k|m|g)?$
6564
type: string
6665
buffers:
6766
description: |-
6867
Buffers sets the number and size of buffers used for reading a response from the proxied server,
6968
for a single connection.
70-
Default: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers
7169
Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers
7270
properties:
7371
number:
7472
description: Number sets the number of buffers.
7573
format: int32
74+
maximum: 256
7675
minimum: 2
7776
type: integer
7877
size:
@@ -87,7 +86,6 @@ spec:
8786
description: |-
8887
BusyBuffersSize sets the total size of buffers that can be busy sending a response to the client,
8988
while the response is not yet fully read.
90-
Default: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_busy_buffers_size
9189
Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_busy_buffers_size
9290
pattern: ^\d{1,4}(k|m|g)?$
9391
type: string
@@ -135,6 +133,16 @@ spec:
135133
maxItems: 16
136134
minItems: 1
137135
type: array
136+
x-kubernetes-validations:
137+
- message: TargetRefs entries must have kind Gateway, HTTPRoute, or
138+
GRPCRoute
139+
rule: self.all(t, t.kind == 'Gateway' || t.kind == 'HTTPRoute' ||
140+
t.kind == 'GRPCRoute')
141+
- message: TargetRefs entries must have group gateway.networking.k8s.io
142+
rule: self.all(t, t.group == 'gateway.networking.k8s.io')
143+
- message: TargetRefs must be unique
144+
rule: self.all(t1, self.exists_one(t2, t1.group == t2.group && t1.kind
145+
== t2.kind && t1.name == t2.name))
138146
required:
139147
- targetRefs
140148
type: object

deploy/crds.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9397,20 +9397,19 @@ spec:
93979397
description: |-
93989398
BufferSize sets the size of the buffer used for reading the first part of the response received from
93999399
the proxied server. This part usually contains a small response header.
9400-
Default: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size
94019400
Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size
94029401
pattern: ^\d{1,4}(k|m|g)?$
94039402
type: string
94049403
buffers:
94059404
description: |-
94069405
Buffers sets the number and size of buffers used for reading a response from the proxied server,
94079406
for a single connection.
9408-
Default: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers
94099407
Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers
94109408
properties:
94119409
number:
94129410
description: Number sets the number of buffers.
94139411
format: int32
9412+
maximum: 256
94149413
minimum: 2
94159414
type: integer
94169415
size:
@@ -9425,7 +9424,6 @@ spec:
94259424
description: |-
94269425
BusyBuffersSize sets the total size of buffers that can be busy sending a response to the client,
94279426
while the response is not yet fully read.
9428-
Default: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_busy_buffers_size
94299427
Directive: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_busy_buffers_size
94309428
pattern: ^\d{1,4}(k|m|g)?$
94319429
type: string
@@ -9473,6 +9471,16 @@ spec:
94739471
maxItems: 16
94749472
minItems: 1
94759473
type: array
9474+
x-kubernetes-validations:
9475+
- message: TargetRefs entries must have kind Gateway, HTTPRoute, or
9476+
GRPCRoute
9477+
rule: self.all(t, t.kind == 'Gateway' || t.kind == 'HTTPRoute' ||
9478+
t.kind == 'GRPCRoute')
9479+
- message: TargetRefs entries must have group gateway.networking.k8s.io
9480+
rule: self.all(t, t.group == 'gateway.networking.k8s.io')
9481+
- message: TargetRefs must be unique
9482+
rule: self.all(t1, self.exists_one(t2, t1.group == t2.group && t1.kind
9483+
== t2.kind && t1.name == t2.name))
94769484
required:
94779485
- targetRefs
94789486
type: object

0 commit comments

Comments
 (0)