Last active
April 11, 2025 16:59
-
-
Save erdii/2e8a6907ad1f8ce136d8eabef6303df6 to your computer and use it in GitHub Desktop.
Install package-operator from mirrored image artifacts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euxo pipefail | |
skopeo copy --all \ | |
docker://quay.io/package-operator/package-operator-package:v1.18.2 \ | |
docker://quay.io/erdii-test/pko-mirror/package-operator-package:v1.18.2 | |
skopeo copy --all \ | |
docker://quay.io/package-operator/package-operator-manager:v1.18.2 \ | |
docker://quay.io/erdii-test/pko-mirror/package-operator-manager:v1.18.2 | |
skopeo copy --all \ | |
docker://quay.io/package-operator/remote-phase-manager:v1.18.2 \ | |
docker://quay.io/erdii-test/pko-mirror/remote-phase-manager:v1.18.2 | |
curl -LO https://github.com/package-operator/package-operator/releases/download/v1.18.2/self-bootstrap-job.yaml | |
yq -i 'with( | |
select(.kind == "Job").spec.template.spec.containers[] | |
| select(.name == "package-operator").env[] | |
| select(.name == "PKO_IMAGE_PREFIX_OVERRIDES") | |
; .value = "quay.io/package-operator/=quay.io/erdii-test/pko-mirror/" | |
)' self-bootstrap-job.yaml | |
yq -i 'with( | |
select(.kind == "Job").spec.template.spec.containers[] | |
| select(.name == "package-operator") | |
; ( | |
.image |= sub("quay.io/package-operator", "quay.io/erdii-test/pko-mirror"), | |
.args[0] |= sub("quay.io/package-operator", "quay.io/erdii-test/pko-mirror") | |
) | |
)' self-bootstrap-job.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set Theme cyberpunk | |
Set Padding 30 | |
Set Margin 80 | |
Set MarginFill "#674EFF" | |
Set WindowBar Colorful | |
Set WindowBarSize 40 | |
Set BorderRadius 8 | |
Output mirror.webm | |
Require curl | |
Require skopeo | |
Require yq | |
Require podman | |
Require kind | |
Set Shell "bash" | |
Set FontSize 24 | |
Set Width 1600 | |
Set Height 900 | |
Type "# How to mirror upstream PKO release artifacts to another location." Sleep 500ms Enter | |
Enter | |
Sleep 3s | |
Type "# We'll use skopeo to mirror the release images." Sleep 500ms Enter | |
Type "# Then we'll download and patch the self-bootstrap job manifest file." Sleep 500ms Enter | |
Type "# And finally we'll deploy pko from the mirrored images." Sleep 500ms Enter | |
Enter | |
Sleep 3s | |
Type "# Mirror package image:" Sleep 500ms Enter | |
Type "skopeo copy --all \" Enter | |
Type " docker://quay.io/package-operator/package-operator-package:v1.18.2 \" Enter | |
Type " docker://quay.io/erdii-test/pko-mirror/package-operator-package:v1.18.2" Sleep 500ms Enter Wait@60s | |
Enter | |
Type "# Mirror package-operator-manager image:" Sleep 500ms Enter | |
Type "skopeo copy --all \" Enter | |
Type " docker://quay.io/package-operator/package-operator-manager:v1.18.2 \" Enter | |
Type " docker://quay.io/erdii-test/pko-mirror/package-operator-manager:v1.18.2" Sleep 500ms Enter Wait@60s | |
Enter | |
Type "# Mirror remote-phase-manager image:" Sleep 500ms Enter | |
Type "skopeo copy --all \" Enter | |
Type " docker://quay.io/package-operator/remote-phase-manager:v1.18.2 \" Enter | |
Type " docker://quay.io/erdii-test/pko-mirror/remote-phase-manager:v1.18.2" Sleep 500ms Enter Wait@60s | |
Enter | |
Type "# Download and patch boostrap job manifests:" Sleep 500ms Enter | |
Type "curl -LO https://github.com/package-operator/package-operator/releases/download/v1.18.2/self-bootstrap-job.yaml" Sleep 500ms Enter Wait | |
Enter | |
Type "yq -i 'with(" Enter | |
Type ` select(.kind == "Job").spec.template.spec.containers[]` Enter | |
Type ` | select(.name == "package-operator").env[]` Enter | |
Type ` | select(.name == "PKO_IMAGE_PREFIX_OVERRIDES")` Enter | |
Type ` ; .value = "quay.io/package-operator/=quay.io/erdii-test/pko-mirror/"` Enter | |
Type " )' self-bootstrap-job.yaml" Sleep 500ms Enter Wait | |
Enter | |
Type "yq -i 'with(" Enter | |
Type ` select(.kind == "Job").spec.template.spec.containers[]` Enter | |
Type ` | select(.name == "package-operator")` Enter | |
Type " ; (" Enter | |
Type ` .image |= sub("quay.io/package-operator", "quay.io/erdii-test/pko-mirror"),` Enter | |
Type ` .args[0] |= sub("quay.io/package-operator", "quay.io/erdii-test/pko-mirror")` Enter | |
Type " )" Enter | |
Type " )' self-bootstrap-job.yaml" Sleep 500ms Enter Wait | |
Enter | |
Env KIND_EXPERIMENTAL_PROVIDER podman | |
Type "# Demo time:" Sleep 500ms Enter | |
Type "kind create cluster" Sleep 500ms Enter Wait@60s | |
Type "kubectl apply -f self-bootstrap-job.yaml" Sleep 500ms Enter Wait@60s | |
Enter | |
Type "# Wait until ClusterPackage CRD is established and ClusterPackage/package-operator is available:" Sleep 500ms Enter | |
Type "while ! kubectl wait --for condition=established --timeout=60s crd/clusterpackages.package-operator.run; do sleep 5; done" Sleep 500ms Enter Wait@60s | |
Type "kubectl wait clusterpackage package-operator --for condition=progressing=false --timeout=300s" Sleep 500ms Enter Wait@60s | |
Enter | |
Type "# Validate that the mirrored package image was used:" Sleep 500ms Enter | |
Type "kubectl get clusterpackage package-operator -o yaml | yq .spec.image" Sleep 500ms Enter Wait | |
Enter | |
Type "# Validate that the mirrored manager image was used:" Sleep 500ms Enter | |
Type "kubectl get -n package-operator-system deployment/package-operator-manager -o yaml | yq '.spec.template.spec.containers[].image'" Sleep 500ms Enter Wait | |
Enter | |
Type "# Yuppieh! :)" Sleep 500ms Enter | |
Sleep 3s | |
Type "kind delete cluster" Sleep 500ms Enter Wait | |
Sleep 500ms |
Record video with vhs mirror.tape
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mirror.webm