Skip to content

Commit

Permalink
Switch to load balancer context by default
Browse files Browse the repository at this point in the history
  • Loading branch information
vitobotta committed Jan 28, 2025
1 parent 8e62037 commit 3f8a96a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/kubernetes/installer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,10 @@ class Kubernetes::Installer

paths = ([load_balancer_kubeconfig_path] + masters.map { |master| "#{kubeconfig_path}-#{master.name}" }).join(":")

system("KUBECONFIG=#{paths} kubectl config view --flatten > #{kubeconfig_path}")
system("KUBECONFIG=#{kubeconfig_path} kubectl config use-context #{first_master.name}")
default_context = load_balancer.nil? ? first_master.name : settings.cluster_name

run_shell_command("KUBECONFIG=#{paths} kubectl config view --flatten > #{kubeconfig_path}", "", settings.hetzner_token, log_prefix: "Control plane")
run_shell_command("KUBECONFIG=#{kubeconfig_path} kubectl config use-context #{default_context}", "", settings.hetzner_token, log_prefix: "Control plane")

masters.each do |master|
FileUtils.rm("#{kubeconfig_path}-#{master.name}")
Expand Down

0 comments on commit 3f8a96a

Please sign in to comment.