Skip to content

fix: use load balancer network IP for private-only deployments#1828

Merged
mysticaltech merged 1 commit into
masterfrom
fix/issue-1809-private-ip-kubeconfig
Jul 27, 2025
Merged

fix: use load balancer network IP for private-only deployments#1828
mysticaltech merged 1 commit into
masterfrom
fix/issue-1809-private-ip-kubeconfig

Conversation

@mysticaltech
Copy link
Copy Markdown
Owner

@mysticaltech mysticaltech commented Jul 27, 2025

Summary

  • Fixes the kubeconfig generation error when using private-only deployments
  • Changes the reference from deprecated network_ip to the correct hcloud_load_balancer_network IP
  • Ensures backward compatibility by only affecting the private IP configuration path

Fixes #1809

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.
Copilot AI review requested due to automatic review settings July 27, 2025 15:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

Comment thread kubeconfig.tf
Copy link
Copy Markdown
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.

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.tf to use the hcloud_load_balancer_network resource's ip attribute for private IP resolution, replacing a deprecated network_ip attribute.
  • Build Environment Improvement: Added requirements/* to .gitignore to 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

  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.

Copy link
Copy Markdown
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 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.

Comment thread kubeconfig.tf
@mysticaltech mysticaltech merged commit c9b47fc into master Jul 27, 2025
3 checks passed
@mysticaltech mysticaltech deleted the fix/issue-1809-private-ip-kubeconfig branch July 27, 2025 15:43
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.

[Bug]: Cannot creare cluster with private ips only

2 participants