Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow NGF to run on Openshift #1976

Merged
merged 34 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
09fac66
Add SCC and inclusion of openshift on helm chart
bjee19 May 9, 2024
622e4c6
Adjust scc range values
bjee19 May 9, 2024
3503fdc
Fix rbac spacing
bjee19 May 14, 2024
8362f28
Add Openshift Permissions Reference document
bjee19 May 15, 2024
68f1a20
Add Openshift Permissions installaiton guide
bjee19 May 15, 2024
ada3ae0
Adjust wording of SCC
bjee19 May 15, 2024
9c6e578
Change helm template from onOpenshift to platform
bjee19 May 15, 2024
2592c87
Change helm template from onOpenshift to platform
bjee19 May 15, 2024
0c14d2c
Add allowPrivilegeEscalation
bjee19 May 16, 2024
9727a3b
Remove unnecessary false boolean fields in SCC
bjee19 May 16, 2024
a36ca2c
Add Helm templating for SCC
bjee19 May 16, 2024
356c951
Remove openshift permissions document
bjee19 May 16, 2024
b3b8fc2
Add back required SCC fields
bjee19 May 16, 2024
fa42453
Add platform openshift to upgrade commands too
bjee19 May 16, 2024
580cec8
Add sccName value to rbac template
bjee19 May 17, 2024
892d48a
Add scc name to helpers template file
bjee19 May 17, 2024
517ac81
Remove sccName from values file
bjee19 May 17, 2024
202c0c9
Add createOpenShiftSCC flag
bjee19 May 17, 2024
083972a
Add openshift manifests and helm template generation
bjee19 May 17, 2024
d32061d
Remove unnecessary scc manifest
bjee19 May 17, 2024
9b17360
Add installation through manifests on openshift document
bjee19 May 20, 2024
8834573
Add grpc routes changes from main
bjee19 May 20, 2024
228de49
Remove running on openshift document
bjee19 May 20, 2024
f8f97c9
Add openshift to file names and add files to goreleaser
bjee19 May 22, 2024
48a7e1c
Add Helm template checker for Openshift platform and remove fields in…
bjee19 May 23, 2024
ad6dacc
Remove openshift specific manifests
bjee19 May 23, 2024
540552b
Update scc users template to use release namespace and SA name
bjee19 May 23, 2024
2515c22
Add scc.yaml manifest
bjee19 May 23, 2024
2e2153f
Remove Openshift manifest specific document
bjee19 May 23, 2024
2238762
Remove comment on installation in helm installation guide
bjee19 May 23, 2024
03c8be5
Add more details on installation through manifests
bjee19 May 24, 2024
bda54b7
Change SCC link to version 1.2.0
bjee19 May 24, 2024
2573e90
Fix Openshift to OpenShift
bjee19 May 28, 2024
0dcc8b6
Fix rebase issue
bjee19 May 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ generate-manifests: ## Generate manifests using Helm.
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) -n nginx-gateway -s templates/service.yaml > $(strip $(MANIFEST_DIR))/service/loadbalancer.yaml
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) --set service.annotations.'service\.beta\.kubernetes\.io\/aws-load-balancer-type'="nlb" -n nginx-gateway -s templates/service.yaml > $(strip $(MANIFEST_DIR))/service/loadbalancer-aws-nlb.yaml
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) --set service.type=NodePort --set service.externalTrafficPolicy="" -n nginx-gateway -s templates/service.yaml > $(strip $(MANIFEST_DIR))/service/nodeport.yaml
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) $(HELM_TEMPLATE_EXTRA_ARGS_FOR_ALL_MANIFESTS_FILE) -n nginx-gateway --api-versions security.openshift.io/v1/SecurityContextConstraints -s templates/scc.yaml > $(strip $(MANIFEST_DIR))/scc.yaml

