mirror of
https://github.com/rancher/k3k.git
synced 2026-08-23 22:36:17 +00:00
Add server URL handling in cluster creation and enhance kubeconfig tests (#1050)
This commit is contained in:
@@ -29,6 +29,7 @@ import (
|
||||
"github.com/rancher/k3k/pkg/apis/k3k.io/v1beta1"
|
||||
"github.com/rancher/k3k/pkg/controller"
|
||||
k3kcluster "github.com/rancher/k3k/pkg/controller/cluster"
|
||||
"github.com/rancher/k3k/pkg/controller/cluster/server"
|
||||
)
|
||||
|
||||
type CreateConfig struct {
|
||||
@@ -198,6 +199,15 @@ func createAction(appCtx *AppContext, config *CreateConfig) func(cmd *cobra.Comm
|
||||
return err
|
||||
}
|
||||
|
||||
serverURL, err := server.ServerURL(ctx, client, cluster, host)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, kubeCluster := range kubeconfig.Clusters {
|
||||
kubeCluster.Server = serverURL.String()
|
||||
}
|
||||
|
||||
if err := writeKubeconfigFile(cluster, kubeconfig, ""); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user