From 2f7377e17e077c1651e7108225bddfb02ab0c879 Mon Sep 17 00:00:00 2001 From: astebenkova Date: Tue, 30 Apr 2024 14:07:35 +0300 Subject: [PATCH] [deploy-env] Add mirror to Docker configuration There are some docker_container tasks which pull docker images. This commit adds mirror configuration to daemon.json to prevent encountering issues related to the pull rate limit. + update tls job according to the changes in openstack-helm Depends-On: Ia58916e3dc5e0f50b476ece9bba31d8d656b3c44 Change-Id: Iac995500357336566cdbf9ddee0ae85b0b0347cd --- roles/deploy-env/files/daemon.json | 6 +++++ roles/deploy-env/tasks/containerd.yaml | 32 ++++++++++++++++---------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/roles/deploy-env/files/daemon.json b/roles/deploy-env/files/daemon.json index ceb065798..29325b352 100644 --- a/roles/deploy-env/files/daemon.json +++ b/roles/deploy-env/files/daemon.json @@ -5,6 +5,12 @@ "log-opts": { "max-size": "100m" }, +{% if registry_mirror is defined %} + "registry-mirrors": ["{{ registry_mirror }}"], +{% endif %} +{% if insecure_registries is defined %} + "insecure-registries": ["{{ insecure_registries }}"], +{% endif %} "storage-driver": "overlay2", "live-restore": true } diff --git a/roles/deploy-env/tasks/containerd.yaml b/roles/deploy-env/tasks/containerd.yaml index 39813b51d..f1ac850bc 100644 --- a/roles/deploy-env/tasks/containerd.yaml +++ b/roles/deploy-env/tasks/containerd.yaml @@ -49,21 +49,11 @@ state: present update_cache: true -- name: Configure Docker daemon - template: - src: files/daemon.json - dest: /etc/docker/daemon.json - name: Add users to docker group command: "adduser {{ item }} docker" loop: "{{ docker_users }}" -- name: Restart docker - service: - name: docker - daemon_reload: yes - state: restarted - - name: Reset ssh connection to apply user changes. meta: reset_connection @@ -75,14 +65,21 @@ args: executable: /bin/bash -- name: Set mirror_fqdn fact +- name: Set registry_mirror fact when: - registry_mirror is not defined - zuul_site_mirror_fqdn is defined set_fact: registry_mirror: "http://{{ zuul_site_mirror_fqdn }}:8082" -- name: Set regitstry namespaces +- name: Set insecure_registries fact for Docker + when: + - insecure_registries is not defined + - zuul_site_mirror_fqdn is defined + set_fact: + insecure_registries: "{{ zuul_site_mirror_fqdn }}:8082" + +- name: Set registry_namespaces fact set_fact: registry_namespaces: - namespace: "_default" @@ -156,4 +153,15 @@ name: containerd daemon_reload: yes state: restarted + +- name: Configure Docker daemon + template: + src: files/daemon.json + dest: /etc/docker/daemon.json + +- name: Restart docker + service: + name: docker + daemon_reload: yes + state: restarted ...