fix: use load balancer network IP for private-only deployments#1828
Conversation
Fixes #1809 When control_plane_lb_enable_public_interface is false, the code was trying to use hcloud_load_balancer.control_plane.*.network_ip[0] which returns null. This causes the kubeconfig generation to fail with 'Invalid value for replace parameter: argument must not be null' error. The fix uses hcloud_load_balancer_network.control_plane.*.ip[0] instead, which correctly references the IP address configured in the load balancer network resource. This change is backward compatible as it only affects the private IP configuration path when the load balancer public interface is disabled.
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a kubeconfig generation error in private-only deployments by updating the reference from the deprecated network_ip attribute to the correct hcloud_load_balancer_network resource IP. The fix ensures that terraform can properly access the load balancer's private network IP when public interfaces are disabled.
- Updates load balancer network IP reference for private-only configurations
- Maintains backward compatibility by only affecting the private IP path
- Resolves terraform plan errors in private deployments
There was a problem hiding this comment.
Summary of Changes
Hello @mysticaltech, 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 provides a crucial fix for users deploying private-only Kubernetes clusters by ensuring the correct load balancer IP is used during kubeconfig generation. It addresses a bug where a deprecated attribute was referenced, leading to errors in private IP configurations. This change enhances the stability and usability of private cluster setups while maintaining backward compatibility for existing public deployments.
Highlights
- Bug Fix for Private Deployments: Corrected an issue where kubeconfig generation failed for private-only Kubernetes cluster deployments due to an incorrect reference to the load balancer's private IP.
- Terraform Resource Update: Updated the Terraform configuration in
kubeconfig.tfto use thehcloud_load_balancer_networkresource'sipattribute for private IP resolution, replacing a deprecatednetwork_ipattribute. - Build Environment Improvement: Added
requirements/*to.gitignoreto prevent Python dependency directories from being tracked.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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 or fill out our survey to provide feedback.
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
-
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. ↩
There was a problem hiding this comment.
Code Review
This pull request correctly replaces a deprecated network_ip attribute with the current hcloud_load_balancer_network.control_plane.ip to fix kubeconfig generation for private-only deployments. The change is well-targeted and addresses the described issue. I've added one suggestion to improve the code's robustness and clarity by using Terraform's one() function. Overall, a good fix.
Summary
network_ipto the correcthcloud_load_balancer_networkIPFixes #1809