mirror of
https://github.com/rancher/k3k.git
synced 2026-08-18 20:07:06 +00:00
Refactor kubeconfig URL generation (#938)
* Refactor kubeconfig generation to remove unused port parameter and update related functions * Refactor kubeconfig generation to streamline error handling and remove unused imports * Refactor kubeconfig URL generation functions and deprecate old implementation * restore old behavior * Add 'k3kcli kubeconfig get' command and update documentation * Refactor URL generation by removing deprecated getURLFromService function and updating tests to use new implementation * Fix expected URL for LoadBalancer test case to include hostname * Refactor kubeconfig test documentation to clarify URL generation behavior for ClusterIP, NodePort, and LoadBalancer service types * Refactor kubeconfig URL generation functions to improve clarity and maintainability * Remove deprecated 'k3kcli kubeconfig get' command and update related documentation * Set logger to discard in NewRootCmd for improved logging control * Refactor getURLFromService to streamline ingress key retrieval
This commit is contained in:
@@ -191,7 +191,7 @@ func NewVirtualK8sClientAndConfig(cluster *v1beta1.Cluster) (*kubernetes.Clients
|
||||
vKubeconfig := kubeconfig.New()
|
||||
kubeletAltName := fmt.Sprintf("k3k-%s-kubelet", cluster.Name)
|
||||
vKubeconfig.AltNames = certs.AddSANs([]string{hostIP, kubeletAltName})
|
||||
config, err = vKubeconfig.Generate(ctx, k8sClient, cluster, hostIP, 0)
|
||||
config, err = vKubeconfig.Generate(ctx, k8sClient, cluster, hostIP)
|
||||
|
||||
return err
|
||||
}).
|
||||
@@ -225,7 +225,7 @@ func NewVirtualK8sClientAndKubeconfig(cluster *v1beta1.Cluster) (*kubernetes.Cli
|
||||
vKubeconfig := kubeconfig.New()
|
||||
kubeletAltName := fmt.Sprintf("k3k-%s-kubelet", cluster.Name)
|
||||
vKubeconfig.AltNames = certs.AddSANs([]string{hostIP, kubeletAltName})
|
||||
config, err = vKubeconfig.Generate(ctx, k8sClient, cluster, hostIP, 0)
|
||||
config, err = vKubeconfig.Generate(ctx, k8sClient, cluster, hostIP)
|
||||
|
||||
return err
|
||||
}).
|
||||
|
||||
Reference in New Issue
Block a user