1212 {%- set pillar_endpoints = [pillar_endpoints] % }
1313{%- endif % }
1414{%- for ep in pillar_endpoints % }
15- {%- do registry_eps.append(' " http://' ~ ep.ip ~ " :" ~ ep.ports.http ~ ' " ' ) % }
15+ {%- do registry_eps.append(' http://' ~ ep.ip ~ " :" ~ ep.ports.http) % }
1616{%- endfor % }
1717
1818{%- set no_proxy = [
@@ -42,7 +42,6 @@ Install containerd:
4242 - require:
4343 - test: Repositories configured
4444 - file : Create containerd service drop- in
45- - file : Configure registry IP in containerd conf
4645 - watch_in:
4746 - service: Ensure containerd running
4847
@@ -99,7 +98,7 @@ Install and configure cri-tools:
9998 - require_in:
10099 - test: Ensure containerd is ready
101100
102- Configure registry IP in containerd conf :
101+ Configure containerd:
103102 file .managed:
104103 - name: / etc/ containerd/ config.toml
105104 - makedirs: true
@@ -109,8 +108,8 @@ Configure registry IP in containerd conf:
109108 [plugins." io.containerd.grpc.v1.cri" ]
110109 sandbox_image = " {{ build_image_name(" pause" ) }} "
111110
112- [plugins." io.containerd.grpc.v1.cri" .registry.mirrors. " {{ repo.registry_endpoint }} " ]
113- endpoint = [{{ registry_eps | join( " , " ) }}]
111+ [plugins." io.containerd.grpc.v1.cri" .registry]
112+ config_path = " /etc/containerd/certs.d "
114113
115114 [plugins." io.containerd.grpc.v1.cri" .containerd.runtimes.runc]
116115 runtime_type = " io.containerd.runc.v2"
@@ -120,4 +119,21 @@ Configure registry IP in containerd conf:
120119 [debug]
121120 level = " {{ 'debug' if metalk8s.debug else 'info' }} "
122121 - watch_in:
123- - service: Ensure containerd running
122+ - service: Ensure containerd running
123+
124+
125+ Configure containerd registries:
126+ file .managed:
127+ - name: / etc/ containerd/ certs.d/ {{ repo.registry_endpoint }}/ hosts.toml
128+ - makedirs: true
129+ - contents: |
130+ {%- for ep in registry_eps % }
131+ [host." {{ ep }} " ]
132+ capabilities = [" pull" , " resolve" ]
133+ {%- endfor % }
134+ - require:
135+ - file : Configure containerd
136+ # NOTE : We do not use `watch_in` here since changes on those `certs.d` file do
137+ # not need a restart of the containerd service.
138+ - require_in:
139+ - service: Ensure containerd running
0 commit comments