Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add integration tests for image-cache #9872

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DmitriyMV
Copy link
Member

@DmitriyMV DmitriyMV commented Dec 3, 2024

Provide separate integration/image-cache tag.

Closes #9860

@DmitriyMV
Copy link
Member Author

DmitriyMV commented Dec 3, 2024

Side note: now I understand how to run (and what to edit) CI steps locally. The whole .kres (generates) -> ci.yaml (uses) -> Makefile (calls) -> /hack/test/*.sh is actually cool but not easily intuitive.

Future "me" reminders.
  • Minimal patch for e2e-image-cache.sh so it will start working with proper mirrors.
diff --git a/hack/test/e2e-image-cache.sh b/hack/test/e2e-image-cache.sh
index 1d41da519..c09b8d117 100755
--- a/hack/test/e2e-image-cache.sh
+++ b/hack/test/e2e-image-cache.sh
@@ -12,12 +12,10 @@ NODE="172.20.2.2"
 function build_special_mirrors {
   REGISTRY_MIRROR_FLAGS=()
 
-  for registry in docker.io quay.io ghcr.io; do
-    local service="registry-${registry//./-}.ci.svc"
-    addr=$(python3 -c "import socket; print(socket.gethostbyname('${service}'))")
-
-    REGISTRY_MIRROR_FLAGS+=("--registry-mirror=${registry}=http://${addr}:5000")
-  done
+  REGISTRY_MIRROR_FLAGS+=("--registry-mirror=docker.io=http://172.20.2.1:5000")
+  REGISTRY_MIRROR_FLAGS+=("--registry-mirror=factory.talos.dev=http://172.20.2.1:5006")
+  REGISTRY_MIRROR_FLAGS+=("--registry-mirror=ghcr.io=http://172.20.2.1:5004")
+  REGISTRY_MIRROR_FLAGS+=("--registry-mirror=127.0.0.1:5005=http://172.20.2.1:5005")
 }
 
 function create_cluster {

Then:

make cache-create IMAGE_REGISTRY=127.0.0.1:5005 PUSH=true

And then:

sudo -E make e2e-image-cache IMAGE_REGISTRY=127.0.0.1:5005

hack/test/e2e-image-cache.sh Outdated Show resolved Hide resolved
@DmitriyMV DmitriyMV force-pushed the integration branch 2 times, most recently from 07a3c23 to 5bb4bea Compare December 4, 2024 14:33
command: e2e-image-cache
withSudo: true
environment:
IMAGE_REGISTRY: registry.dev.siderolabs.io
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should run a short integration test

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, it doesn't run any (?).

In fact, why create a flake instead of re-using existing e2e-qemu like every other test?

the only difference is booting from an ISO and using a config patch, and both should be supported (or easy to add if not yet)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smira fixed

Makefile Outdated
.PHONY: cache-create
cache-create: installer imager ## Generate image cache.
@( $(TALOSCTL_EXECUTABLE) images default | grep -v 'siderolabs/installer'; echo "$(REGISTRY_AND_USERNAME)/installer:$(IMAGE_TAG)" ) | $(TALOSCTL_EXECUTABLE) images cache-create --image-cache-path=/tmp/cache.tar --images=- --force
@crane push /tmp/cache.tar $(REGISTRY_AND_USERNAME)/image-cache
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use a specific tag here $(IMAGE_TAG), otherwise concurrent tests might override things

@DmitriyMV DmitriyMV force-pushed the integration branch 7 times, most recently from 7b05b22 to 16e241e Compare December 4, 2024 18:28
@smira
Copy link
Member

smira commented Dec 4, 2024

We still pass --registry-mirror to the e2e-image-cache-step:

https://github.com/siderolabs/talos/actions/runs/12165563053/job/33930586574?pr=9872#step:13:96

@smira
Copy link
Member

smira commented Dec 4, 2024

If you look into the support bundle in artifacts, you will see:

metadata:
    namespace: cri
    type: RegistryConfigs.cri.talos.dev
    id: registries
    version: 2
    owner: cri.RegistriesConfigController
    phase: running
    created: 2024-12-04T18:17:02Z
    updated: 2024-12-04T18:17:05Z
spec:
    mirrors:
        '*':
            endpoints:
                - http://127.0.0.1:3172
                - http://172.20.0.251:65000
            skipFallback: true
        docker.io:
            endpoints:
                - http://127.0.0.1:3172
                - http://192.168.118.176:5000
        gcr.io:
            endpoints:
                - http://127.0.0.1:3172
                - http://192.168.118.173:5000
        ghcr.io:
            endpoints:
                - http://127.0.0.1:3172
                - http://192.168.118.165:5000
        k8s.gcr.io:
            endpoints:
                - http://127.0.0.1:3172
                - http://172.20.0.251:65000
            skipFallback: true
        quay.io:
            endpoints:
                - http://127.0.0.1:3172
                - http://192.168.118.179:5000
        registry.k8s.io:
            endpoints:
                - http://127.0.0.1:3172
                - http://192.168.118.148:5000
                - http://172.20.0.251:65000
            skipFallback: true

@DmitriyMV DmitriyMV force-pushed the integration branch 2 times, most recently from b922fad to 5c0833e Compare December 4, 2024 18:35
Provide separate `integration/image-cache` tag.

Closes siderolabs#9860

Signed-off-by: Dmitriy Matrenichev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

integration test for image cache
4 participants