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

Add env property on Registry #277

Merged
merged 4 commits into from
Feb 24, 2023
Merged

Conversation

MalibuKoKo
Copy link
Contributor

Acutally it's not possible to manage env vars of container registry.

Please let'me override registry configuration : https://docs.docker.com/registry/configuration/

A use case, inspirated by following post : https://maelvls.dev/docker-proxy-registry-kind/ is to declare a registry as a docker proxy for kind.


Create network, proxy and cluster; attach proxy to the network :

export KIND_EXPERIMENTAL_DOCKER_NETWORK=cluster
docker network create --scope local --driver bridge --subnet 10.20.0.0/16 --gateway 10.20.0.1 $KIND_EXPERIMENTAL_DOCKER_NETWORK
ctlptl apply -f /dev/stdin <<EOF                                                                                                                          
apiVersion: ctlptl.dev/v1alpha1
kind: Registry
name: proxy-docker-hub
env:
- REGISTRY_PROXY_REMOTEURL=https://registry-1.docker.io
---
apiVersion: ctlptl.dev/v1alpha1
kind: Cluster
product: kind
kubernetesVersion: "1.26"
kindV1Alpha4Cluster:
  name: $KIND_EXPERIMENTAL_DOCKER_NETWORK
  featureGates:
    PodSecurity: true
  containerdConfigPatches:
  - |-
    [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
      endpoint = ["http://proxy-docker-hub:5000"]
  nodes:
  -   role: control-plane
EOF
docker network connect $KIND_EXPERIMENTAL_DOCKER_NETWORK proxy-docker-hub

Pull an image inside cluster :

docker exec -it $KIND_EXPERIMENTAL_DOCKER_NETWORK-control-plane crictl pull docker.io/library/alpine:3.9.6

Check proxy's logs :

docker logs -f proxy-docker-hub

proxy

Signed-off-by: Nicolas COLLET <MalibuKoKo@users.noreply.github.com>
Signed-off-by: Nicolas COLLET <MalibuKoKo@users.noreply.github.com>
Signed-off-by: Nicolas COLLET <MalibuKoKo@users.noreply.github.com>
Signed-off-by: Nicolas COLLET <MalibuKoKo@users.noreply.github.com>
Copy link
Member

@nicks nicks left a comment

Choose a reason for hiding this comment

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

LGTM!

@nicks nicks merged commit 319f726 into tilt-dev:main Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants