From 47050003a0192e0e7445234e9b60df4c11397bcd Mon Sep 17 00:00:00 2001 From: ERIK Date: Thu, 4 Aug 2022 06:03:46 +0800 Subject: [PATCH] Add docker support for Kylin V10 (#9144) Signed-off-by: bo.jiang --- docs/kylinlinux.md | 4 +- roles/container-engine/docker/tasks/main.yml | 3 +- roles/container-engine/docker/vars/kylin.yml | 41 +++++++++++++++++++ .../preinstall/tasks/0040-set_facts.yml | 8 ++++ 4 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 roles/container-engine/docker/vars/kylin.yml diff --git a/docs/kylinlinux.md b/docs/kylinlinux.md index fb3754790..87dceff2f 100644 --- a/docs/kylinlinux.md +++ b/docs/kylinlinux.md @@ -1,11 +1,11 @@ # Kylin Linux -Kylin Linux is currently only supported with containerd runtime. +Kylin Linux is supported with docker and containerd runtimes. **Note:** that Kylin Linux is not currently covered in kubespray CI and support for it is currently considered experimental. -At present, only `Kylin Linux Advanced Server V10` has been adapted, which can support the deployment of aarch64 and x86_64 platforms. +At present, only `Kylin Linux Advanced Server V10 (Sword)` has been adapted, which can support the deployment of aarch64 and x86_64 platforms. There are no special considerations for using Kylin Linux as the target OS for Kubespray deployments. diff --git a/roles/container-engine/docker/tasks/main.yml b/roles/container-engine/docker/tasks/main.yml index e0eae172c..ee23b9d34 100644 --- a/roles/container-engine/docker/tasks/main.yml +++ b/roles/container-engine/docker/tasks/main.yml @@ -21,6 +21,7 @@ - "{{ ansible_distribution|lower }}-{{ ansible_distribution_major_version|lower|replace('/', '_') }}.yml" - "{{ ansible_distribution|lower }}-{{ host_architecture }}.yml" - "{{ ansible_distribution|lower }}.yml" + - "{{ ansible_distribution.split(' ')[0]|lower }}.yml" - "{{ ansible_os_family|lower }}-{{ ansible_distribution_major_version|lower|replace('/', '_') }}.yml" - "{{ ansible_os_family|lower }}-{{ host_architecture }}.yml" - "{{ ansible_os_family|lower }}.yml" @@ -70,7 +71,7 @@ mode: 0644 when: ansible_distribution == "Fedora" and not is_ostree -- name: Configure docker repository on RedHat/CentOS/Oracle/AlmaLinux Linux +- name: Configure docker repository on RedHat/CentOS/OracleLinux/AlmaLinux/KylinLinux template: src: "rh_docker.repo.j2" dest: "{{ yum_repo_dir }}/docker-ce.repo" diff --git a/roles/container-engine/docker/vars/kylin.yml b/roles/container-engine/docker/vars/kylin.yml new file mode 100644 index 000000000..d212d41d5 --- /dev/null +++ b/roles/container-engine/docker/vars/kylin.yml @@ -0,0 +1,41 @@ +--- +# containerd versions are only relevant for docker +containerd_versioned_pkg: + 'latest': "{{ containerd_package }}" + '1.3.7': "{{ containerd_package }}-1.3.7-3.1.el{{ ansible_distribution_major_version }}" + '1.3.9': "{{ containerd_package }}-1.3.9-3.1.el{{ ansible_distribution_major_version }}" + '1.4.3': "{{ containerd_package }}-1.4.3-3.2.el{{ ansible_distribution_major_version }}" + '1.4.4': "{{ containerd_package }}-1.4.4-3.1.el{{ ansible_distribution_major_version }}" + '1.4.6': "{{ containerd_package }}-1.4.6-3.1.el{{ ansible_distribution_major_version }}" + '1.4.9': "{{ containerd_package }}-1.4.9-3.1.el{{ ansible_distribution_major_version }}" + '1.4.12': "{{ containerd_package }}-1.4.12-3.1.el{{ ansible_distribution_major_version }}" + '1.6.4': "{{ containerd_package }}-1.6.4-3.1.el{{ ansible_distribution_major_version }}" + 'stable': "{{ containerd_package }}-1.6.4-3.1.el{{ ansible_distribution_major_version }}" + 'edge': "{{ containerd_package }}-1.6.4-3.1.el{{ ansible_distribution_major_version }}" + +docker_version: 19.03 +docker_cli_version: 19.03 + +# https://docs.docker.com/engine/installation/linux/centos/#install-from-a-package +# https://download.docker.com/linux/centos/>/x86_64/stable/Packages/ +# or do 'yum --showduplicates list docker-engine' +docker_versioned_pkg: + 'latest': docker-ce + '18.09': docker-ce-3:18.09.9-3.el7 + '19.03': docker-ce-3:19.03.15-3.el{{ ansible_distribution_major_version }} + 'stable': docker-ce-3:19.03.15-3.el{{ ansible_distribution_major_version }} + 'edge': docker-ce-3:19.03.15-3.el{{ ansible_distribution_major_version }} + +docker_cli_versioned_pkg: + 'latest': docker-ce-cli + '18.09': docker-ce-cli-1:18.09.9-3.el7 + '19.03': docker-ce-cli-1:19.03.15-3.el{{ ansible_distribution_major_version }} + 'stable': docker-ce-cli-1:19.03.15-3.el{{ ansible_distribution_major_version }} + 'edge': docker-ce-cli-1:19.03.15-3.el{{ ansible_distribution_major_version }} + +docker_package_info: + enablerepo: "docker-ce" + pkgs: + - "{{ containerd_versioned_pkg[docker_containerd_version | string] }}" + - "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}" + - "{{ docker_versioned_pkg[docker_version | string] }}" diff --git a/roles/kubernetes/preinstall/tasks/0040-set_facts.yml b/roles/kubernetes/preinstall/tasks/0040-set_facts.yml index e271d9e50..10602ef3e 100644 --- a/roles/kubernetes/preinstall/tasks/0040-set_facts.yml +++ b/roles/kubernetes/preinstall/tasks/0040-set_facts.yml @@ -6,6 +6,14 @@ tags: - facts +- name: Set os_family fact for Kylin Linux Advanced Server + set_fact: + ansible_os_family: "RedHat" + ansible_distribution_major_version: "8" + when: ansible_distribution == "Kylin Linux Advanced Server" + tags: + - facts + - name: check if booted with ostree stat: path: /run/ostree-booted