diff --git a/.github/ci_config/docker-compose-registries.yaml b/.github/ci_config/docker-compose-registries.yaml new file mode 100644 index 000000000..b2e2c74b3 --- /dev/null +++ b/.github/ci_config/docker-compose-registries.yaml @@ -0,0 +1,54 @@ +version: '3' +services: + registry-docker: ®istry-base + image: registry:2 + extra_hosts: + - host.docker.internal:host-gateway + volumes: + - ${IMAGE_DIR:?You must set IMAGE_DIR environmental variable!}:/var/lib/registry + restart: always + ports: + - "5000:5000" + environment: + REGISTRY_PROXY_REMOTEURL: https://registry-1.docker.io + registry-quay: + <<: *registry-base + ports: + - "5001:5000" + environment: + REGISTRY_PROXY_REMOTEURL: https://quay.io + registry-ghcr: + <<: *registry-base + ports: + - "5002:5000" + environment: + REGISTRY_PROXY_REMOTEURL: https://ghcr.io + registry-gcr: + <<: *registry-base + ports: + - "5003:5000" + environment: + REGISTRY_PROXY_REMOTEURL: https://gcr.io + registry-aws: + <<: *registry-base + ports: + - "5004:5000" + environment: + REGISTRY_PROXY_REMOTEURL: https://public.ecr.aws + registry-mcr: + <<: *registry-base + ports: + - "5005:5000" + environment: + REGISTRY_PROXY_REMOTEURL: https://mcr.microsoft.com + registry-gitlab: + <<: *registry-base + ports: + - "5006:5000" + environment: + REGISTRY_PROXY_REMOTEURL: https://registry.gitlab.com + + +#https://distribution.github.io/distribution/recipes/mirror/ +#https://distribution.github.io/distribution/recipes/mirror/#configure-the-cache +#https://distribution.github.io/distribution/about/deploying/#customize-the-storage-location \ No newline at end of file diff --git a/.github/ci_config/k3d-config.yaml b/.github/ci_config/k3d-config.yaml new file mode 100644 index 000000000..d110f1b41 --- /dev/null +++ b/.github/ci_config/k3d-config.yaml @@ -0,0 +1,50 @@ +# See: https://k3d.io/v5.4.6/usage/registries/#creating-a-registry-proxy-pull-through-registry +apiVersion: k3d.io/v1alpha5 +kind: Simple +metadata: + name: k3d-config +# proxies for pull-through cache +registries: + config: | + mirrors: + "docker.io": + endpoint: + - http://host.docker.internal:5000 + "quay.io": + endpoint: + - http://host.docker.internal:5001 + "ghcr.io": + endpoint: + - http://host.docker.internal:5002 + "gcr.io": + endpoint: + - http://host.docker.internal:5003 + "public.ecr.aws": + endpoint: + - http://host.docker.internal:5004 + "mcr.microsoft.com": + endpoint: + - http://host.docker.internal:5005 + "registry.gitlab.com": + endpoint: + - http://host.docker.internal:5006 +options: + k3s: + extraArgs: + - arg: --disable=cloud-controller + nodeFilters: + - server:* + - arg: --disable=helm-controller + nodeFilters: + - server:* + - arg: --disable=traefik + nodeFilters: + - server:* + - arg: --disable=servicelb + nodeFilters: + - server:* +ports: + # same as `--port '80:80@loadbalancer'` + - port: 80:80 + nodeFilters: + - loadbalancer \ No newline at end of file diff --git a/.github/ci_config/k3d-local-image-repo.yaml b/.github/ci_config/k3d-local-image-repo.yaml deleted file mode 100644 index 6a7805956..000000000 --- a/.github/ci_config/k3d-local-image-repo.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# See: -# - https://github.com/k3d-io/k3d/issues/19#issuecomment-1967513596 -# - https://github.com/ligfx/k3d-registry-dockerd -apiVersion: k3d.io/v1alpha5 -kind: Simple -registries: - create: - image: ligfx/k3d-registry-dockerd:v0.3 - proxy: - remoteURL: "*" - volumes: - - /var/run/docker.sock:/var/run/docker.sock diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index e68245d4c..e736e4c80 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -49,8 +49,15 @@ jobs: run: | helmfile template - test-k8s-versions: + start-k3d-pullthrough-registries: + runs-on: self-hosted needs: test-helmfile-template + steps: + - run: | + IMAGE_DIR=$HOME/.local/share/k3d-pull-through-registry docker-compose -f .github/ci_config/docker-compose-registries.yaml up -d + + test-k8s-versions: + needs: start-k3d-pullthrough-registries runs-on: self-hosted strategy: matrix: @@ -68,10 +75,11 @@ jobs: - uses: nolar/setup-k3d-k3s@v1 with: version: ${{ matrix.K3S_VERSION }} - k3d-args: --k3s-arg --disable=traefik@server:0 --k3s-arg --disable-helm-controller@server:0 --config .github/ci_config/k3d-local-image-repo.yaml + k3d-args: --config .github/ci_config/k3d-config.yaml # Note: k3d adds a 'k3d-' prefix to this name k3d-name: ${{ matrix.KUBECTL_VERSION }} + # TODO would be better to do this with a command line parameter. I have been unable to get this to work. - name: Set kubeContext run: | sed -i "s/kubeContext: .*/kubeContext: k3d-${{ matrix.KUBECTL_VERSION }}/" etc/production.yaml