Skip to content

Commit 72d840b

Browse files
committed
fix CRD and unit tests
1 parent e7f3cca commit 72d840b

File tree

22 files changed

+349
-82
lines changed

22 files changed

+349
-82
lines changed

apis/v1alpha1/nginxproxy_types.go

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,25 +124,38 @@ type TelemetryExporter struct {
124124
// RewriteClientIP specifies the configuration for rewriting the client's IP address.
125125
type RewriteClientIP struct {
126126
// Mode defines how NGINX will rewrite the client's IP address.
127-
// Possible modes: ProxyProtocol, XForwardedFor.
127+
// There are two possible modes:
128+
// - ProxyProtocol: NGINX will rewrite the client's IP using the PROXY protocol header.
129+
// - XForwardedFor: NGINX will rewrite the client's IP using the X-Forwarded-For header.
130+
// Sets NGINX directive real_ip_header: https://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_header
128131
//
129132
// +optional
130133
Mode *RewriteClientIPModeType `json:"mode,omitempty"`
131134

132-
// SetIPRecursively configures whether recursive search is used for selecting client's
133-
// address from the X-Forwarded-For header and used in conjunction with TrustedAddresses.
134-
// If enabled, NGINX will recurse on the values in X-Forwarded-Header from the end of
135-
// array to start of array and select the first untrusted IP.
135+
// SetIPRecursively configures whether recursive search is used when selecting the client's address from.
136+
// the X-Forwarded-For header. It is used in conjunction with TrustedAddresses.
137+
// If enabled, NGINX will recurse on the values in X-Forwarded-Header from the end of array
138+
// to start of array and select the first untrusted IP.
139+
// For example, if X-Forwarded-For is [11.11.11.11, 22.22.22.22, 55.55.55.1],
140+
// and TrustedAddresses is set to 55.55.55.1/0, NGINX will rewrite the client IP to 22.22.22.22.
141+
// If disabled, NGINX will select the IP at the end of the array.
142+
// In the previous example, 55.55.55.1 would be selected.
143+
// Sets NGINX directive real_ip_recursive: https://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_recursive
136144
//
137145
// +optional
138146
SetIPRecursively *bool `json:"setIPRecursively,omitempty"`
139147

140148
// TrustedAddresses specifies the addresses that are trusted to send correct client IP information.
141149
// If a request comes from a trusted address, NGINX will rewrite the client IP information,
142150
// and forward it to the backend in the X-Forwarded-For* and X-Real-IP headers.
151+
// If the request does not come from a trusted address, NGINX will not rewrite the client IP information.
152+
// Addresses must be provided as CIDR blocks: 10.0.0.0/32, 192.33.21/0.
153+
// To trust all addresses (not recommended), set to 0.0.0.0/0.
154+
// If no addresses are provided, NGINX will not rewrite the client IP information.
155+
// Sets NGINX directive set_real_ip_from: https://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
143156
// This field is required if mode is set.
144157
// +kubebuilder:validation:MaxItems=16
145-
// +listType=atomic
158+
// +listType=set
146159
//
147160
//
148161
// +optional

charts/nginx-gateway-fabric/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
263263
| `nginx.config` | The configuration for the data plane that is contained in the NginxProxy resource. | object | `{}` |
264264
| `nginx.extraVolumeMounts` | extraVolumeMounts are the additional volume mounts for the nginx container. | list | `[]` |
265265
| `nginx.image.pullPolicy` | | string | `"Always"` |
266-
| `nginx.image.repository` | The NGINX image to use. | string | `"gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric/nginx"` |
267-
| `nginx.image.tag` | | string | `"sa.choudhary"` |
266+
| `nginx.image.repository` | The NGINX image to use. | string | `"ghcr.io/nginxinc/nginx-gateway-fabric/nginx"` |
267+
| `nginx.image.tag` | | string | `"edge"` |
268268
| `nginx.lifecycle` | The lifecycle of the nginx container. | object | `{}` |
269269
| `nginx.plus` | Is NGINX Plus image being used | bool | `false` |
270270
| `nginx.usage.clusterName` | The display name of the Kubernetes cluster in the NGINX Plus usage reporting server. | string | `""` |
@@ -279,8 +279,8 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
279279
| `nginxGateway.gatewayControllerName` | The name of the Gateway controller. The controller name must be of the form: DOMAIN/PATH. The controller's domain is gateway.nginx.org. | string | `"gateway.nginx.org/nginx-gateway-controller"` |
280280
| `nginxGateway.gwAPIExperimentalFeatures.enable` | Enable the experimental features of Gateway API which are supported by NGINX Gateway Fabric. Requires the Gateway APIs installed from the experimental channel. | bool | `false` |
281281
| `nginxGateway.image.pullPolicy` | | string | `"Always"` |
282-
| `nginxGateway.image.repository` | The NGINX Gateway Fabric image to use | string | `"gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric"` |
283-
| `nginxGateway.image.tag` | | string | `"sa.choudhary"` |
282+
| `nginxGateway.image.repository` | The NGINX Gateway Fabric image to use | string | `"ghcr.io/nginxinc/nginx-gateway-fabric"` |
283+
| `nginxGateway.image.tag` | | string | `"edge"` |
284284
| `nginxGateway.kind` | The kind of the NGINX Gateway Fabric installation - currently, only deployment is supported. | string | `"deployment"` |
285285
| `nginxGateway.leaderElection.enable` | Enable leader election. Leader election is used to avoid multiple replicas of the NGINX Gateway Fabric reporting the status of the Gateway API resources. If not enabled, all replicas of NGINX Gateway Fabric will update the statuses of the Gateway API resources. | bool | `true` |
286286
| `nginxGateway.leaderElection.lockName` | The name of the leader election lock. A Lease object with this name will be created in the same Namespace as the controller. | string | Autogenerated if not set or set to "". |

charts/nginx-gateway-fabric/values.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ nginxGateway:
5252

5353
image:
5454
# -- The NGINX Gateway Fabric image to use
55-
repository: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric
56-
tag: sa.choudhary
55+
repository: ghcr.io/nginxinc/nginx-gateway-fabric
56+
tag: edge
5757
pullPolicy: Always
5858

5959
securityContext:
@@ -81,8 +81,8 @@ nginxGateway:
8181
nginx:
8282
image:
8383
# -- The NGINX image to use.
84-
repository: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric/nginx
85-
tag: sa.choudhary
84+
repository: ghcr.io/nginxinc/nginx-gateway-fabric/nginx
85+
tag: edge
8686
pullPolicy: Always
8787

8888
# -- Is NGINX Plus image being used
@@ -95,7 +95,8 @@ nginx:
9595
# ipFamily: dual
9696
# rewriteClientIP:
9797
# mode: "ProxyProtocol"
98-
# trustedAddresses: ["0.0.0.0/0"]
98+
# # -- The trusted addresses field needs to be replaced with the load balancer's IP address.
99+
# trustedAddresses: []
99100
# setIPRecursively: true
100101
# telemetry:
101102
# exporter:

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,36 @@ spec:
6969
mode:
7070
description: |-
7171
Mode defines how NGINX will rewrite the client's IP address.
72-
Possible modes: ProxyProtocol, XForwardedFor.
72+
There are two possible modes:
73+
- ProxyProtocol: NGINX will rewrite the client's IP using the PROXY protocol header.
74+
- XForwardedFor: NGINX will rewrite the client's IP using the X-Forwarded-For header.
75+
Sets NGINX directive real_ip_header: https://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_header
7376
enum:
7477
- ProxyProtocol
7578
- XForwardedFor
7679
type: string
7780
setIPRecursively:
7881
description: |-
79-
SetIPRecursively configures whether recursive search is used for selecting client's
80-
address from the X-Forwarded-For header and used in conjunction with TrustedAddresses.
81-
If enabled, NGINX will recurse on the values in X-Forwarded-Header from the end of
82-
array to start of array and select the first untrusted IP.
82+
SetIPRecursively configures whether recursive search is used when selecting the client's address from.
83+
the X-Forwarded-For header. It is used in conjunction with TrustedAddresses.
84+
If enabled, NGINX will recurse on the values in X-Forwarded-Header from the end of array
85+
to start of array and select the first untrusted IP.
86+
For example, if X-Forwarded-For is [11.11.11.11, 22.22.22.22, 55.55.55.1],
87+
and TrustedAddresses is set to 55.55.55.1/0, NGINX will rewrite the client IP to 22.22.22.22.
88+
If disabled, NGINX will select the IP at the end of the array.
89+
In the previous example, 55.55.55.1 would be selected.
90+
Sets NGINX directive real_ip_recursive: https://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_recursive
8391
type: boolean
8492
trustedAddresses:
8593
description: |-
8694
TrustedAddresses specifies the addresses that are trusted to send correct client IP information.
8795
If a request comes from a trusted address, NGINX will rewrite the client IP information,
8896
and forward it to the backend in the X-Forwarded-For* and X-Real-IP headers.
97+
If the request does not come from a trusted address, NGINX will not rewrite the client IP information.
98+
Addresses must be provided as CIDR blocks: 10.0.0.0/32, 192.33.21/0.
99+
To trust all addresses (not recommended), set to 0.0.0.0/0.
100+
If no addresses are provided, NGINX will not rewrite the client IP information.
101+
Sets NGINX directive set_real_ip_from: https://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
89102
This field is required if mode is set.
90103
items:
91104
description: |-
@@ -95,7 +108,7 @@ spec:
95108
type: string
96109
maxItems: 16
97110
type: array
98-
x-kubernetes-list-type: atomic
111+
x-kubernetes-list-type: set
99112
type: object
100113
x-kubernetes-validations:
101114
- message: if mode is set, trustedAddresses is a required field

config/tests/static-deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ spec:
4545
valueFrom:
4646
fieldRef:
4747
fieldPath: metadata.name
48-
image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric:sa.choudhary
48+
image: ghcr.io/nginxinc/nginx-gateway-fabric:edge
4949
imagePullPolicy: Always
5050
name: nginx-gateway
5151
ports:
@@ -82,7 +82,7 @@ spec:
8282
mountPath: /var/run/nginx
8383
- name: nginx-includes
8484
mountPath: /etc/nginx/includes
85-
- image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric/nginx:sa.choudhary
85+
- image: ghcr.io/nginxinc/nginx-gateway-fabric/nginx:edge
8686
imagePullPolicy: Always
8787
name: nginx
8888
ports:

deploy/aws-nlb/deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ spec:
217217
valueFrom:
218218
fieldRef:
219219
fieldPath: metadata.name
220-
image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric:sa.choudhary
220+
image: ghcr.io/nginxinc/nginx-gateway-fabric:edge
221221
imagePullPolicy: Always
222222
name: nginx-gateway
223223
ports:
@@ -256,7 +256,7 @@ spec:
256256
name: nginx-run
257257
- mountPath: /etc/nginx/includes
258258
name: nginx-includes
259-
- image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric/nginx:sa.choudhary
259+
- image: ghcr.io/nginxinc/nginx-gateway-fabric/nginx:edge
260260
imagePullPolicy: Always
261261
name: nginx
262262
ports:

deploy/azure/deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ spec:
214214
valueFrom:
215215
fieldRef:
216216
fieldPath: metadata.name
217-
image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric:sa.choudhary
217+
image: ghcr.io/nginxinc/nginx-gateway-fabric:edge
218218
imagePullPolicy: Always
219219
name: nginx-gateway
220220
ports:
@@ -253,7 +253,7 @@ spec:
253253
name: nginx-run
254254
- mountPath: /etc/nginx/includes
255255
name: nginx-includes
256-
- image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric/nginx:sa.choudhary
256+
- image: ghcr.io/nginxinc/nginx-gateway-fabric/nginx:edge
257257
imagePullPolicy: Always
258258
name: nginx
259259
ports:

deploy/crds.yaml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -654,23 +654,36 @@ spec:
654654
mode:
655655
description: |-
656656
Mode defines how NGINX will rewrite the client's IP address.
657-
Possible modes: ProxyProtocol, XForwardedFor.
657+
There are two possible modes:
658+
- ProxyProtocol: NGINX will rewrite the client's IP using the PROXY protocol header.
659+
- XForwardedFor: NGINX will rewrite the client's IP using the X-Forwarded-For header.
660+
Sets NGINX directive real_ip_header: https://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_header
658661
enum:
659662
- ProxyProtocol
660663
- XForwardedFor
661664
type: string
662665
setIPRecursively:
663666
description: |-
664-
SetIPRecursively configures whether recursive search is used for selecting client's
665-
address from the X-Forwarded-For header and used in conjunction with TrustedAddresses.
666-
If enabled, NGINX will recurse on the values in X-Forwarded-Header from the end of
667-
array to start of array and select the first untrusted IP.
667+
SetIPRecursively configures whether recursive search is used when selecting the client's address from.
668+
the X-Forwarded-For header. It is used in conjunction with TrustedAddresses.
669+
If enabled, NGINX will recurse on the values in X-Forwarded-Header from the end of array
670+
to start of array and select the first untrusted IP.
671+
For example, if X-Forwarded-For is [11.11.11.11, 22.22.22.22, 55.55.55.1],
672+
and TrustedAddresses is set to 55.55.55.1/0, NGINX will rewrite the client IP to 22.22.22.22.
673+
If disabled, NGINX will select the IP at the end of the array.
674+
In the previous example, 55.55.55.1 would be selected.
675+
Sets NGINX directive real_ip_recursive: https://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_recursive
668676
type: boolean
669677
trustedAddresses:
670678
description: |-
671679
TrustedAddresses specifies the addresses that are trusted to send correct client IP information.
672680
If a request comes from a trusted address, NGINX will rewrite the client IP information,
673681
and forward it to the backend in the X-Forwarded-For* and X-Real-IP headers.
682+
If the request does not come from a trusted address, NGINX will not rewrite the client IP information.
683+
Addresses must be provided as CIDR blocks: 10.0.0.0/32, 192.33.21/0.
684+
To trust all addresses (not recommended), set to 0.0.0.0/0.
685+
If no addresses are provided, NGINX will not rewrite the client IP information.
686+
Sets NGINX directive set_real_ip_from: https://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
674687
This field is required if mode is set.
675688
items:
676689
description: |-
@@ -680,7 +693,7 @@ spec:
680693
type: string
681694
maxItems: 16
682695
type: array
683-
x-kubernetes-list-type: atomic
696+
x-kubernetes-list-type: set
684697
type: object
685698
x-kubernetes-validations:
686699
- message: if mode is set, trustedAddresses is a required field

deploy/default/deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ spec:
214214
valueFrom:
215215
fieldRef:
216216
fieldPath: metadata.name
217-
image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric:sa.choudhary
217+
image: ghcr.io/nginxinc/nginx-gateway-fabric:edge
218218
imagePullPolicy: Always
219219
name: nginx-gateway
220220
ports:
@@ -253,7 +253,7 @@ spec:
253253
name: nginx-run
254254
- mountPath: /etc/nginx/includes
255255
name: nginx-includes
256-
- image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric/nginx:sa.choudhary
256+
- image: ghcr.io/nginxinc/nginx-gateway-fabric/nginx:edge
257257
imagePullPolicy: Always
258258
name: nginx
259259
ports:

deploy/experimental-nginx-plus/deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ spec:
229229
valueFrom:
230230
fieldRef:
231231
fieldPath: metadata.name
232-
image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric:sa.choudhary
232+
image: ghcr.io/nginxinc/nginx-gateway-fabric:edge
233233
imagePullPolicy: Always
234234
name: nginx-gateway
235235
ports:
@@ -268,7 +268,7 @@ spec:
268268
name: nginx-run
269269
- mountPath: /etc/nginx/includes
270270
name: nginx-includes
271-
- image: private-registry.nginx.com/nginx-gateway-fabric/nginx-plus:sa.choudhary
271+
- image: private-registry.nginx.com/nginx-gateway-fabric/nginx-plus:edge
272272
imagePullPolicy: Always
273273
name: nginx
274274
ports:

deploy/experimental/deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ spec:
220220
valueFrom:
221221
fieldRef:
222222
fieldPath: metadata.name
223-
image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric:sa.choudhary
223+
image: ghcr.io/nginxinc/nginx-gateway-fabric:edge
224224
imagePullPolicy: Always
225225
name: nginx-gateway
226226
ports:
@@ -259,7 +259,7 @@ spec:
259259
name: nginx-run
260260
- mountPath: /etc/nginx/includes
261261
name: nginx-includes
262-
- image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric/nginx:sa.choudhary
262+
- image: ghcr.io/nginxinc/nginx-gateway-fabric/nginx:edge
263263
imagePullPolicy: Always
264264
name: nginx
265265
ports:

deploy/nginx-plus/deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ spec:
225225
valueFrom:
226226
fieldRef:
227227
fieldPath: metadata.name
228-
image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric:sa.choudhary
228+
image: ghcr.io/nginxinc/nginx-gateway-fabric:edge
229229
imagePullPolicy: Always
230230
name: nginx-gateway
231231
ports:
@@ -264,7 +264,7 @@ spec:
264264
name: nginx-run
265265
- mountPath: /etc/nginx/includes
266266
name: nginx-includes
267-
- image: private-registry.nginx.com/nginx-gateway-fabric/nginx-plus:sa.choudhary
267+
- image: private-registry.nginx.com/nginx-gateway-fabric/nginx-plus:edge
268268
imagePullPolicy: Always
269269
name: nginx
270270
ports:

deploy/nodeport/deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ spec:
214214
valueFrom:
215215
fieldRef:
216216
fieldPath: metadata.name
217-
image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric:sa.choudhary
217+
image: ghcr.io/nginxinc/nginx-gateway-fabric:edge
218218
imagePullPolicy: Always
219219
name: nginx-gateway
220220
ports:
@@ -253,7 +253,7 @@ spec:
253253
name: nginx-run
254254
- mountPath: /etc/nginx/includes
255255
name: nginx-includes
256-
- image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric/nginx:sa.choudhary
256+
- image: ghcr.io/nginxinc/nginx-gateway-fabric/nginx:edge
257257
imagePullPolicy: Always
258258
name: nginx
259259
ports:

deploy/openshift/deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ spec:
222222
valueFrom:
223223
fieldRef:
224224
fieldPath: metadata.name
225-
image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric:sa.choudhary
225+
image: ghcr.io/nginxinc/nginx-gateway-fabric:edge
226226
imagePullPolicy: Always
227227
name: nginx-gateway
228228
ports:
@@ -261,7 +261,7 @@ spec:
261261
name: nginx-run
262262
- mountPath: /etc/nginx/includes
263263
name: nginx-includes
264-
- image: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nginx-gateway-fabric/nginx:sa.choudhary
264+
- image: ghcr.io/nginxinc/nginx-gateway-fabric/nginx:edge
265265
imagePullPolicy: Always
266266
name: nginx
267267
ports:

0 commit comments

Comments
 (0)