From b963225579cfe289588d429b49ec9b224c9d1dbc Mon Sep 17 00:00:00 2001 From: Ethan Mosbaugh Date: Thu, 31 Oct 2024 15:24:59 -0500 Subject: [PATCH] feat: overwrite images tar bundle in k0s data directory on upgrade (#1430) --- cmd/local-artifact-mirror/pull.go | 7 ++++--- operator/pkg/artifacts/upgrade.go | 6 ++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cmd/local-artifact-mirror/pull.go b/cmd/local-artifact-mirror/pull.go index 75a546355..a5cb92abe 100644 --- a/cmd/local-artifact-mirror/pull.go +++ b/cmd/local-artifact-mirror/pull.go @@ -24,7 +24,8 @@ import ( // These constant define the expected names of the files in the registry. const ( EmbeddedClusterBinaryArtifactName = "embedded-cluster-amd64" - ImagesArtifactName = "images-amd64.tar" + ImagesSrcArtifactName = "images-amd64.tar" + ImagesDstArtifactName = "ec-images-amd64.tar" HelmChartsArtifactName = "charts.tar.gz" ) @@ -86,8 +87,8 @@ var imagesCommand = &cli.Command{ os.RemoveAll(location) }() - dst := filepath.Join(provider.EmbeddedClusterImagesSubDir(), ImagesArtifactName) - src := filepath.Join(location, ImagesArtifactName) + dst := filepath.Join(provider.EmbeddedClusterImagesSubDir(), ImagesDstArtifactName) + src := filepath.Join(location, ImagesSrcArtifactName) logrus.Infof("%s > %s", src, dst) if err := helpers.MoveFile(src, dst); err != nil { return fmt.Errorf("unable to move images bundle: %w", err) diff --git a/operator/pkg/artifacts/upgrade.go b/operator/pkg/artifacts/upgrade.go index bc8fe5083..36b8f81b4 100644 --- a/operator/pkg/artifacts/upgrade.go +++ b/operator/pkg/artifacts/upgrade.go @@ -82,8 +82,6 @@ var copyArtifactsJob = &batchv1.Job{ "/usr/local/bin/local-artifact-mirror pull helmcharts --data-dir /embedded-cluster $INSTALLATION_DATA\n" + "mv /embedded-cluster/bin/k0s /embedded-cluster/bin/k0s-upgrade\n" + "rm /embedded-cluster/images/images-amd64-* || true\n" + - "cd /embedded-cluster/images/\n" + - "mv images-amd64.tar images-amd64-${INSTALLATION}.tar\n" + "echo 'done'", }, }, @@ -262,8 +260,8 @@ func CreateAutopilotAirgapPlanCommand(ctx context.Context, cli client.Client, in } imageURL := fmt.Sprintf( - "http://127.0.0.1:%d/images/images-amd64-%s.tar", - provider.LocalArtifactMirrorPort(), in.Name, + "http://127.0.0.1:%d/images/ec-images-amd64.tar", + provider.LocalArtifactMirrorPort(), ) return &autopilotv1beta2.PlanCommand{