Skip to content

Commit 4eeea49

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 833a608 commit 4eeea49

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

+721
-6309
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.23 AS ca-certs-provider
1313

14-
FROM alpine:3.20 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 | `""` |
@@ -295,7 +296,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
295296
| `nginxGateway.readinessProbe.port` | Port in which the readiness endpoint is exposed. | int | `8081` |
296297
| `nginxGateway.replicaCount` | The number of replicas of the NGINX Gateway Fabric Deployment. | int | `1` |
297298
| `nginxGateway.resources` | The resource requests and/or limits of the nginx-gateway container. | object | `{}` |
298-
| `nginxGateway.securityContext.allowPrivilegeEscalation` | Some environments may need this set to true in order for the control plane to successfully reload NGINX. | bool | `false` |
299+
| `nginxGateway.service.annotations` | The annotations of the NGINX Gateway Fabric control plane service. | object | `{}` |
299300
| `nginxGateway.snippetsFilters.enable` | Enable SnippetsFilters feature. SnippetsFilters allow inserting NGINX configuration into the generated NGINX config for HTTPRoute and GRPCRoute resources. | bool | `false` |
300301
| `nodeSelector` | The nodeSelector of the NGINX Gateway Fabric pod. | object | `{}` |
301302
| `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
@@ -33,43 +33,6 @@ spec:
3333
topologySpreadConstraints:
3434
{{- toYaml .Values.topologySpreadConstraints | nindent 8 }}
3535
{{- end }}
36-
initContainers:
37-
- name: init
38-
image: {{ .Values.nginxGateway.image.repository }}:{{ default .Chart.AppVersion .Values.nginxGateway.image.tag }}
39-
imagePullPolicy: {{ .Values.nginxGateway.image.pullPolicy }}
40-
command:
41-
- /usr/bin/gateway
42-
- initialize
43-
- --source
44-
- /includes/main.conf
45-
{{- if .Values.nginx.plus }}
46-
- --source
47-
- /includes/mgmt.conf
48-
- --nginx-plus
49-
{{- end }}
50-
- --destination
51-
- /etc/nginx/main-includes
52-
env:
53-
- name: POD_UID
54-
valueFrom:
55-
fieldRef:
56-
fieldPath: metadata.uid
57-
securityContext:
58-
seccompProfile:
59-
type: RuntimeDefault
60-
capabilities:
61-
add:
62-
- KILL # Set because the binary has CAP_KILL for the main controller process. Not used by init.
63-
drop:
64-
- ALL
65-
readOnlyRootFilesystem: true
66-
runAsUser: 102
67-
runAsGroup: 1001
68-
volumeMounts:
69-
- name: nginx-includes-bootstrap
70-
mountPath: /includes
71-
- name: nginx-main-includes
72-
mountPath: /etc/nginx/main-includes
7336
containers:
7437
- args:
7538
- static-mode
@@ -171,99 +134,21 @@ spec:
171134
securityContext:
172135
seccompProfile:
173136
type: RuntimeDefault
174-
allowPrivilegeEscalation: {{ .Values.nginxGateway.securityContext.allowPrivilegeEscalation }}
175137
capabilities:
176-
add:
177-
- KILL
178138
drop:
179139
- ALL
180140
readOnlyRootFilesystem: true
181141
runAsUser: 102
182142
runAsGroup: 1001
183-
volumeMounts:
184-
- name: nginx-conf
185-
mountPath: /etc/nginx/conf.d
186-
- name: nginx-stream-conf
187-
mountPath: /etc/nginx/stream-conf.d
188-
- name: nginx-main-includes
189-
mountPath: /etc/nginx/main-includes
190-
- name: nginx-secrets
191-
mountPath: /etc/nginx/secrets
192-
- name: nginx-run
193-
mountPath: /var/run/nginx
194-
- name: nginx-includes
195-
mountPath: /etc/nginx/includes
196143
{{- with .Values.nginxGateway.extraVolumeMounts -}}
197144
{{ toYaml . | nindent 8 }}
198145
{{- end }}
199-
- image: {{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag | default .Chart.AppVersion }}
200-
imagePullPolicy: {{ .Values.nginx.image.pullPolicy }}
201-
name: nginx
202-
{{- if .Values.nginx.lifecycle }}
203-
lifecycle:
204-
{{- toYaml .Values.nginx.lifecycle | nindent 10 }}
205-
{{- end }}
206-
ports:
207-
- containerPort: 80
208-
name: http
209-
- containerPort: 443
210-
name: https
211-
securityContext:
212-
seccompProfile:
213-
type: RuntimeDefault
214-
capabilities:
215-
add:
216-
- NET_BIND_SERVICE
217-
drop:
218-
- ALL
219-
readOnlyRootFilesystem: true
220-
runAsUser: 101
221-
runAsGroup: 1001
222-
volumeMounts:
223-
- name: nginx-conf
224-
mountPath: /etc/nginx/conf.d
225-
- name: nginx-stream-conf
226-
mountPath: /etc/nginx/stream-conf.d
227-
- name: nginx-main-includes
228-
mountPath: /etc/nginx/main-includes
229-
- name: nginx-secrets
230-
mountPath: /etc/nginx/secrets
231-
- name: nginx-run
232-
mountPath: /var/run/nginx
233-
- name: nginx-cache
234-
mountPath: /var/cache/nginx
235-
- name: nginx-includes
236-
mountPath: /etc/nginx/includes
237-
{{- if .Values.nginx.plus }}
238-
- name: nginx-lib
239-
mountPath: /var/lib/nginx/state
240-
{{- if .Values.nginx.usage.secretName }}
241-
- name: nginx-plus-license
242-
mountPath: /etc/nginx/license.jwt
243-
subPath: license.jwt
244-
{{- end }}
245-
{{- if or .Values.nginx.usage.caSecretName .Values.nginx.usage.clientSSLSecretName }}
246-
- name: nginx-plus-usage-certs
247-
mountPath: /etc/nginx/certs-bootstrap/
248-
{{- end }}
249-
{{- end }}
250-
{{- with .Values.nginx.extraVolumeMounts -}}
251-
{{ toYaml . | nindent 8 }}
252-
{{- end }}
253-
{{- if .Values.nginx.debug }}
254-
command:
255-
- "/bin/sh"
256-
args:
257-
- "-c"
258-
- "rm -rf /var/run/nginx/*.sock && nginx-debug -g 'daemon off;'"
259-
{{- end }}
260146
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
261147
{{- if .Values.affinity }}
262148
affinity:
263149
{{- toYaml .Values.affinity | nindent 8 }}
264150
{{- end }}
265151
serviceAccountName: {{ include "nginx-gateway.serviceAccountName" . }}
266-
shareProcessNamespace: true
267152
securityContext:
268153
fsGroup: 1001
269154
runAsNonRoot: true
@@ -275,46 +160,6 @@ spec:
275160
nodeSelector:
276161
{{- toYaml .Values.nodeSelector | nindent 8 }}
277162
{{- end }}
278-
volumes:
279-
- name: nginx-conf
280-
emptyDir: {}
281-
- name: nginx-stream-conf
282-
emptyDir: {}
283-
- name: nginx-main-includes
284-
emptyDir: {}
285-
- name: nginx-secrets
286-
emptyDir: {}
287-
- name: nginx-run
288-
emptyDir: {}
289-
- name: nginx-cache
290-
emptyDir: {}
291-
- name: nginx-includes
292-
emptyDir: {}
293-
- name: nginx-includes-bootstrap
294-
configMap:
295-
name: nginx-includes-bootstrap
296-
{{- if .Values.nginx.plus }}
297-
- name: nginx-lib
298-
emptyDir: {}
299-
{{- if .Values.nginx.usage.secretName }}
300-
- name: nginx-plus-license
301-
secret:
302-
secretName: {{ .Values.nginx.usage.secretName }}
303-
{{- end }}
304-
{{- if or .Values.nginx.usage.caSecretName .Values.nginx.usage.clientSSLSecretName }}
305-
- name: nginx-plus-usage-certs
306-
projected:
307-
sources:
308-
{{- if .Values.nginx.usage.caSecretName }}
309-
- secret:
310-
name: {{ .Values.nginx.usage.caSecretName }}
311-
{{- end }}
312-
{{- if .Values.nginx.usage.clientSSLSecretName }}
313-
- secret:
314-
name: {{ .Values.nginx.usage.clientSSLSecretName }}
315-
{{- end }}
316-
{{- end }}
317-
{{- end }}
318163
{{- with .Values.extraVolumes -}}
319164
{{ toYaml . | nindent 6 }}
320165
{{- 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)