Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
32 changes: 32 additions & 0 deletions charts/nginx-ingress/templates/controller-networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.controller.networkPolicy.enabled }}
{{- $ingress := .Values.controller.networkPolicy.ingress }}
{{- $egress := .Values.controller.networkPolicy.egress }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "nginx-ingress.controller.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "nginx-ingress.labels" . | nindent 4 }}
spec:
podSelector:
matchLabels:
{{- include "nginx-ingress.selectorLabels" . | nindent 6 }}
{{- if or $ingress $egress }}
policyTypes:
{{- if $ingress }}
- Ingress
{{- end }}
{{- if $egress }}
- Egress
{{- end }}
{{- end }}
{{- with $ingress }}
ingress:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $egress }}
egress:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
31 changes: 31 additions & 0 deletions charts/nginx-ingress/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2103,6 +2103,37 @@
"examples": [
false
]
},
"networkPolicy": {
"type": "object",
"default": {},
"title": "Configure a NetworkPolicy for the Ingress Controller pods",
"required": [
"enabled"
],
"properties": {
"enabled": {
"type": "boolean",
"default": false,
"title": "Create a NetworkPolicy that targets the controller pods"
},
"ingress": {
"type": "array",
"default": [],
"title": "Ingress rules",
"items": {
"$ref": "https://raw.githubusercontent.com/nginxinc/kubernetes-json-schema/master/v1.36.1/_definitions.json#/definitions/io.k8s.api.networking.v1.NetworkPolicyIngressRule"
}
},
"egress": {
"type": "array",
"default": [],
"title": "Egress rules",
"items": {
"$ref": "https://raw.githubusercontent.com/nginxinc/kubernetes-json-schema/master/v1.36.1/_definitions.json#/definitions/io.k8s.api.networking.v1.NetworkPolicyEgressRule"
}
}
}
}
},
"examples": [
Expand Down
9 changes: 9 additions & 0 deletions charts/nginx-ingress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,15 @@ controller:
## variable_hash_bucket_size, and variable_hash_max_size in the ConfigMap based on the number of two-way splits.
enableWeightChangesDynamicReload: false

## Configure an optional NetworkPolicy for the Ingress Controller pods.
networkPolicy:
## Create a NetworkPolicy that targets the controller pods.
enabled: false
## Configure ingress rules. When non-empty, the Ingress policy type is added automatically.
ingress: []
## Configure egress rules. When non-empty, the Egress policy type is added automatically.
egress: []
Comment thread
GabboPenna marked this conversation as resolved.

rbac:
## Configures RBAC.
create: true
Expand Down
Loading
Loading