Skip to content

[kubernetes] Update Kubevirt-CCM - #1052

Merged
Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
fix-ccm
Jun 11, 2025
Merged

Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
fix-ccm

Conversation

@kvaps

@kvaps Andrei Kvapil (kvaps) commented Jun 11, 2025 •

Copy link
Copy Markdown
Member

Fixes panic, upstream issue:

Summary by CodeRabbit

  • Bug Fixes
    • Improved filtering and error handling for endpoints and virtual machines with missing or invalid data, ensuring only valid endpoints are processed.
  • New Features
    • Enhanced support for multi-cluster environments by introducing cluster name filtering for service and endpoint management.
  • Tests
    • Added new tests to verify correct handling of endpoints and services across clusters and improved coverage for edge cases.
  • Chores
    • Updated Kubernetes app and image versions for improved tracking and deployment consistency.

@coderabbitai

coderabbitai Bot commented Jun 11, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes update the Kubernetes application's Helm chart version and version mapping, update the kubevirt-cloud-provider Dockerfile to use a new commit, and introduce significant enhancements to the kubevirtEPSController. These enhancements include cluster name label filtering, improved endpoint handling, robust error logging, and expanded test coverage for new behaviors.

Changes

File(s) Change Summary
packages/apps/kubernetes/Chart.yaml Bumped chart version from 0.23.1 to 0.23.2.
packages/apps/kubernetes/images/kubevirt-cloud-provider/Dockerfile Updated the base commit hash for build from 443a1fe to a0acf33.
packages/apps/kubernetes/images/kubevirt-cloud-provider/patches/341.diff Added cluster name label filtering to kubevirtEPSController, improved resource lifecycle logic, fixed port handling, and expanded tests.
packages/apps/kubernetes/images/kubevirt-cloud-provider/patches/354.diff Enhanced endpoint filtering in getDesiredEndpoints, improved error handling and logging, and added new test cases.
packages/apps/versions_map Updated version mapping: marked 0.23.1 with commit hash, added 0.23.2 as HEAD.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Controller
    participant TenantK8s
    participant InfraK8s
    participant DynamicClient

    User->>Controller: Instantiate with clusterName
    Controller->>TenantK8s: Watch Services
    TenantK8s-->>Controller: Service event
    Controller->>Controller: Check clusterName label
    alt Label matches
        Controller->>InfraK8s: Query Infra Services/EndpointSlices (filtered by clusterName)
        Controller->>DynamicClient: Get VMIs for endpoints
        DynamicClient-->>Controller: VMIs (skip if NodeName/IP missing)
        Controller->>InfraK8s: Reconcile EndpointSlices (create/update/delete)
    else Label does not match
        Controller->>Controller: Ignore service
    end
Loading

Poem

A hop, a skip, a cluster name,
Labels guide the rabbit’s game.
Endpoints checked with careful eyes,
Only valid nodes win the prize.
Tests abound, and logs now sing,
Kubernetes’ chart gets a spring!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 632224a and 10af98e.

📒 Files selected for processing (5)
  • packages/apps/kubernetes/Chart.yaml (1 hunks)
  • packages/apps/kubernetes/images/kubevirt-cloud-provider/Dockerfile (1 hunks)
  • packages/apps/kubernetes/images/kubevirt-cloud-provider/patches/341.diff (3 hunks)
  • packages/apps/kubernetes/images/kubevirt-cloud-provider/patches/354.diff (1 hunks)
  • packages/apps/versions_map (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build
🔇 Additional comments (14)
packages/apps/kubernetes/Chart.yaml (1)

19-19: Version bump looks good.

The patch version increment from 0.23.1 to 0.23.2 is appropriate for the panic fix in the Kubevirt Cloud Controller Manager.

packages/apps/versions_map (1)

74-75: Version mapping update is correct.

Properly pins version 0.23.1 to commit 632224a3 and marks 0.23.2 as the new HEAD version, maintaining version history traceability.

packages/apps/kubernetes/images/kubevirt-cloud-provider/Dockerfile (1)

11-11: Commit update incorporates the upstream panic fix.

The update to commit a0acf33 aligns with the PR objective to fix the panic issue in Kubevirt CCM.

Please verify that commit a0acf33 includes the fix from the upstream PR kubevirt/cloud-provider-kubevirt#354.

packages/apps/kubernetes/images/kubevirt-cloud-provider/patches/354.diff (5)

17-21: Good defensive check for nil NodeName.

This prevents potential nil pointer dereferences when accessing endpoint.NodeName, which could cause panics.


52-57: Excellent validation of VMI NodeName.

The check for empty NodeName and conversion to pointer type ensures consistency and prevents potential issues downstream.


64-68: Important IP address validation added.

This check prevents creating endpoints with empty IP addresses, which would be invalid and could cause issues in consumers of these endpoints.


79-79: Correct change from continue to break.

Since we're looking for the "default" interface specifically, using break after finding it is more efficient than continue.


91-142: Comprehensive test coverage for edge cases.

The test properly validates that endpoints without NodeName and VMIs without NodeName or IP are filtered out, ensuring the defensive checks work as expected.

packages/apps/kubernetes/images/kubevirt-cloud-provider/patches/341.diff (6)

23-35: Required cluster name parameter improves multi-tenancy support.

The addition of the required --cluster-name flag enables proper cluster-scoped resource management, preventing cross-cluster interference.


88-96: Enhanced service filtering with cluster name label.

The label selector now properly filters services by cluster name in addition to tenant service name/namespace, ensuring cluster isolation.


163-167: Good addition of cluster name validation in reconcile.

Skipping services that don't match the controller's cluster name prevents accidental management of resources from other clusters.


294-352: Improved finalize function with better edge case handling.

The refactored logic correctly pairs delete+create operations into updates, avoiding unnecessary API calls and potential race conditions. The extensive comments improve maintainability.


439-515: Fix for multi-port EndpointSlice handling.

The test and the corresponding fix ensure that multi-port services don't create duplicate ports in EndpointSlices.

Since this fixes a port duplication issue, please verify that existing multi-port services will have their EndpointSlices correctly updated after this change is deployed.


517-647: Comprehensive test coverage for service selector changes.

The tests properly validate that EndpointSlices are deleted when a service gains a selector, preventing the controller from managing services it shouldn't.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant