-
Notifications
You must be signed in to change notification settings - Fork 21
feat(discovery): add vlan over bond interface support #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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]>
📝 WalkthroughWalkthroughThis 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
Summary of ChangesHello @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 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 AssistThe 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
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 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
|
There was a problem hiding this 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.
| {{- /* 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 -}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| {{- /* 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 -}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Summary
New helpers
talm.discovered.is_vlan- check if link kind is vlantalm.discovered.parent_link_name- find parent link name by linkIndextalm.discovered.vlan_id- extract vlanID from link specTest plan
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.