Skip to content

Commit 179b404

Browse files
committed
feat(): allow network policy
1 parent e34f53f commit 179b404

4 files changed

Lines changed: 71 additions & 1 deletion

File tree

charts/node-red/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ icon: https://nodered.org/about/resources/media/node-red-icon-2.png
99

1010
type: application
1111

12-
version: 0.40.1
12+
version: 0.41.0
1313
appVersion: 4.1.2
1414

1515
keywords:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- if and .Values.networkPolicy.enabled (eq .Values.networkPolicy.flavor "cilium") }}
2+
apiVersion: cilium.io/v2
3+
kind: CiliumNetworkPolicy
4+
metadata:
5+
name: {{ include "node-red.fullname" . }}
6+
namespace: {{ .Release.Namespace | quote }}
7+
labels:
8+
{{- include "node-red.labels" . | nindent 4 }}
9+
spec:
10+
endpointSelector:
11+
matchLabels:
12+
k8s:app.kubernetes.io/name: '{{ include "node-red.name" . }}'
13+
k8s:app.kubernetes.io/instance: '{{ .Release.Name }}'
14+
{{- if and .Values.networkPolicy.cilium .Values.networkPolicy.cilium.egress }}
15+
egress:
16+
{{ toYaml .Values.networkPolicy.cilium.egress | nindent 4 }}
17+
{{- end }}
18+
{{- if and .Values.networkPolicy.cilium .Values.networkPolicy.cilium.ingress }}
19+
ingress:
20+
{{ toYaml .Values.networkPolicy.cilium.ingress | nindent 4 }}
21+
{{- end }}
22+
{{- end }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{- if and .Values.networkPolicy.enabled (eq .Values.networkPolicy.flavor "kubernetes") }}
2+
apiVersion: networking.k8s.io/v1
3+
kind: NetworkPolicy
4+
metadata:
5+
name: {{ include "node-red.fullname" . }}
6+
namespace: {{ .Release.Namespace | quote }}
7+
labels:
8+
{{- include "node-red.labels" . | nindent 4 }}
9+
spec:
10+
{{- if .Values.networkPolicy.egress }}
11+
egress:
12+
{{- toYaml .Values.networkPolicy.egress | nindent 4 }}
13+
{{- end }}
14+
{{- if .Values.networkPolicy.ingress }}
15+
ingress:
16+
{{- toYaml .Values.networkPolicy.ingress | nindent 4 }}
17+
{{- end }}
18+
policyTypes:
19+
- Egress
20+
- Ingress
21+
podSelector:
22+
matchLabels:
23+
{{- include "node-red.selectorLabels" . | nindent 4 }}
24+
{{- end }}

charts/node-red/values.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,30 @@ ingress:
199199
# -- Name of the Issuer
200200
# name: "test"
201201

202+
# -- Define network policy targeting managed pod
203+
networkPolicy:
204+
enabled: false
205+
# -- If cilium flavor is defined, fill definition here
206+
cilium:
207+
egress:
208+
- toPorts:
209+
- ports:
210+
- port: "1883"
211+
protocol: TCP
212+
- port: "8883"
213+
protocol: TCP
214+
ingress: {}
215+
# -- Choose policy flavor in 'kubernetes', 'cilium'
216+
flavor: kubernetes
217+
# -- If kubernetes flavor is defined, fill definition here
218+
ingress: {}
219+
egress:
220+
- ports:
221+
- port: 1883
222+
protocol: TCP
223+
- port: 8883
224+
protocol: TCP
225+
202226
# -- Startup probe for the Deployment
203227
startupProbe:
204228
httpGet:

0 commit comments

Comments
 (0)