Skip to content

Commit 4874c69

Browse files
authored
Merge pull request #227 from metal-stack/add-local-proxy-registries
Add pull-through caches for common container registries
2 parents fe76e5a + f4ff4b0 commit 4874c69

File tree

8 files changed

+123
-30
lines changed

8 files changed

+123
-30
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,12 @@ roll-certs:
9595
control-plane: control-plane-bake env
9696
docker compose up --remove-orphans --force-recreate control-plane
9797

98+
.PHONY: create-proxy-registries
99+
create-proxy-registries:
100+
docker compose up -d --force-recreate proxy-docker proxy-ghcr proxy-gcr proxy-k8s proxy-quay
101+
98102
.PHONY: control-plane-bake
99-
control-plane-bake:
103+
control-plane-bake: create-proxy-registries
100104
@if ! which kind > /dev/null; then echo "kind needs to be installed"; exit 1; fi
101105
@if ! kind get clusters | grep metal-control-plane > /dev/null; then \
102106
kind create cluster $(KIND_ARGS) \

compose.yaml

Lines changed: 92 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ services:
2626
- /bin/bash
2727
- -ce
2828
- |
29-
ansible-playbook \
30-
-i inventories/control-plane.yaml \
31-
obtain_role_requirements.yaml
32-
ansible-galaxy install --ignore-errors -r requirements.yaml
33-
ansible-playbook \
34-
-i inventories/control-plane.yaml \
35-
deploy_control_plane.yaml --extra-vars "@.extra_vars.yaml"
29+
ansible-playbook \
30+
-i inventories/control-plane.yaml \
31+
obtain_role_requirements.yaml
32+
ansible-galaxy install --ignore-errors -r requirements.yaml
33+
ansible-playbook \
34+
-i inventories/control-plane.yaml \
35+
deploy_control_plane.yaml --extra-vars "@.extra_vars.yaml"
3636
3737
partition:
3838
image: ghcr.io/metal-stack/metal-deployment-base:${DEPLOYMENT_BASE_IMAGE_TAG}
@@ -56,14 +56,14 @@ services:
5656
- /bin/bash
5757
- -ce
5858
- |
59-
ansible-playbook \
60-
-i inventories/control-plane.yaml \
61-
obtain_role_requirements.yaml
62-
ansible-galaxy install --ignore-errors -r requirements.yaml
63-
ansible-playbook \
64-
-i inventories/partition.yaml \
65-
-i clab-mini-lab/ansible-inventory.yml \
66-
deploy_partition.yaml --extra-vars "@.extra_vars.yaml"
59+
ansible-playbook \
60+
-i inventories/control-plane.yaml \
61+
obtain_role_requirements.yaml
62+
ansible-galaxy install --ignore-errors -r requirements.yaml
63+
ansible-playbook \
64+
-i inventories/partition.yaml \
65+
-i clab-mini-lab/ansible-inventory.yml \
66+
deploy_partition.yaml --extra-vars "@.extra_vars.yaml"
6767
6868
metalctl:
6969
image: ghcr.io/metal-stack/metalctl:${METALCTL_IMAGE_TAG}
@@ -77,3 +77,80 @@ services:
7777
- ./files/rules.yaml:/tmp/rules.yaml
7878
network_mode: host
7979
command: --version
80+
81+
proxy-docker:
82+
image: registry:3
83+
restart: always
84+
volumes:
85+
- proxy-docker:/var/lib/registry
86+
networks:
87+
- kind
88+
container_name: proxy-docker
89+
environment:
90+
- REGISTRY_PROXY_REMOTEURL="https://registry-1.docker.io"
91+
- REGISTRY_PROXY_TTL=168h
92+
- REGISTRY_STORAGE_DELETE_ENABLED=true
93+
- OTEL_TRACES_EXPORTER=none
94+
proxy-gcr:
95+
image: registry:3
96+
restart: always
97+
volumes:
98+
- proxy-gcr:/var/lib/registry
99+
networks:
100+
- kind
101+
container_name: proxy-gcr
102+
environment:
103+
- REGISTRY_PROXY_REMOTEURL="https://gcr.io"
104+
- REGISTRY_PROXY_TTL=168h
105+
- REGISTRY_STORAGE_DELETE_ENABLED=true
106+
- OTEL_TRACES_EXPORTER=none
107+
proxy-ghcr:
108+
image: registry:3
109+
restart: always
110+
volumes:
111+
- proxy-ghcr:/var/lib/registry
112+
networks:
113+
- kind
114+
container_name: proxy-ghcr
115+
environment:
116+
- REGISTRY_PROXY_REMOTEURL="https://ghcr.io"
117+
- REGISTRY_PROXY_TTL=168h
118+
- REGISTRY_STORAGE_DELETE_ENABLED=true
119+
- OTEL_TRACES_EXPORTER=none
120+
proxy-k8s:
121+
image: registry:3
122+
restart: always
123+
volumes:
124+
- proxy-k8s:/var/lib/registry
125+
networks:
126+
- kind
127+
container_name: proxy-k8s
128+
environment:
129+
- REGISTRY_PROXY_REMOTEURL="https://registry.k8s.io"
130+
- REGISTRY_PROXY_TTL=168h
131+
- REGISTRY_STORAGE_DELETE_ENABLED=true
132+
- OTEL_TRACES_EXPORTER=none
133+
proxy-quay:
134+
image: registry:3
135+
restart: always
136+
volumes:
137+
- proxy-quay:/var/lib/registry
138+
networks:
139+
- kind
140+
container_name: proxy-quay
141+
environment:
142+
- REGISTRY_PROXY_REMOTEURL="https://quay.io"
143+
- REGISTRY_PROXY_TTL=168h
144+
- REGISTRY_STORAGE_DELETE_ENABLED=true
145+
- OTEL_TRACES_EXPORTER=none
146+
volumes:
147+
proxy-docker:
148+
proxy-gcr:
149+
proxy-ghcr:
150+
proxy-k8s:
151+
proxy-quay:
152+
153+
networks:
154+
kind:
155+
name: kind
156+
external: true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[host."http://proxy-docker:5000"]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[host."http://proxy-gcr:5000"]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[host."http://proxy-ghcr:5000"]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[host."http://proxy-quay:5000"]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[host."http://proxy-k8s:5000"]

