Skip to content

Commit 539b5c3

Browse files
authored
[tenant] Allow egress to virt-handler for VM metrics scraping (#2199)
## Summary - Adds a `CiliumClusterwideNetworkPolicy` allowing egress from tenant pods to `virt-handler` in `cozy-kubevirt` namespace on port 8443/TCP - Conditional on `.Values.monitoring` being enabled ## Problem Tenant vmagent cannot scrape KubeVirt VM metrics from `virt-handler` because no network policy allows the traffic. Relates to #2194 ## Test plan - [ ] `helm template` tenant with `monitoring: true` — virt-handler policy present - [ ] `helm template` tenant with `monitoring: false` — virt-handler policy absent - [ ] Deploy and verify vmagent can scrape kubevirt_vmi_* metrics ```release-note Allow tenant egress to virt-handler for VM metrics scraping ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Added a network egress policy that, when monitoring is enabled, allows tenant namespaces to reach the virt-handler service on TCP port 8443, improving connectivity for monitoring-related traffic. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents 27c5b0b + 630dfc7 commit 539b5c3

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)