Skip to content

Commit e65b2ca

Browse files
authored
Merge pull request #5708 from towolf/patch-1
Add sysctl exemptions to controller PSP
2 parents c0035d2 + 1d54d8b commit e65b2ca

File tree

6 files changed

+38
-6
lines changed

6 files changed

+38
-6
lines changed

charts/ingress-nginx/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v1
22
name: ingress-nginx
3-
version: 2.5.0
3+
version: 2.6.0
44
appVersion: 0.33.0
55
home: https://github.com/kubernetes/ingress-nginx
66
description: Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer

charts/ingress-nginx/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Parameter | Description | Default
9090
`controller.podAnnotations` | annotations to be added to pods | `{}`
9191
`controller.podLabels` | labels to add to the pod container metadata | `{}`
9292
`controller.podSecurityContext` | Security context policies to add to the controller pod | `{}`
93+
`controller.sysctls` | Map of optional sysctls to enable in the controller and in the PodSecurityPolicy | `{}`
9394
`controller.replicaCount` | desired number of controller pods | `1`
9495
`controller.minAvailable` | minimum number of available controller pods for PodDisruptionBudget | `1`
9596
`controller.resources` | controller pod resource requests & limits | `{}`

charts/ingress-nginx/templates/controller-daemonset.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,18 @@ spec:
4242
{{- if .Values.controller.priorityClassName }}
4343
priorityClassName: {{ .Values.controller.priorityClassName }}
4444
{{- end }}
45-
{{- if .Values.controller.podSecurityContext }}
46-
securityContext: {{ toYaml .Values.controller.podSecurityContext | nindent 8 }}
45+
{{- if or .Values.controller.podSecurityContext .Values.controller.sysctls }}
46+
securityContext:
47+
{{- end }}
48+
{{- if .Values.controller.podSecurityContext }}
49+
{{- toYaml .Values.controller.podSecurityContext | nindent 8 }}
50+
{{- end }}
51+
{{- if .Values.controller.sysctls }}
52+
sysctls:
53+
{{- range $sysctl, $value := .Values.controller.sysctls }}
54+
- name: {{ $sysctl }}
55+
value: {{ $value }}
56+
{{- end }}
4757
{{- end }}
4858
containers:
4959
- name: controller

charts/ingress-nginx/templates/controller-deployment.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,18 @@ spec:
4646
{{- if .Values.controller.priorityClassName }}
4747
priorityClassName: {{ .Values.controller.priorityClassName }}
4848
{{- end }}
49+
{{- if or .Values.controller.podSecurityContext .Values.controller.sysctls }}
50+
securityContext:
51+
{{- end }}
4952
{{- if .Values.controller.podSecurityContext }}
50-
securityContext: {{ toYaml .Values.controller.podSecurityContext | nindent 8 }}
53+
{{- toYaml .Values.controller.podSecurityContext | nindent 8 }}
54+
{{- end }}
55+
{{- if .Values.controller.sysctls }}
56+
sysctls:
57+
{{- range $sysctl, $value := .Values.controller.sysctls }}
58+
- name: {{ $sysctl }}
59+
value: {{ $value }}
60+
{{- end }}
5161
{{- end }}
5262
containers:
5363
- name: controller

charts/ingress-nginx/templates/controller-psp.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ metadata:
99
spec:
1010
allowedCapabilities:
1111
- NET_BIND_SERVICE
12+
{{- if .Values.controller.sysctls }}
13+
allowedUnsafeSysctls:
14+
{{- range $sysctl, $value := .Values.controller.sysctls }}
15+
- {{ $sysctl }}
16+
{{- end }}
17+
{{- end }}
1218
privileged: false
1319
allowPrivilegeEscalation: true
1420
# Allow core volume types.

charts/ingress-nginx/values.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,16 @@ controller:
6767
# key: value
6868

6969
## Security Context policies for controller pods
70-
## See https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/ for
71-
## notes on enabling and using sysctls
7270
##
7371
podSecurityContext: {}
7472

73+
## See https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/ for
74+
## notes on enabling and using sysctls
75+
###
76+
sysctls: {}
77+
# sysctls:
78+
# "net.core.somaxconn": "8192"
79+
7580
## Allows customization of the source of the IP address or FQDN to report
7681
## in the ingress status field. By default, it reads the information provided
7782
## by the service. If disable, the status field reports the IP address of the

0 commit comments

Comments
 (0)