.PHONY: clean
clean: ## Clean the build
Expand Down
8 changes: 8 additions & 0 deletions charts/nginx-gateway-fabric/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ Create data plane config name.
{{- printf "%s-proxy-config" $name | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create security context constraints name.
*/}}
{{- define "nginx-gateway.scc-name" -}}
{{- $name := default .Release.Name .Values.nameOverride }}
{{- printf "%s-scc" $name | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
Expand Down
10 changes: 10 additions & 0 deletions charts/nginx-gateway-fabric/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ rules:
verbs:
- list
- watch
{{- if .Capabilities.APIVersions.Has "security.openshift.io/v1/SecurityContextConstraints" }}
- apiGroups:
- security.openshift.io
resources:
- securitycontextconstraints
resourceNames:
- {{ include "nginx-gateway.scc-name" . }}
verbs:
- use
{{- end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
40 changes: 40 additions & 0 deletions charts/nginx-gateway-fabric/templates/scc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{- if .Capabilities.APIVersions.Has "security.openshift.io/v1/SecurityContextConstraints" }}
kind: SecurityContextConstraints
apiVersion: security.openshift.io/v1
metadata:
name: {{ include "nginx-gateway.scc-name" . }}
allowPrivilegeEscalation: {{ .Values.nginxGateway.securityContext.allowPrivilegeEscalation }}
allowHostDirVolumePlugin: false
allowHostIPC: false
allowHostNetwork: false
allowHostPID: false
allowHostPorts: false
allowPrivilegedContainer: false
readOnlyRootFilesystem: true
runAsUser:
type: MustRunAsRange
uidRangeMin: 101
uidRangeMax: 102
fsGroup:
type: MustRunAs
ranges:
- min: 1001
max: 1001
supplementalGroups:
type: MustRunAs
ranges:
- min: 1001
max: 1001
seLinuxContext:
type: MustRunAs
volumes:
- emptyDir
- secret
pleshakov marked this conversation as resolved.
Show resolved Hide resolved
users:
- {{ printf "system:serviceaccount:%s:%s" .Release.Namespace (include "nginx-gateway.serviceAccountName" .) }}
allowedCapabilities:
- NET_BIND_SERVICE
- KILL
requiredDropCapabilities:
- ALL
{{- end }}
2 changes: 1 addition & 1 deletion charts/nginx-gateway-fabric/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ terminationGracePeriodSeconds: 30
## Tolerations for the NGINX Gateway Fabric pod.
tolerations: []

## The nodeSelector of the NGINX Gateway Fabric pod.
## The nodeSelector of the NGINX Gateway Fabric pod.
nodeSelector: {}

## The affinity of the NGINX Gateway Fabric pod.
Expand Down
40 changes: 40 additions & 0 deletions deploy/manifests/scc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# Source: nginx-gateway-fabric/templates/scc.yaml
kind: SecurityContextConstraints
apiVersion: security.openshift.io/v1
metadata:
name: nginx-gateway-scc
allowPrivilegeEscalation: false
allowHostDirVolumePlugin: false
allowHostIPC: false
allowHostNetwork: false
allowHostPID: false
allowHostPorts: false
bjee19 marked this conversation as resolved.
Show resolved Hide resolved
allowPrivilegedContainer: false
readOnlyRootFilesystem: true
runAsUser:
type: MustRunAsRange
kate-osborn marked this conversation as resolved.
Show resolved Hide resolved
uidRangeMin: 101
uidRangeMax: 102
fsGroup:
type: MustRunAs
ranges:
- min: 1001
max: 1001
supplementalGroups:
type: MustRunAs
ranges:
- min: 1001
max: 1001
seLinuxContext:
type: MustRunAs
kate-osborn marked this conversation as resolved.
Show resolved Hide resolved
volumes:
- emptyDir
- secret
users:
- system:serviceaccount:nginx-gateway:nginx-gateway
allowedCapabilities:
- NET_BIND_SERVICE
- KILL
requiredDropCapabilities:
- ALL
17 changes: 17 additions & 0 deletions site/content/installation/installing-ngf/manifests.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,23 @@ kubectl apply -f https://raw.githubusercontent.com/nginxinc/nginx-gateway-fabric

{{<note>}}By default, NGINX Gateway Fabric is installed in the **nginx-gateway** namespace. You can deploy in another namespace by modifying the manifest files.{{</note>}}

{{<note>}}If you are deploying NGINX Gateway Fabric on OpenShift, we've supplied a baseline [SecurityContextConstraints](https://raw.githubusercontent.com/nginxinc/nginx-gateway-fabric/v1.2.0/deploy/manifests/scc.yaml) manifest that you can download, modify if needed, and apply. You will also need to make sure the SecurityContextConstraints resource is added to the ClusterRole RBAC:

```yaml
. . .
- apiGroups:
- security.openshift.io
resources:
- securitycontextconstraints
resourceNames:
- nginx-gateway-scc
verbs:
- use
```

Alternatively, use [helm]({{< relref "installation/installing-ngf/helm.md" >}}), which will automatically configure the mentioned resources on OpenShift.
{{</note>}}

#### Stable release

##### For NGINX
Expand Down
Loading