GeezerVison is showing github.com — fix(vm-instance): keep an external PortList VM valid with no ports by mattia-eleuteri · Pull Request #5270 · cozystack/cozystack
Conversation
mattia-eleuteri
commented
Nov 10, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
What this PR does
A vm-instance with external: true, externalMethod: PortList and an empty externalPorts list renders a LoadBalancer Service with no port at all. The API server rejects it (Service "vm-instance-<name>" is invalid: spec.ports: Required value), so the HelmRelease fails on every retry. The previous Service stays in place meanwhile, which means the ports the user believes they removed are still open.
Emptying the list is a legitimate request: keep the VM's external IP (egress SNAT, ICMP) but expose no inbound port. This PR renders a single placeholder port in that case, 65535/SCTP, named no-ports. The protocol is the point: cozy-proxy's EnsurePortFilter only admits TCP and UDP ports into allowed_ports and skips anything else, while the pod still enters filtered_pods, so every inbound TCP and UDP packet is dropped. A TCP or UDP placeholder would open that port on the VM instead.
The WholeIP branch and the non-external branch keep their existing 65535 placeholder unchanged.
Tested on a lab cluster running cozy-proxy with node-local rules, against a running PortList VM exposing 22 and 80: with the placeholder Service, MetalLB kept the same IP, cozy-proxy logged Skipping unsupported protocol for port filter and kept the egress SNAT and ingress DNAT, TCP 22, 80 and 65535 timed out from outside, ICMP still answered (allowICMP: "true"), and the Cilium agents logged nothing about the Service. Restoring the port list reopened 22 and 80.
tests/service_ports_test.yaml covers the three external cases. Its first case fails on main (unknown path spec.ports[0]) and passes with the fix.
Screenshots
Not a UI change.
Downstream repositories
Walked the trigger map against the diff (templates/service.yaml and a new unit test in packages/apps/vm-instance): no package is added or renamed, no value, schema, default or annotation changes, and the service-proxy-name label and the wholeIP / allowICMP annotations cozy-proxy matches on are untouched. The fix does rely on cozy-proxy ignoring non-TCP/UDP ports in its port filter, which holds on cozy-proxy main today; if it ever learns SCTP, this placeholder would open 65535/SCTP and nothing else.
Release note
fix(vm-instance): an external PortList VM with an empty port list no longer fails to deploy; it keeps its external IP and blocks all inbound TCP and UDP traffic.
Summary by CodeRabbit
- Bug Fixes
- External services without configured ports now include an SCTP placeholder on port 65535, except for
WholeIP services, whose existing behavior is unchanged.
- Services with configured ports continue to render those ports without the placeholder. This keeps the rendered service configuration consistent across these cases.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The API server rejects a Service that declares no port, so a VM switched
to external PortList with an empty port list could not be upgraded: the
release failed and was retried forever, while the old Service kept the
previously listed ports open.
Render a single SCTP placeholder in that case. cozy-proxy only admits
TCP and UDP ports into its PortList filter, so the VM keeps its external
IP for egress and ICMP while all inbound TCP and UDP traffic is dropped,
which is what an empty port list means.
Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <[email protected]>
coderabbitai
Bot
commented
Nov 10, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
-
The external Service template adds an SCTP placeholder on port 65535 when no ports are configured outside the WholeIP branch. Helm tests cover this fallback, configured ports, and empty WholeIP configuration.
Changes: External Service ports
| Layer / File(s) |
Summary |
Render and validate external Service ports packages/apps/vm-instance/templates/service.yaml, packages/apps/vm-instance/tests/service_ports_test.yaml |
The template adds an SCTP port 65535 fallback for external Services without configured ports outside the WholeIP branch. Tests cover the fallback, configured ports, and empty WholeIP configuration. |
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Merge Risk: Minimal · up to c6f1d
-
An external PortList VM with no ports now renders a valid Service, so the upgrade no longer fails and leaves previously exposed ports in place. No concrete merge-blocking risk remains. Existing inbound connections surviving a port change is long-standing proxy behavior, not something this change introduces.
Pre-merge checks: 5
-
| Check name |
Status |
Explanation |
| Description Check |
 |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
 |
The title clearly summarizes the main change: keeping an external PortList VM valid when it has no ports. |
| Docstring Coverage |
 |
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (2 skipped: 2 unsupported.)
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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
-
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between c117420 and c6f1d6c.
Files selected for processing: 2
-
packages/apps/vm-instance/templates/service.yaml
packages/apps/vm-instance/tests/service_ports_test.yaml
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
myasnikovdaniil
Awaiting requested review from myasnikovdaniil
myasnikovdaniil is a code owner
IvanHunters
Awaiting requested review from IvanHunters
IvanHunters is a code owner
scooby87
Awaiting requested review from scooby87
scooby87 is a code owner
At least 1 approving review is required to merge this pull request.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
area/virtualization
Issues or PRs related to virtualization (kubevirt, cdi, vmi, vm-import)
kind/bug
Categorizes issue or PR as related to a bug
size/M
This PR changes 30-99 lines, ignoring generated files
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|