diff --git a/mgradm/cmd/install/kubernetes/utils.go b/mgradm/cmd/install/kubernetes/utils.go index 7d9b777d3..5dcb9e591 100644 --- a/mgradm/cmd/install/kubernetes/utils.go +++ b/mgradm/cmd/install/kubernetes/utils.go @@ -70,6 +70,7 @@ func installForKubernetes(globalFlags *types.GlobalFlags, // Deploy Uyuni and wait for it to be up if err := kubernetes.Deploy( + L("Initial deployment from mgradm install"), cnx, flags.Image.Registry, &flags.Image, &flags.HubXmlrpc, &flags.Helm, &flags.Ssl, clusterInfos, fqdn, flags.Debug.Java, false, helmArgs..., ); err != nil { diff --git a/mgradm/cmd/migrate/kubernetes/utils.go b/mgradm/cmd/migrate/kubernetes/utils.go index 785c578be..8e5660632 100644 --- a/mgradm/cmd/migrate/kubernetes/utils.go +++ b/mgradm/cmd/migrate/kubernetes/utils.go @@ -84,7 +84,9 @@ func migrateToKubernetes( var sslFlags adm_utils.SslCertFlags // Deploy for running migration command - if err := kubernetes.Deploy(cnx, flags.Image.Registry, &flags.Image, &flags.HubXmlrpc, + if err := kubernetes.Deploy( + fmt.Sprintf(L("Deploy to migrate the data from %s"), fqdn), + cnx, flags.Image.Registry, &flags.Image, &flags.HubXmlrpc, &flags.Helm, &sslFlags, clusterInfos, fqdn, false, flags.Prepare, "--set", "migration.ssh.agentSocket="+sshAuthSocket, "--set", "migration.ssh.configPath="+sshConfigPath, @@ -147,6 +149,7 @@ func migrateToKubernetes( // Run uyuni upgrade using the new ssl certificate // We don't need to start the Hub XML-RPC API containers during the setup phase err = kubernetes.UyuniUpgrade( + L("Upgrade with final volumes"), serverImage, flags.Image.PullPolicy, 0, hubXmlrpcImage, &flags.Helm, kubeconfig, fqdn, clusterInfos.Ingress, helmArgs..., ) @@ -191,7 +194,9 @@ func migrateToKubernetes( // This is the final deployment, all the replicas need to be correct here. err = kubernetes.UyuniUpgrade( - serverImage, flags.Image.PullPolicy, hubReplicas, hubXmlrpcImage, &flags.Helm, kubeconfig, fqdn, clusterInfos.Ingress, helmArgs..., + L("Complete deployment after migration"), + serverImage, flags.Image.PullPolicy, hubReplicas, hubXmlrpcImage, &flags.Helm, kubeconfig, fqdn, + clusterInfos.Ingress, helmArgs..., ) if err != nil { return utils.Errorf(err, L("cannot upgrade to image %s"), serverImage) diff --git a/mgradm/shared/kubernetes/install.go b/mgradm/shared/kubernetes/install.go index e560604ab..90424af7c 100644 --- a/mgradm/shared/kubernetes/install.go +++ b/mgradm/shared/kubernetes/install.go @@ -25,6 +25,7 @@ const HELM_APP_NAME = "uyuni" // Deploy execute a deploy of a given image and helm to a cluster. func Deploy( + reason string, cnx *shared.Connection, registry string, imageFlags *types.ImageFlags, @@ -60,7 +61,10 @@ func Deploy( } // Install the uyuni server helm chart - err = UyuniUpgrade(serverImage, imageFlags.PullPolicy, hubXmlrpcFlags.Replicas, hubXmlrpcImage, helmFlags, clusterInfos.GetKubeconfig(), fqdn, clusterInfos.Ingress, helmArgs...) + err = UyuniUpgrade( + reason, serverImage, imageFlags.PullPolicy, hubXmlrpcFlags.Replicas, hubXmlrpcImage, + helmFlags, clusterInfos.GetKubeconfig(), fqdn, clusterInfos.Ingress, helmArgs..., + ) if err != nil { return utils.Errorf(err, L("cannot upgrade")) } @@ -106,8 +110,18 @@ func DeployExistingCertificate(helmFlags *cmd_utils.HelmFlags, sslFlags *cmd_uti } // UyuniUpgrade runs an helm upgrade using images and helm configuration as parameters. -func UyuniUpgrade(serverImage string, pullPolicy string, hubXmlrpcReplicas int, hubXmlrpcImage string, helmFlags *cmd_utils.HelmFlags, kubeconfig string, - fqdn string, ingress string, helmArgs ...string) error { +func UyuniUpgrade( + reason string, + serverImage string, + pullPolicy string, + hubXmlrpcReplicas int, + hubXmlrpcImage string, + helmFlags *cmd_utils.HelmFlags, + kubeconfig string, + fqdn string, + ingress string, + helmArgs ...string, +) error { log.Info().Msg(L("Installing Uyuni")) // The guessed ingress is passed before the user's value to let the user override it in case we got it wrong. @@ -124,7 +138,9 @@ func UyuniUpgrade(serverImage string, pullPolicy string, hubXmlrpcReplicas int, helmParams = append(helmParams, "--set", "images.server="+serverImage, "--set", "pullPolicy="+kubernetes.GetPullPolicy(pullPolicy), - "--set", "fqdn="+fqdn) + "--set", "fqdn="+fqdn, + "--description", reason, + ) if hubXmlrpcReplicas > 0 { log.Info().Msg(L("Enabling Hub XMLRPC API container.")) @@ -252,7 +268,11 @@ func Upgrade( hubXmlrpcReplicas = 1 } - err = UyuniUpgrade(serverImage, image.PullPolicy, hubXmlrpcReplicas, hubXmlrpcImageName, &helm, kubeconfig, fqdn, clusterInfos.Ingress) + err = UyuniUpgrade( + L("Upgrade from mgradm"), + serverImage, image.PullPolicy, hubXmlrpcReplicas, hubXmlrpcImageName, + &helm, kubeconfig, fqdn, clusterInfos.Ingress, + ) if err != nil { return utils.Errorf(err, L("cannot upgrade to image %s"), serverImage) }