From 8a7cda5dd1111cdece4b0252642c1839a28b9e77 Mon Sep 17 00:00:00 2001 From: dwertent Date: Tue, 26 Oct 2021 20:27:33 +0300 Subject: [PATCH 1/2] adopt cluster name --- cautils/customerloader.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cautils/customerloader.go b/cautils/customerloader.go index 44b79930..c77347f0 100644 --- a/cautils/customerloader.go +++ b/cautils/customerloader.go @@ -243,7 +243,7 @@ func (c *ClusterConfig) setCustomerGUID(customerGUID string) { } func (c *ClusterConfig) setClusterName(clusterName string) { - c.configObj.ClusterName = clusterName + c.configObj.ClusterName = adoptClusterName(clusterName) } func (c *ClusterConfig) GetClusterName() string { return c.configObj.ClusterName @@ -472,3 +472,7 @@ func DeleteConfigMap(k8s *k8sinterface.KubernetesApi) error { func DeleteConfigFile() error { return os.Remove(ConfigFileFullPath()) } + +func adoptClusterName(clusterName string) string { + return strings.ReplaceAll(clusterName, "/", "-") +} From 66068757e1b5a78b3fa79b2e62848a3953312285 Mon Sep 17 00:00:00 2001 From: dwertent Date: Tue, 26 Oct 2021 20:39:18 +0300 Subject: [PATCH 2/2] update cluster name in mock struct --- cautils/customerloader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cautils/customerloader.go b/cautils/customerloader.go index c77347f0..dce4a9db 100644 --- a/cautils/customerloader.go +++ b/cautils/customerloader.go @@ -129,7 +129,7 @@ func (c *EmptyConfig) GetCustomerGUID() string { return "" } func (c *EmptyConfig) GetK8sAPI() *k8sinterface.KubernetesApi { return nil } // TODO: return mock obj func (c *EmptyConfig) GetDefaultNS() string { return k8sinterface.GetDefaultNamespace() } func (c *EmptyConfig) GetBackendAPI() getter.IBackend { return nil } // TODO: return mock obj -func (c *EmptyConfig) GetClusterName() string { return k8sinterface.GetClusterName() } +func (c *EmptyConfig) GetClusterName() string { return adoptClusterName(k8sinterface.GetClusterName()) } func (c *EmptyConfig) GenerateURL() { message := fmt.Sprintf("\nCheckout for more cool features: https://%s\n", getter.GetArmoAPIConnector().GetFrontendURL()) InfoTextDisplay(os.Stdout, fmt.Sprintf("\n%s\n", message))