Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions internal/cmd/ske/kubeconfig/login/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
}

type clusterConfig struct {
STACKITProjectID string `json:"stackitProjectId"`
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) {
Expand Down Expand Up @@ -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
}
Expand Down
Loading