From a0bb10cfb9a403fe317f6aca844d43edea6d329c Mon Sep 17 00:00:00 2001 From: Vishesh Date: Wed, 3 Jul 2024 12:16:22 +0530 Subject: [PATCH] Fix cks cluster sync for a normal user --- pkg/cloud/cks_cluster.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/cloud/cks_cluster.go b/pkg/cloud/cks_cluster.go index 279a0713..d13dc849 100644 --- a/pkg/cloud/cks_cluster.go +++ b/pkg/cloud/cks_cluster.go @@ -74,10 +74,11 @@ func (c *client) GetOrCreateCksCluster(cluster *clusterv1.Cluster, csCluster *in if accountName == "" { userParams := c.cs.User.NewGetUserParams(c.config.APIKey) user, err := c.cs.User.GetUser(userParams) - if err != nil { + if err != nil && !strings.Contains(err.Error(), "does not exist or is not available for the account") { return err + } else if err == nil { + accountName = user.Account } - accountName = user.Account } // NewCreateKubernetesClusterParams(description string, kubernetesversionid string, name string, serviceofferingid string, size int64, zoneid string) *CreateKubernetesClusterParams params := c.cs.Kubernetes.NewCreateKubernetesClusterParams(fmt.Sprintf("%s managed by CAPC", clusterName), "", clusterName, "", 0, fd.Zone.ID)