Skip to content

Commit b963225

Browse files
authored
feat: overwrite images tar bundle in k0s data directory on upgrade (#1430)
1 parent 1d1249d commit b963225

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

cmd/local-artifact-mirror/pull.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ import (
2424
// These constant define the expected names of the files in the registry.
2525
const (
2626
EmbeddedClusterBinaryArtifactName = "embedded-cluster-amd64"
27-
ImagesArtifactName = "images-amd64.tar"
27+
ImagesSrcArtifactName = "images-amd64.tar"
28+
ImagesDstArtifactName = "ec-images-amd64.tar"
2829
HelmChartsArtifactName = "charts.tar.gz"
2930
)
3031

@@ -86,8 +87,8 @@ var imagesCommand = &cli.Command{
8687
os.RemoveAll(location)
8788
}()
8889

89-
dst := filepath.Join(provider.EmbeddedClusterImagesSubDir(), ImagesArtifactName)
90-
src := filepath.Join(location, ImagesArtifactName)
90+
dst := filepath.Join(provider.EmbeddedClusterImagesSubDir(), ImagesDstArtifactName)
91+
src := filepath.Join(location, ImagesSrcArtifactName)
9192
logrus.Infof("%s > %s", src, dst)
9293
if err := helpers.MoveFile(src, dst); err != nil {
9394
return fmt.Errorf("unable to move images bundle: %w", err)

operator/pkg/artifacts/upgrade.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ var copyArtifactsJob = &batchv1.Job{
8282
"/usr/local/bin/local-artifact-mirror pull helmcharts --data-dir /embedded-cluster $INSTALLATION_DATA\n" +
8383
"mv /embedded-cluster/bin/k0s /embedded-cluster/bin/k0s-upgrade\n" +
8484
"rm /embedded-cluster/images/images-amd64-* || true\n" +
85-
"cd /embedded-cluster/images/\n" +
86-
"mv images-amd64.tar images-amd64-${INSTALLATION}.tar\n" +
8785
"echo 'done'",
8886
},
8987
},
@@ -262,8 +260,8 @@ func CreateAutopilotAirgapPlanCommand(ctx context.Context, cli client.Client, in
262260
}
263261

264262
imageURL := fmt.Sprintf(
265-
"http://127.0.0.1:%d/images/images-amd64-%s.tar",
266-
provider.LocalArtifactMirrorPort(), in.Name,
263+
"http://127.0.0.1:%d/images/ec-images-amd64.tar",
264+
provider.LocalArtifactMirrorPort(),
267265
)
268266

269267
return &autopilotv1beta2.PlanCommand{

0 commit comments

Comments
 (0)