Skip to content

[virtual-machine] Revert per-vm network policies - #1611

Merged
Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
revert-vm-net-pol
Nov 7, 2025
Merged

Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
revert-vm-net-pol

Conversation

@kvaps

@kvaps Andrei Kvapil (kvaps) commented Nov 7, 2025 •

Copy link
Copy Markdown
Member

Signed-off-by: Andrei Kvapil [email protected]

What this PR does

Revert per-vm network policies functionality introduced by #1611
As it is not working as expected any way.

This is temporary solution before implementing full-fledged security groups in Cozystack

fixes #1601
alternative solution: #1602

Release note

[virtual-machine] Revert per-vm network policies

@dosubot dosubot Bot added the size/M This PR changes 30-99 lines, ignoring generated files label Nov 7, 2025
@coderabbitai

coderabbitai Bot commented Nov 7, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Network policy restrictions and related annotations are removed from virtual machine and instance templates. The tenant template's endpoint selector is changed to select all endpoints instead of filtering based on external communication policy settings.

Changes

Cohort / File(s) Change Summary
Network Policy Removal (Service Templates)
packages/apps/virtual-machine/templates/service.yaml, packages/apps/vm-instance/templates/service.yaml
Entire CiliumNetworkPolicy manifest blocks removed, eliminating network policy creation while preserving Service resources.
External Communication Annotation Removal
packages/apps/virtual-machine/templates/vm.yaml, packages/apps/vm-instance/templates/vm.yaml
Removed policy.cozystack.io/allow-external-communication: "false" annotation from template metadata; other annotations and labels unchanged.
Tenant Network Policy Endpoint Update
packages/apps/tenant/templates/networkpolicy.yaml
Changed endpointSelector from filtered expressions to empty selector {}, now selecting all endpoints for external communication policy instead of excluding restricted ones.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify the intent of removing network policies is documented or follows agreed security posture changes
  • Confirm that removing the policy.cozystack.io/allow-external-communication: "false" annotation doesn't introduce unintended network access
  • Validate that the tenant's permissive endpoint selector ({}) aligns with desired network segmentation

Suggested reviewers

  • lllamnyp

Poem

🐰 Restrictions lifted, network flows free,
No more walls between you and me,
Endpoints open, policies unbound,
In cozy stacks, new pathways found!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title '[virtual-machine] Revert per-vm network policies' clearly and concisely summarizes the main change: reverting network policy configurations across virtual-machine related templates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch revert-vm-net-pol

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello Andrei Kvapil (@kvaps), I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request reverts the implementation of per-virtual machine network policies. The changes involve removing specific CiliumNetworkPolicy definitions and associated policy.cozystack.io/allow-external-communication annotations from virtual machine and VM instance templates. Additionally, a tenant-level network policy's endpoint selector has been generalized. The overall intent is to simplify network policy management by moving away from fine-grained, per-VM network controls.

Highlights

  • Removed Per-VM Cilium Network Policies: The dedicated CiliumNetworkPolicy resources that previously defined network rules for virtual machines and VM instances have been entirely removed from their respective service templates.
  • Removed External Communication Annotation: The policy.cozystack.io/allow-external-communication: "false" annotation, which was used to control external communication, has been removed from both virtual machine and VM instance templates.
  • Broadened Tenant Network Policy Scope: The endpointSelector for the allow-external-communication NetworkPolicy in the tenant application has been generalized by removing specific matchExpressions, effectively broadening its application scope.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment Gemini (@gemini-code-assist) Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request reverts the per-virtual-machine network policy feature. The changes correctly remove the per-VM CiliumNetworkPolicy resources and associated annotations from the virtual-machine and vm-instance charts, and simplify the tenant-wide allow-external-communication policy to apply to all pods. While the revert is logical, I've identified a potential high-severity issue. The removed per-VM policies allowed ingress from other pods in the cluster (fromEntities: - cluster). This rule appears to be missing from the tenant-wide policy that now governs the VMs, which could break previously working intra-cluster communication.

@kvaps Andrei Kvapil (kvaps) added the kind/backport Categorizes issue or PR as requiring a backport to the current release line label Nov 7, 2025
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Nov 7, 2025
@kvaps
Andrei Kvapil (kvaps) merged commit 83c3b0c into main Nov 7, 2025
1 check passed
@kvaps
Andrei Kvapil (kvaps) deleted the revert-vm-net-pol branch November 7, 2025 14:48
@github-actions

github-actions Bot commented Nov 7, 2025

Copy link
Copy Markdown

Successfully created backport PR for release-0.37:

Andrei Kvapil (kvaps) added a commit that referenced this pull request Nov 7, 2025
…ies (#1613)

# Description
Backport of #1611 to `release-0.37`.
Andrei Kvapil (kvaps) added a commit that referenced this pull request Nov 7, 2025
…ies (#1613)

# Description
Backport of #1611 to `release-0.37`.
Andrei Kvapil (kvaps) added a commit that referenced this pull request Nov 7, 2025
Signed-off-by: Andrei Kvapil <[email protected]>

<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

## What this PR does

Revert per-vm network policies functionality introduced by
#1611
As it is not working as expected any way.

This is temporary solution before implementing full-fledged security
groups in Cozystack

fixes #1601
alternative solution: #1602

### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[virtual-machine] Revert per-vm network policies
```
Andrei Kvapil (kvaps) added a commit that referenced this pull request Nov 7, 2025
Signed-off-by: Andrei Kvapil <[email protected]>

<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

## What this PR does

Revert per-vm network policies functionality introduced by
#1611
As it is not working as expected any way.

This is temporary solution before implementing full-fledged security
groups in Cozystack

fixes #1601
alternative solution: #1602

### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[virtual-machine] Revert per-vm network policies
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/backport Categorizes issue or PR as requiring a backport to the current release line lgtm This PR has been approved by a maintainer size/M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VM network policy bug for non-isolated tenants

2 participants