From b3b895ac8e4c7b693bdfd94628a23893d51f9f71 Mon Sep 17 00:00:00 2001 From: Kai Kummerer Date: Fri, 12 Sep 2025 16:10:52 +0200 Subject: [PATCH 1/2] fix STACKITProjectID json key This wasn't really an issue as unmarshal does prefer an "exact match but also accepting a case-insensitive match" --- internal/cmd/ske/kubeconfig/login/login.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/cmd/ske/kubeconfig/login/login.go b/internal/cmd/ske/kubeconfig/login/login.go index 3edc33b1f..8974291bb 100644 --- a/internal/cmd/ske/kubeconfig/login/login.go +++ b/internal/cmd/ske/kubeconfig/login/login.go @@ -120,7 +120,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command { } type clusterConfig struct { - STACKITProjectID string `json:"stackitProjectId"` + STACKITProjectID string `json:"stackitProjectID"` ClusterName string `json:"clusterName"` cacheKey string From 2ae33a1336bde3376eea1eadf06c3eb518990ab1 Mon Sep 17 00:00:00 2001 From: Kai Kummerer Date: Fri, 12 Sep 2025 16:14:17 +0200 Subject: [PATCH 2/2] get region from execCredential cluster config and fallback to region from CLI flag --- internal/cmd/ske/kubeconfig/login/login.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/cmd/ske/kubeconfig/login/login.go b/internal/cmd/ske/kubeconfig/login/login.go index 8974291bb..e51f69c63 100644 --- a/internal/cmd/ske/kubeconfig/login/login.go +++ b/internal/cmd/ske/kubeconfig/login/login.go @@ -122,9 +122,9 @@ func NewCmd(params *params.CmdParams) *cobra.Command { type clusterConfig struct { STACKITProjectID string `json:"stackitProjectID"` ClusterName string `json:"clusterName"` + Region string `json:"region"` cacheKey string - Region string } func parseClusterConfig(p *print.Printer, cmd *cobra.Command) (*clusterConfig, error) { @@ -157,8 +157,10 @@ func parseClusterConfig(p *print.Printer, cmd *cobra.Command) (*clusterConfig, e config.cacheKey = fmt.Sprintf("ske-login-%x", sha256.Sum256([]byte(execCredential.Spec.Cluster.Server))) - globalFlags := globalflags.Parse(p, cmd) - config.Region = globalFlags.Region + // NOTE: Fallback if region is not set in the kubeconfig (this was the case in the past) + if config.Region == "" { + config.Region = globalflags.Parse(p, cmd).Region + } return config, nil }