Skip to content

Commit ad10305

Browse files
committed
CP/DP Split: Remove NGINX manager and deployment (#2936)
Removing the nginx runtime manager and deployment container since nginx will live in its own pod managed by agent. Temporarily saving the nginx deployment and service for future use. Updated the control plane liveness probe to return true once it's processed all resources, instead of after it's written config to nginx (since nginx may not be started yet in the future architecture).
1 parent 185e396 commit ad10305

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+720
-6308
lines changed

build/Dockerfile

+5-21
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,20 @@ RUN make build
1111

1212
FROM golang:1.24 AS ca-certs-provider
1313

14-
FROM alpine:3.21 AS capabilizer
15-
RUN apk add --no-cache libcap
16-
17-
FROM capabilizer AS local-capabilizer
18-
COPY ./build/out/gateway /usr/bin/
19-
RUN setcap 'cap_kill=+ep' /usr/bin/gateway
20-
21-
FROM capabilizer AS container-capabilizer
22-
COPY --from=builder /go/src/github.com/nginx/nginx-gateway-fabric/build/out/gateway /usr/bin/
23-
RUN setcap 'cap_kill=+ep' /usr/bin/gateway
24-
25-
FROM capabilizer AS goreleaser-capabilizer
26-
ARG TARGETARCH
27-
COPY dist/gateway_linux_$TARGETARCH*/gateway /usr/bin/
28-
RUN setcap 'cap_kill=+ep' /usr/bin/gateway
29-
3014
FROM scratch AS common
31-
# CA certs are needed for telemetry report and NGINX Plus usage report features, so that
32-
# NGF can verify the server's certificate.
15+
# CA certs are needed for telemetry report so that NGF can verify the server's certificate.
3316
COPY --from=ca-certs-provider --link /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
3417
USER 102:1001
3518
ARG BUILD_AGENT
3619
ENV BUILD_AGENT=${BUILD_AGENT}
3720
ENTRYPOINT [ "/usr/bin/gateway" ]
3821

3922
FROM common AS container
40-
COPY --from=container-capabilizer /usr/bin/gateway /usr/bin/
23+
COPY --from=builder /go/src/github.com/nginxinc/nginx-gateway-fabric/build/out/gateway /usr/bin/
4124

4225
FROM common AS local
43-
COPY --from=local-capabilizer /usr/bin/gateway /usr/bin/
26+
COPY ./build/out/gateway /usr/bin/
4427

4528
FROM common AS goreleaser
46-
COPY --from=goreleaser-capabilizer /usr/bin/gateway /usr/bin/
29+
ARG TARGETARCH
30+
COPY dist/gateway_linux_$TARGETARCH*/gateway /usr/bin/

charts/nginx-gateway-fabric/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
268268
| `nginx.image.tag` | | string | `"edge"` |
269269
| `nginx.lifecycle` | The lifecycle of the nginx container. | object | `{}` |
270270
| `nginx.plus` | Is NGINX Plus image being used | bool | `false` |
271+
| `nginx.securityContext.allowPrivilegeEscalation` | Some environments may need this set to true in order for the control plane to successfully reload NGINX. | bool | `false` |
271272
| `nginx.usage.caSecretName` | The name of the Secret containing the NGINX Instance Manager CA certificate. Must exist in the same namespace that the NGINX Gateway Fabric control plane is running in (default namespace: nginx-gateway). | string | `""` |
272273
| `nginx.usage.clientSSLSecretName` | The name of the Secret containing the client certificate and key for authenticating with NGINX Instance Manager. Must exist in the same namespace that the NGINX Gateway Fabric control plane is running in (default namespace: nginx-gateway). | string | `""` |
273274
| `nginx.usage.endpoint` | The endpoint of the NGINX Plus usage reporting server. Default: product.connect.nginx.com | string | `""` |
@@ -296,7 +297,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
296297
| `nginxGateway.readinessProbe.port` | Port in which the readiness endpoint is exposed. | int | `8081` |
297298
| `nginxGateway.replicaCount` | The number of replicas of the NGINX Gateway Fabric Deployment. | int | `1` |
298299
| `nginxGateway.resources` | The resource requests and/or limits of the nginx-gateway container. | object | `{}` |
299-
| `nginxGateway.securityContext.allowPrivilegeEscalation` | Some environments may need this set to true in order for the control plane to successfully reload NGINX. | bool | `false` |
300+
| `nginxGateway.service.annotations` | The annotations of the NGINX Gateway Fabric control plane service. | object | `{}` |
300301
| `nginxGateway.snippetsFilters.enable` | Enable SnippetsFilters feature. SnippetsFilters allow inserting NGINX configuration into the generated NGINX config for HTTPRoute and GRPCRoute resources. | bool | `false` |
301302
| `nodeSelector` | The nodeSelector of the NGINX Gateway Fabric pod. | object | `{}` |
302303
| `service.annotations` | The annotations of the NGINX Gateway Fabric service. | object | `{}` |

charts/nginx-gateway-fabric/templates/deployment.yaml

-155
Original file line numberDiff line numberDiff line change
@@ -39,43 +39,6 @@ spec:
3939
topologySpreadConstraints:
4040
{{- toYaml .Values.topologySpreadConstraints | nindent 8 }}
4141
{{- end }}
42-
initContainers:
43-
- name: init
44-
image: {{ .Values.nginxGateway.image.repository }}:{{ default .Chart.AppVersion .Values.nginxGateway.image.tag }}
45-
imagePullPolicy: {{ .Values.nginxGateway.image.pullPolicy }}
46-
command:
47-
- /usr/bin/gateway
48-
- initialize
49-
- --source
50-
- /includes/main.conf
51-
{{- if .Values.nginx.plus }}
52-
- --source
53-
- /includes/mgmt.conf
54-
- --nginx-plus
55-
{{- end }}
56-
- --destination
57-
- /etc/nginx/main-includes
58-
env:
59-
- name: POD_UID
60-
valueFrom:
61-
fieldRef:
62-
fieldPath: metadata.uid
63-
securityContext:
64-
seccompProfile:
65-
type: RuntimeDefault
66-
capabilities:
67-
add:
68-
- KILL # Set because the binary has CAP_KILL for the main controller process. Not used by init.
69-
drop:
70-
- ALL
71-
readOnlyRootFilesystem: true
72-
runAsUser: 102
73-
runAsGroup: 1001
74-
volumeMounts:
75-
- name: nginx-includes-bootstrap
76-
mountPath: /includes
77-
- name: nginx-main-includes
78-
mountPath: /etc/nginx/main-includes
7942
containers:
8043
- args:
8144
- static-mode
@@ -177,99 +140,21 @@ spec:
177140
securityContext:
178141
seccompProfile:
179142
type: RuntimeDefault
180-
allowPrivilegeEscalation: {{ .Values.nginxGateway.securityContext.allowPrivilegeEscalation }}
181143
capabilities:
182-
add:
183-
- KILL
184144
drop:
185145
- ALL
186146
readOnlyRootFilesystem: true
187147
runAsUser: 102
188148
runAsGroup: 1001
189-
volumeMounts:
190-
- name: nginx-conf
191-
mountPath: /etc/nginx/conf.d
192-
- name: nginx-stream-conf
193-
mountPath: /etc/nginx/stream-conf.d
194-
- name: nginx-main-includes
195-
mountPath: /etc/nginx/main-includes
196-
- name: nginx-secrets
197-
mountPath: /etc/nginx/secrets
198-
- name: nginx-run
199-
mountPath: /var/run/nginx
200-
- name: nginx-includes
201-
mountPath: /etc/nginx/includes
202149
{{- with .Values.nginxGateway.extraVolumeMounts -}}
203150
{{ toYaml . | nindent 8 }}
204151
{{- end }}
205-
- image: {{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag | default .Chart.AppVersion }}
206-
imagePullPolicy: {{ .Values.nginx.image.pullPolicy }}
207-
name: nginx
208-
{{- if .Values.nginx.lifecycle }}
209-
lifecycle:
210-
{{- toYaml .Values.nginx.lifecycle | nindent 10 }}
211-
{{- end }}
212-
ports:
213-
- containerPort: 80
214-
name: http
215-
- containerPort: 443
216-
name: https
217-
securityContext:
218-
seccompProfile:
219-
type: RuntimeDefault
220-
capabilities:
221-
add:
222-
- NET_BIND_SERVICE
223-
drop:
224-
- ALL
225-
readOnlyRootFilesystem: true
226-
runAsUser: 101
227-
runAsGroup: 1001
228-
volumeMounts:
229-
- name: nginx-conf
230-
mountPath: /etc/nginx/conf.d
231-
- name: nginx-stream-conf
232-
mountPath: /etc/nginx/stream-conf.d
233-
- name: nginx-main-includes
234-
mountPath: /etc/nginx/main-includes
235-
- name: nginx-secrets
236-
mountPath: /etc/nginx/secrets
237-
- name: nginx-run
238-
mountPath: /var/run/nginx
239-
- name: nginx-cache
240-
mountPath: /var/cache/nginx
241-
- name: nginx-includes
242-
mountPath: /etc/nginx/includes
243-
{{- if .Values.nginx.plus }}
244-
- name: nginx-lib
245-
mountPath: /var/lib/nginx/state
246-
{{- if .Values.nginx.usage.secretName }}
247-
- name: nginx-plus-license
248-
mountPath: /etc/nginx/license.jwt
249-
subPath: license.jwt
250-
{{- end }}
251-
{{- if or .Values.nginx.usage.caSecretName .Values.nginx.usage.clientSSLSecretName }}
252-
- name: nginx-plus-usage-certs
253-
mountPath: /etc/nginx/certs-bootstrap/
254-
{{- end }}
255-
{{- end }}
256-
{{- with .Values.nginx.extraVolumeMounts -}}
257-
{{ toYaml . | nindent 8 }}
258-
{{- end }}
259-
{{- if .Values.nginx.debug }}
260-
command:
261-
- "/bin/sh"
262-
args:
263-
- "-c"
264-
- "rm -rf /var/run/nginx/*.sock && nginx-debug -g 'daemon off;'"
265-
{{- end }}
266152
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
267153
{{- if .Values.affinity }}
268154
affinity:
269155
{{- toYaml .Values.affinity | nindent 8 }}
270156
{{- end }}
271157
serviceAccountName: {{ include "nginx-gateway.serviceAccountName" . }}
272-
shareProcessNamespace: true
273158
securityContext:
274159
fsGroup: 1001
275160
runAsNonRoot: true
@@ -281,46 +166,6 @@ spec:
281166
nodeSelector:
282167
{{- toYaml .Values.nodeSelector | nindent 8 }}
283168
{{- end }}
284-
volumes:
285-
- name: nginx-conf
286-
emptyDir: {}
287-
- name: nginx-stream-conf
288-
emptyDir: {}
289-
- name: nginx-main-includes
290-
emptyDir: {}
291-
- name: nginx-secrets
292-
emptyDir: {}
293-
- name: nginx-run
294-
emptyDir: {}
295-
- name: nginx-cache
296-
emptyDir: {}
297-
- name: nginx-includes
298-
emptyDir: {}
299-
- name: nginx-includes-bootstrap
300-
configMap:
301-
name: nginx-includes-bootstrap
302-
{{- if .Values.nginx.plus }}
303-
- name: nginx-lib
304-
emptyDir: {}
305-
{{- if .Values.nginx.usage.secretName }}
306-
- name: nginx-plus-license
307-
secret:
308-
secretName: {{ .Values.nginx.usage.secretName }}
309-
{{- end }}
310-
{{- if or .Values.nginx.usage.caSecretName .Values.nginx.usage.clientSSLSecretName }}
311-
- name: nginx-plus-usage-certs
312-
projected:
313-
sources:
314-
{{- if .Values.nginx.usage.caSecretName }}
315-
- secret:
316-
name: {{ .Values.nginx.usage.caSecretName }}
317-
{{- end }}
318-
{{- if .Values.nginx.usage.clientSSLSecretName }}
319-
- secret:
320-
name: {{ .Values.nginx.usage.clientSSLSecretName }}
321-
{{- end }}
322-
{{- end }}
323-
{{- end }}
324169
{{- with .Values.extraVolumes -}}
325170
{{ toYaml . | nindent 6 }}
326171
{{- end }}

charts/nginx-gateway-fabric/templates/scc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: SecurityContextConstraints
33
apiVersion: security.openshift.io/v1
44
metadata:
55
name: {{ include "nginx-gateway.scc-name" . }}
6-
allowPrivilegeEscalation: {{ .Values.nginxGateway.securityContext.allowPrivilegeEscalation }}
6+
allowPrivilegeEscalation: {{ .Values.nginx.securityContext.allowPrivilegeEscalation }}
77
allowHostDirVolumePlugin: false
88
allowHostIPC: false
99
allowHostNetwork: false
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
1-
{{- if .Values.service.create }}
21
apiVersion: v1
32
kind: Service
43
metadata:
54
name: {{ include "nginx-gateway.fullname" . }}
65
namespace: {{ .Release.Namespace }}
76
labels:
87
{{- include "nginx-gateway.labels" . | nindent 4 }}
9-
{{- if .Values.service.annotations }}
8+
{{- if .Values.nginxGateway.service.annotations }}
109
annotations:
11-
{{ toYaml .Values.service.annotations | indent 4 }}
10+
{{ toYaml .Values.nginxGateway.service.annotations | indent 4 }}
1211
{{- end }}
1312
spec:
14-
{{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") }}
15-
{{- if .Values.service.externalTrafficPolicy }}
16-
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
17-
{{- end }}
18-
{{- end }}
19-
type: {{ .Values.service.type }}
20-
{{- if eq .Values.service.type "LoadBalancer" }}
21-
{{- if .Values.service.loadBalancerIP }}
22-
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
23-
{{- end }}
24-
{{- if .Values.service.loadBalancerSourceRanges }}
25-
loadBalancerSourceRanges:
26-
{{ toYaml .Values.service.loadBalancerSourceRanges | nindent 2 }}
27-
{{- end }}
28-
{{- end}}
13+
type: ClusterIP
2914
selector:
3015
{{- include "nginx-gateway.selectorLabels" . | nindent 4 }}
31-
ports: # Update the following ports to match your Gateway Listener ports
32-
{{- if .Values.service.ports }}
33-
{{ toYaml .Values.service.ports | indent 2 }}
34-
{{ end }}
35-
{{- end }}
16+
ports:
17+
- name: grpc
18+
port: 443
19+
protocol: TCP
20+
targetPort: 443

0 commit comments

Comments
 (0)