From dd1c3004d76734ffbb94022120e06677e4d45d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Wed, 7 Aug 2024 11:54:04 +0200 Subject: [PATCH] Refresh the connection after the k8s migration After the k8s migration the pod has been started again since the initial connection creation. We need to reset the connection to not search for the old pod name. --- mgradm/cmd/migrate/kubernetes/utils.go | 2 ++ mgradm/shared/kubernetes/install.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mgradm/cmd/migrate/kubernetes/utils.go b/mgradm/cmd/migrate/kubernetes/utils.go index a3f72886a..ed1bf182a 100644 --- a/mgradm/cmd/migrate/kubernetes/utils.go +++ b/mgradm/cmd/migrate/kubernetes/utils.go @@ -197,6 +197,8 @@ func migrateToKubernetes( return err } + // Reinitialize the connection since the pod name has changed since we first checked + cnx = shared.NewConnection("kubectl", "", shared_kubernetes.ServerFilter) if err := cnx.CopyCaCertificate(fqdn); err != nil { return utils.Errorf(err, L("failed to add SSL CA certificate to host trusted certificates")) } diff --git a/mgradm/shared/kubernetes/install.go b/mgradm/shared/kubernetes/install.go index 9e0e7f49c..a8b561618 100644 --- a/mgradm/shared/kubernetes/install.go +++ b/mgradm/shared/kubernetes/install.go @@ -73,7 +73,7 @@ func Deploy( return cnx.WaitForServer() } -// DeployCertificate executre a deploy a new certificate given an helm. +// DeployCertificate deploys a new SSL certificate. func DeployCertificate(helmFlags *cmd_utils.HelmFlags, sslFlags *cmd_utils.SslCertFlags, rootCa string, ca *ssl.SslPair, kubeconfig string, fqdn string, imagePullPolicy string) ([]string, error) { helmArgs := []string{}