Skip to content

Commit 630dfc7

Browse files
Mattia Eleuterimattia-eleuteri
authored andcommitted
[tenant] Allow egress to virt-handler for VM metrics scraping
- Add CiliumClusterwideNetworkPolicy for vmagent egress to virt-handler - Restrict endpointSelector to vmagent pods only via app.kubernetes.io/name label Signed-off-by: Mattia Eleuteri <[email protected]> Signed-off-by: mattia-eleuteri <[email protected]>
1 parent a13481b commit 630dfc7

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎packages/apps/tenant/templates/networkpolicy.yaml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,27 @@ spec:
207207
- toEndpoints:
208208
- matchLabels:
209209
"k8s:io.kubernetes.pod.namespace": cozy-kubevirt-cdi
210+
{{- if .Values.monitoring }}
211+
---
212+
apiVersion: cilium.io/v2
213+
kind: CiliumClusterwideNetworkPolicy
214+
metadata:
215+
name: {{ include "tenant.name" . }}-egress-virt-handler
216+
spec:
217+
endpointSelector:
218+
matchLabels:
219+
"k8s:io.kubernetes.pod.namespace": "{{ include "tenant.name" . }}"
220+
"k8s:app.kubernetes.io/name": "vmagent"
221+
egress:
222+
- toEndpoints:
223+
- matchLabels:
224+
"k8s:kubevirt.io": "virt-handler"
225+
"k8s:io.kubernetes.pod.namespace": "cozy-kubevirt"
226+
toPorts:
227+
- ports:
228+
- port: "8443"
229+
protocol: TCP
230+
{{- end }}
210231
---
211232
apiVersion: cilium.io/v2
212233
kind: CiliumNetworkPolicy

0 commit comments

Comments
 (0)