Skip to content

Conversation

@kvaps
Copy link
Member

@kvaps kvaps commented Jan 30, 2026

Summary

  • Add helpers to detect vlan interfaces and resolve parent links by linkIndex
  • Update fallback network configuration to properly handle vlan-over-bond setups
  • When a vlan interface is detected, the template now configures the parent bond with nested vlans section

New helpers

  • talm.discovered.is_vlan - check if link kind is vlan
  • talm.discovered.parent_link_name - find parent link name by linkIndex
  • talm.discovered.vlan_id - extract vlanID from link spec

Test plan

  • Tested on node with bond0.1236 vlan over bond0 interface
  • Template correctly generates bond configuration with vlans section

Summary by CodeRabbit

  • New Features

    • Added VLAN-aware network interface configuration for improved virtual network support.
    • Enhanced floating IP handling for control plane nodes with VLAN integration.
  • Improvements

    • Improved interface and bond configuration flexibility for complex network setups.

✏️ Tip: You can customize this high-level summary in your review settings.

Add helpers to detect vlan interfaces and resolve parent links:
- talm.discovered.is_vlan - check if link is vlan
- talm.discovered.parent_link_name - get parent link by linkIndex
- talm.discovered.vlan_id - extract vlan ID from link

Update fallback network configuration in cozystack and generic charts
to properly configure vlan interfaces on top of bond devices.

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Andrei Kvapil <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

This PR introduces VLAN-aware logic to Helm chart templates across three charts. The changes enable detection of VLAN interfaces, derive parent link names when VLANs exist, conditionally generate VLAN configuration blocks with VLAN IDs and addresses, and add new public helper methods for VLAN discovery and configuration generation while preserving non-VLAN interface handling.

Changes

Cohort / File(s) Summary
VLAN-aware interface configuration
charts/cozystack/templates/_helpers.tpl, charts/generic/templates/_helpers.tpl
Replace static interface configuration with VLAN-aware logic that determines effective interface names, generates conditional VLAN blocks with vlanId, addresses, routes, and optional VIP for control plane nodes, and updates bond configuration to use derived interface names.
VLAN helper methods
charts/talm/templates/_helpers.tpl
Introduce four new public template helpers: is_vlan() to detect VLAN links, parent_link_name() to resolve parent link references, vlan_id() to extract VLAN IDs, and vlan_config() to generate VLAN configuration blocks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit hops through VLAN streams,
Where parent links fulfill their dreams,
No more tangled interfaces bare—
Each VLAN block finds perfect care! 🐰✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main feature: adding VLAN over bond interface support. It's concise, specific, and directly reflects the primary changes across multiple chart templates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/vlan-over-bond-support

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
Contributor

Summary of Changes

Hello @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 significantly enhances the network configuration capabilities by introducing robust support for VLAN-over-bond interface setups. It integrates new helper functions to intelligently detect VLAN interfaces, identify their parent links, and extract VLAN IDs, enabling the system to generate accurate and detailed network configurations for complex network topologies involving bonded interfaces and VLANs.

Highlights

  • New Helper Functions for VLAN Detection: Introduced new helper functions in charts/talm/templates/_helpers.tpl: talm.discovered.is_vlan to identify VLAN interfaces, talm.discovered.parent_link_name to resolve the parent link by its index, and talm.discovered.vlan_id to extract the VLAN ID from a link's specification.
  • Enhanced Network Configuration for VLAN-over-Bond: Modified network configuration templates in charts/cozystack/templates/_helpers.tpl and charts/generic/templates/_helpers.tpl to dynamically detect VLAN interfaces. When a VLAN is detected, the configuration now targets the parent bond interface and includes a nested vlans section with the VLAN's addresses, routes, and optional VIP.
  • Improved Fallback Network Configuration: The fallback network configuration logic has been updated to properly handle setups where VLANs are configured over bonded interfaces, ensuring correct address and route assignment within the generated configuration.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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-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-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.

@kvaps kvaps marked this pull request as ready for review January 30, 2026 07:15
Copy link
Contributor

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

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 introduces support for VLAN over bond interfaces, which is a valuable enhancement. New helper functions have been added to identify VLAN links, resolve their parent interfaces, and extract VLAN IDs. The core configuration templates (cozystack and generic) have been updated to correctly apply network configurations for these VLAN-over-bond setups, nesting VLAN details under the parent interface. While the functionality appears correct, there are opportunities to improve code maintainability by reducing duplication and refining the scope of a new helper function.

Comment on lines +260 to +268
{{- /* Generate vlan configuration */ -}}
{{- define "talm.discovered.vlan_config" -}}
{{- $linkName := . -}}
{{- $link := lookup "links" "" $linkName -}}
{{- if and $link (eq $link.spec.kind "vlan") -}}
vlans:
- vlanId: {{ $link.spec.vlan.vlanID }}
{{- end -}}
{{- end -}}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The talm.discovered.vlan_config helper is introduced but currently only generates the vlanId portion of a VLAN configuration. The actual VLAN configuration blocks used in cozystack and generic templates are more comprehensive, including addresses, routes, and vip. This helper is either incomplete for its implied purpose or its name is too broad for its current functionality. Consider either expanding this helper to generate the full VLAN configuration block so it can be used consistently, or renaming it to better reflect its limited scope (e.g., talm.discovered.vlan_id_block) if it's only meant to generate the vlanId part. If this helper is not intended to be used in the current context, it might be better to remove it to avoid confusion.

Comment on lines +237 to +249
{{- /* Get parent link name by linkIndex */ -}}
{{- define "talm.discovered.parent_link_name" -}}
{{- $linkName := . -}}
{{- $link := lookup "links" "" $linkName -}}
{{- if and $link $link.spec.linkIndex -}}
{{- $parentIndex := $link.spec.linkIndex -}}
{{- range (lookup "links" "" "").items -}}
{{- if eq (int .spec.index) (int $parentIndex) -}}
{{- .metadata.id -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The talm.discovered.parent_link_name helper iterates through all discovered links (range (lookup "links" "" "").items) to find the parent link by linkIndex. While functional, this approach could become inefficient if the number of discovered links grows very large. For typical network configurations, this might not be an issue, but it's worth considering if a more direct lookup mechanism or an indexed map could be employed for better performance in environments with many interfaces.

@kvaps kvaps merged commit d69aa8d into main Feb 2, 2026
4 checks passed
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.

2 participants