From 4454e7b88125d5815a7d4a344d9d8a8bc8c50c52 Mon Sep 17 00:00:00 2001 From: Jia Deng <116687363+ddjjia@users.noreply.github.com> Date: Fri, 8 Sep 2023 16:22:28 -0700 Subject: [PATCH] fix cli upgrade mgmt kubeconfig flag (#6666) * fix cli upgrade mgmt kubeconfig flag * move to common validation --- cmd/eksctl-anywhere/cmd/upgradecluster.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/eksctl-anywhere/cmd/upgradecluster.go b/cmd/eksctl-anywhere/cmd/upgradecluster.go index 225fc4e083d0..6a1d3cdce8f7 100644 --- a/cmd/eksctl-anywhere/cmd/upgradecluster.go +++ b/cmd/eksctl-anywhere/cmd/upgradecluster.go @@ -214,6 +214,11 @@ func (uc *upgradeClusterOptions) commonValidations(ctx context.Context) (cluster return nil, err } + if uc.wConfig == "" && uc.managementKubeconfig != "" && clusterConfig.IsSelfManaged() { + uc.wConfig = uc.managementKubeconfig + uc.managementKubeconfig = "" + } + kubeconfigPath := getKubeconfigPath(clusterConfig.Name, uc.wConfig) if err := kubeconfig.ValidateFilename(kubeconfigPath); err != nil { return nil, err