Skip to content

Commit

Permalink
feat: overwrite images tar bundle in k0s data directory on upgrade (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
emosbaugh authored Oct 31, 2024
1 parent 1d1249d commit b963225
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 4 additions & 3 deletions cmd/local-artifact-mirror/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions operator/pkg/artifacts/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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'",
},
},
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit b963225

Please sign in to comment.