[release-4.22] fix: OCPBUGS-100445: create virt-launcher NetworkPolicy on external infra cluster - #9205
Conversation
…fra cluster When deploying HCP KubeVirt with external infrastructure (workers on a separate cluster), the virt-launcher NetworkPolicy was never created on the infrastructure cluster. The reconcileNetworkPolicies function explicitly skipped it when Credentials != nil, leaving guest VMs with unrestricted network access to all pods and services on the infra cluster. This patch adds an else branch that uses the existing infra cluster client (from KubevirtInfraClientMap) to create the virt-launcher NetworkPolicy in the infra namespace on the infrastructure cluster. A new reconcileVirtLauncherNetworkPolicyExternalInfra function builds the policy adapted for external infra: - Blocks infra cluster's clusterNetwork/serviceNetwork CIDRs - Allows inter-VM, DNS, and ingress controller traffic - Omits control-plane pod selectors (kube-apiserver, oauth, ignition-server-proxy) since those pods run on the management cluster and are reached via external IPs The Network config lookup is best-effort: if the infra kubeconfig lacks cluster-scoped get on networks.config.openshift.io, the policy is still created but without CIDR-based egress blocking. Also updates the documented minimum RBAC role for external infra to include networkpolicies (networking.k8s.io) and documents the optional ClusterRole for full network isolation. Made-with: Cursor
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
@openshift-cherrypick-robot: Jira Issue OCPBUGS-78575 has been cloned as Jira Issue OCPBUGS-100445. Will retitle bug to link to clone. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@openshift-cherrypick-robot: This pull request references Jira Issue OCPBUGS-100445, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release-4.22 #9205 +/- ##
================================================
- Coverage 36.22% 36.21% -0.02%
================================================
Files 774 774
Lines 94889 95018 +129
================================================
+ Hits 34374 34409 +35
- Misses 57699 57787 +88
- Partials 2816 2822 +6
🚀 New features to boost your workflow:
|
everettraven
left a comment
There was a problem hiding this comment.
Approved from an API perspective.
/approve
|
Scheduling tests matching the |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: everettraven, openshift-cherrypick-robot The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@openshift-cherrypick-robot: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/uncc |
|
Stale PRs are closed after 21d of inactivity. If this PR is still relevant, comment to refresh it or remove the stale label. If this PR is safe to close now please do so with /lifecycle stale |
This is an automated cherry-pick of #8056
/assign dpateriya