Skip to content

Commit

Permalink
feat(user feedback): count lam as an embedded cluster artifact (#4703)
Browse files Browse the repository at this point in the history
instead of showing lam image push in a different section of the kots
output we should count it as part of the embedded cluster artifacts.

output:
```
root@bold-sky:/home/dev# ./kots install embedded-cluster-smoke-test-staging-app/ci-airgap --license-file ./license.yaml --namespace kotsadm --app-version-label appver-dev-c51b55a --exclude-admin-console --airgap-bundle ./embedded-cluster-smoke-test-staging-app.airgap
  • Validating registry information ✓
  • Deploying application
Pushing application images (1/1)
Pushing image 10.96.0.11:5000/embedded-cluster-smoke-test-staging-app/nginx:1.24-alpine
Copying blob da33b1ad0ac4 skipped: already exists
Copying blob 16eaaaf5f1c0 skipped: already exists
Copying blob b407bcc80638 skipped: already exists
Copying blob a0fbd691d7c1 skipped: already exists
Copying blob 3c854c8cbf46 skipped: already exists
Copying blob de5d475193dd skipped: already exists
Copying blob 5e845cc16269 skipped: already exists
Copying config 249f59e1de done   |
Writing manifest to image destination
Pushing embedded cluster artifacts (1/7)
Pushing image 10.96.0.11:5000/embedded-cluster-smoke-test-staging-app/embedded-cluster/embedded-cluster-local-artifact-mirror:dev-c51b55a
Copying blob 4ea89e459bc7 skipped: already exists
Copying blob dc4977db5b1f skipped: already exists
Copying config 0ed66a3165 done   |
Writing manifest to image destination
Pushing embedded cluster artifacts (2/7)
Pushing embedded cluster artifacts (3/7)
Pushing embedded cluster artifacts (4/7)
Pushing embedded cluster artifacts (5/7)
Pushing embedded cluster artifacts (6/7)
Pushing embedded cluster artifacts (7/7)
  • Waiting for Admin Console to be ready ✓
  • Uploading app archive
  • Waiting for installation to complete ✗
Error: failed to validate installation: license already exists for app embedded-cluster-smoke-test-staging-app
root@bold-sky:/home/dev#
```
  • Loading branch information
ricardomaraschini authored Jun 21, 2024
1 parent dcb7a8b commit 68b0554
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
github.com/replicatedhq/embedded-cluster-kinds v1.3.10
github.com/replicatedhq/kotskinds v0.0.0-20240617103853-2058b19a0c7c
github.com/replicatedhq/kotskinds v0.0.0-20240621084729-1eb1e3eac6f2
github.com/replicatedhq/kurlkinds v1.5.0
github.com/replicatedhq/troubleshoot v0.92.2
github.com/replicatedhq/yaml/v3 v3.0.0-beta5-replicatedhq
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1310,8 +1310,8 @@ github.com/redis/go-redis/v9 v9.1.0/go.mod h1:urWj3He21Dj5k4TK1y59xH8Uj6ATueP8AH
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
github.com/replicatedhq/embedded-cluster-kinds v1.3.10 h1:nANfyym6NGwkdY9jVhRR4zClQT2YBskIjs60g+VfFfs=
github.com/replicatedhq/embedded-cluster-kinds v1.3.10/go.mod h1:AwopUvvGcaWO4mn9DkbPj5RnLuOy756CNLrcaAlmjMo=
github.com/replicatedhq/kotskinds v0.0.0-20240617103853-2058b19a0c7c h1:CwPf225IhH7JAMQgwa9F5XYoaB6c21s4hla6jVCyAoc=
github.com/replicatedhq/kotskinds v0.0.0-20240617103853-2058b19a0c7c/go.mod h1:QjhIUu3+OmHZ09u09j3FCoTt8F3BYtQglS+OLmftu9I=
github.com/replicatedhq/kotskinds v0.0.0-20240621084729-1eb1e3eac6f2 h1:xL4u2RHhMaGDgz7Lol5MhVYLnWahV3sCJZbfebpPao0=
github.com/replicatedhq/kotskinds v0.0.0-20240621084729-1eb1e3eac6f2/go.mod h1:QjhIUu3+OmHZ09u09j3FCoTt8F3BYtQglS+OLmftu9I=
github.com/replicatedhq/kurlkinds v1.5.0 h1:zZ0PKNeh4kXvSzVGkn62DKTo314GxhXg1TSB3azURMc=
github.com/replicatedhq/kurlkinds v1.5.0/go.mod h1:rUpBMdC81IhmJNCWMU/uRsMETv9P0xFoMvdSP/TAr5A=
github.com/replicatedhq/termui/v3 v3.1.1-0.20200811145416-f40076d26851 h1:eRlNDHxGfVkPCRXbA4BfQJvt5DHjFiTtWy3R/t4djyY=
Expand Down
14 changes: 11 additions & 3 deletions pkg/image/airgap.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ func PushECImagesFromTempRegistry(airgapRootDir string, airgap *kotsv1beta1.Airg
defer wc.Close()
}

totalImages := len(imageInfos)
var imageCounter int
for imageID, imageInfo := range imageInfos {
srcRef, err := tempRegistry.SrcRef(imageID)
Expand Down Expand Up @@ -288,7 +287,10 @@ func PushECImagesFromTempRegistry(airgapRootDir string, airgap *kotsv1beta1.Airg
},
}
imageCounter++
fmt.Printf("Pushing embedded cluster images (%d/%d)\n", imageCounter, totalImages)
fmt.Printf(
"Pushing embedded cluster artifacts (%d/%d)\n",
imageCounter, airgap.Spec.EmbeddedClusterArtifacts.Total(),
)
if err := pushImage(pushImageOpts); err != nil {
return errors.Wrapf(err, "failed to push image %s", imageID)
}
Expand Down Expand Up @@ -854,6 +856,11 @@ func PushEmbeddedClusterArtifacts(airgapBundle string, artifactsToPush *kotsv1be
artifacts = append(artifacts, dstFilePath)
}

var alreadyPushedArtifacts int
if artifactsToPush != nil {
alreadyPushedArtifacts = len(artifactsToPush.Registry.SavedImages)
}

for i, dstFilePath := range artifacts {
ociArtifactPath := imageutil.NewEmbeddedClusterOCIArtifactPath(dstFilePath, imageutil.EmbeddedClusterArtifactOCIPathOptions{
RegistryHost: opts.Registry.Endpoint,
Expand All @@ -878,7 +885,8 @@ func PushEmbeddedClusterArtifacts(airgapBundle string, artifactsToPush *kotsv1be
HTTPClient: opts.HTTPClient,
}

fmt.Printf("Pushing embedded cluster artifacts (%d/%d)\n", i+1, len(artifacts))
currentArtifact := i + 1 + alreadyPushedArtifacts
fmt.Printf("Pushing embedded cluster artifacts (%d/%d)\n", currentArtifact, artifactsToPush.Total())
if err := pushOCIArtifact(pushOCIArtifactOpts); err != nil {
return errors.Wrapf(err, "failed to push oci artifact %s", ociArtifactPath.Name)
}
Expand Down

0 comments on commit 68b0554

Please sign in to comment.