Skip to content

Commit 607a5c9

Browse files
committed
salt: Configure containerd registries using dedicated config
Using this config_path patern allow to change the registries configuration without restarting the containerd service
1 parent ff83f83 commit 607a5c9

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
and Loki image version to [3.6.5](https://github.com/grafana/loki/releases/tag/v3.6.5)
3131
(PR[#4792](https://github.com/scality/metalk8s/pull/4792))
3232

33+
- Configure containerd using `config_path` for registries so that changes of
34+
registries mirrors does no longer require a restart of the containerd service
35+
(PR[#4820](https://github.com/scality/metalk8s/pull/4820))
36+
3337
- Allow to enable metrics collection for the solutions operators
3438
(PR[#4813](https://github.com/scality/metalk8s/pull/4813))
3539

salt/metalk8s/container-engine/containerd/installed.sls

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
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

Comments
 (0)