GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@mattia-eleuteri mattia-eleuteri commented Nov 10, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

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.

  • No downstream repository is affected by this change
  • cozystack/website - follow-up:
  • cozystack/terraform-provider-cozystack - follow-up:
  • cozystack/ansible-cozystack - follow-up:
  • cozystack/ccp - follow-up:
  • cozystack/talm - follow-up:
  • cozystack/cozyhr - follow-up:
  • cozystack/cozy-proxy - follow-up:
  • cozystack/cozystack-telemetry-server - follow-up:
  • cozystack/external-apps-example - follow-up:
  • cozystack/examples - follow-up:
  • cozystack/community - follow-up:

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.

All reactions
@mattia-eleuteri
fix(vm-instance): keep an external PortList VM valid with no ports
c6f1d6c
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

coderabbitai Bot commented Nov 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Explain Change →

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: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: keeping an external PortList VM valid when it has no ports.
Docstring Coverage Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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)

  • Create a new PR
  • 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

  • X
  • Mastodon
  • Reddit
  • LinkedIn
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: cozystack/cozystack
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: c117420
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6d7ed794-3307-4aec-905c-39c1aa34dfd7
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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added 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 labels Nov 10, 2026
@mattia-eleuteri
mattia-eleuteri marked this pull request as ready for review November 10, 2026 13:44
@mattia-eleuteri
mattia-eleuteri requested review from IvanHunters, Andrei Kvapil (kvaps), Aleksei Sviridkin (lexfrei), Timofei Larkin (lllamnyp), myasnikovdaniil and scooby87 as code owners November 10, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kvaps Andrei Kvapil (kvaps) Awaiting requested review from kvaps kvaps is a code owner
@lllamnyp Timofei Larkin (lllamnyp) Awaiting requested review from lllamnyp lllamnyp is a code owner
@lexfrei Aleksei Sviridkin (lexfrei) Awaiting requested review from lexfrei lexfrei is a code owner
@myasnikovdaniil myasnikovdaniil Awaiting requested review from myasnikovdaniil myasnikovdaniil is a code owner
@IvanHunters IvanHunters Awaiting requested review from IvanHunters IvanHunters is a code owner
@scooby87 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

Projects

None yet

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.

1 participant

@mattia-eleuteri
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.