control-plane/kind.yaml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,24 @@ networking:
44
apiServerPort: 6443
55
apiServerAddress: 0.0.0.0
66
nodes:
7-
- role: control-plane
8-
extraPortMappings:
9-
- containerPort: 4443
10-
hostPort: 4443
11-
listenAddress: 0.0.0.0
12-
- containerPort: 8080
13-
hostPort: 8080
14-
listenAddress: 0.0.0.0
15-
- containerPort: 4150
16-
hostPort: 4150
17-
listenAddress: 0.0.0.0
18-
- containerPort: 50051
19-
hostPort: 50051
20-
listenAddress: 0.0.0.0
7+
- role: control-plane
8+
extraMounts:
9+
- hostPath: ./control-plane/config-patches
10+
containerPath: /etc/containerd/certs.d
11+
extraPortMappings:
12+
- containerPort: 4443
13+
hostPort: 4443
14+
listenAddress: 0.0.0.0
15+
- containerPort: 8080
16+
hostPort: 8080
17+
listenAddress: 0.0.0.0
18+
- containerPort: 4150
19+
hostPort: 4150
20+
listenAddress: 0.0.0.0
21+
- containerPort: 50051
22+
hostPort: 50051
23+
listenAddress: 0.0.0.0
24+
containerdConfigPatches:
25+
- |-
26+
[plugins."io.containerd.grpc.v1.cri".registry]
27+
config_path = "/etc/containerd/certs.d"

0 commit comments

Comments
 (0)