Skip to content

Commit 1791b62

Browse files
authored
Add NetworkPolicy support (#8928)
* Add NetworkPolicy support * add doc for np
1 parent 730174f commit 1791b62

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

charts/ingress-nginx/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ Kubernetes: `>=1.20.0-0`
249249
| controller.admissionWebhooks.key | string | `"/usr/local/certificates/key"` | |
250250
| controller.admissionWebhooks.labels | object | `{}` | Labels to be added to admission webhooks |
251251
| controller.admissionWebhooks.namespaceSelector | object | `{}` | |
252+
| controller.admissionWebhooks.networkPolicyEnabled | bool | `false` | |
252253
| controller.admissionWebhooks.objectSelector | object | `{}` | |
253254
| controller.admissionWebhooks.patch.enabled | bool | `true` | |
254255
| controller.admissionWebhooks.patch.fsGroup | int | `2000` | |
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- if .Values.controller.admissionWebhooks.enabled }}
2+
{{- if .Values.controller.admissionWebhooks.networkPolicyEnabled }}
3+
4+
apiVersion: networking.k8s.io/v1
5+
kind: NetworkPolicy
6+
metadata:
7+
name: {{ include "ingress-nginx.fullname" . }}-webhooks-allow
8+
namespace: {{ .Release.Namespace }}
9+
spec:
10+
ingress:
11+
- {}
12+
podSelector:
13+
matchLabels:
14+
app.kubernetes.io/name: {{ include "ingress-nginx.name" . }}
15+
policyTypes:
16+
- Ingress
17+
18+
{{- end }}
19+
{{- end }}

charts/ingress-nginx/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ controller:
615615

616616
# -- Use an existing PSP instead of creating one
617617
existingPsp: ""
618+
networkPolicyEnabled: false
618619

619620
service:
620621
annotations: {}

0 commit comments

Comments
 (0)