From 18546e6ef020c8b505475c68d643020e09e48496 Mon Sep 17 00:00:00 2001 From: Yibo Cai Date: Wed, 18 Apr 2018 11:01:17 +0800 Subject: compass-tasks-k8s: support arm64 Gaps from x86 to be fixed: - kubernetes version: arm = 1.7.5, x86_64 = 1.9.1 - arm64/: arm specific patches Change-Id: I0cb11ea304da1cf8de6dd582190a04cc111b1ff9 Signed-off-by: Yibo Cai --- compass-tasks-k8s/Dockerfile-arm64 | 5 ++ compass-tasks-k8s/arm64/docker-pkg.patch | 122 +++++++++++++++++++++++++++++++ compass-tasks-k8s/arm64/etcd-arm64.patch | 24 ++++++ compass-tasks-k8s/arm64/run.sh | 24 ++++++ compass-tasks-k8s/arm64/thunderx1.patch | 53 ++++++++++++++ 5 files changed, 228 insertions(+) create mode 100644 compass-tasks-k8s/Dockerfile-arm64 create mode 100644 compass-tasks-k8s/arm64/docker-pkg.patch create mode 100644 compass-tasks-k8s/arm64/etcd-arm64.patch create mode 100644 compass-tasks-k8s/arm64/run.sh create mode 100644 compass-tasks-k8s/arm64/thunderx1.patch (limited to 'compass-tasks-k8s') diff --git a/compass-tasks-k8s/Dockerfile-arm64 b/compass-tasks-k8s/Dockerfile-arm64 new file mode 100644 index 0000000..bf165c4 --- /dev/null +++ b/compass-tasks-k8s/Dockerfile-arm64 @@ -0,0 +1,5 @@ +FROM opnfv/compass-tasks-base + +COPY arm64/* /root/ +RUN chmod +x /root/run.sh +RUN /root/run.sh diff --git a/compass-tasks-k8s/arm64/docker-pkg.patch b/compass-tasks-k8s/arm64/docker-pkg.patch new file mode 100644 index 0000000..75a0ec1 --- /dev/null +++ b/compass-tasks-k8s/arm64/docker-pkg.patch @@ -0,0 +1,122 @@ +From c053406e75618bb445da2be41c880c2420095d6e Mon Sep 17 00:00:00 2001 +From: Yibo Cai +Date: Tue, 10 Apr 2018 13:25:00 +0800 +Subject: [PATCH] fixup docker package + +--- + roles/docker/tasks/systemd.yml | 10 +++++++++- + roles/docker/templates/docker-options-centos.conf.j2 | 8 ++++++++ + roles/docker/vars/debian.yml | 8 +++++++- + roles/docker/vars/redhat.yml | 7 ++++++- + roles/docker/vars/ubuntu.yml | 8 +++++++- + 5 files changed, 37 insertions(+), 4 deletions(-) + create mode 100644 roles/docker/templates/docker-options-centos.conf.j2 + +diff --git a/roles/docker/tasks/systemd.yml b/roles/docker/tasks/systemd.yml +index ec4bbf9..77531c1 100644 +--- a/roles/docker/tasks/systemd.yml ++++ b/roles/docker/tasks/systemd.yml +@@ -36,6 +36,14 @@ + src: docker-options.conf.j2 + dest: "/etc/systemd/system/docker.service.d/docker-options.conf" + notify: restart docker ++ when: ansible_distribution != 'CentOS' ++ ++- name: Write docker options systemd drop-in for CentOS7 ++ template: ++ src: docker-options-centos.conf.j2 ++ dest: "/etc/systemd/system/docker.service.d/docker-options.conf" ++ notify: restart docker ++ when: ansible_distribution == 'CentOS' + + - name: Write docker dns systemd drop-in + template: +@@ -44,4 +52,4 @@ + notify: restart docker + when: dns_mode != 'none' and resolvconf_mode == 'docker_dns' + +-- meta: flush_handlers +\ No newline at end of file ++- meta: flush_handlers +diff --git a/roles/docker/templates/docker-options-centos.conf.j2 b/roles/docker/templates/docker-options-centos.conf.j2 +new file mode 100644 +index 0000000..829134e +--- /dev/null ++++ b/roles/docker/templates/docker-options-centos.conf.j2 +@@ -0,0 +1,8 @@ ++[Service] ++Environment="DOCKER_OPTS={{ docker_options | default('') }} \ ++--add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \ ++--default-runtime=docker-runc \ ++--exec-opt native.cgroupdriver=systemd \ ++--userland-proxy-path=/usr/libexec/docker/docker-proxy-current \ ++--signature-verification=false \ ++--iptables=false" +diff --git a/roles/docker/vars/debian.yml b/roles/docker/vars/debian.yml +index 240e86e..5d87d48 100644 +--- a/roles/docker/vars/debian.yml ++++ b/roles/docker/vars/debian.yml +@@ -10,10 +10,16 @@ docker_versioned_pkg: + 'stable': docker-engine=17.03.0~ce-0~debian-{{ ansible_distribution_release|lower }} + 'edge': docker-engine=17.03.0~ce-0~debian-{{ ansible_distribution_release|lower }} + ++#docker_package_info: ++# pkg_mgr: apt ++# pkgs: ++# - name: "{{ docker_versioned_pkg[docker_version | string] }}" ++# force: yes ++ + docker_package_info: + pkg_mgr: apt + pkgs: +- - name: "{{ docker_versioned_pkg[docker_version | string] }}" ++ - name: docker.io + force: yes + + docker_repo_key_info: +diff --git a/roles/docker/vars/redhat.yml b/roles/docker/vars/redhat.yml +index 8b20def..d5625fa 100644 +--- a/roles/docker/vars/redhat.yml ++++ b/roles/docker/vars/redhat.yml +@@ -14,10 +14,15 @@ docker_versioned_pkg: + # https://docs.docker.com/engine/installation/linux/centos/#install-from-a-package + # https://download.docker.com/linux/centos/7/x86_64/stable/Packages/ + ++#docker_package_info: ++# pkg_mgr: yum ++# pkgs: ++# - name: "{{ docker_versioned_pkg[docker_version | string] }}" ++ + docker_package_info: + pkg_mgr: yum + pkgs: +- - name: "{{ docker_versioned_pkg[docker_version | string] }}" ++ - name: docker + + docker_repo_key_info: + pkg_key: '' +diff --git a/roles/docker/vars/ubuntu.yml b/roles/docker/vars/ubuntu.yml +index 1fd7efd..172afd3 100644 +--- a/roles/docker/vars/ubuntu.yml ++++ b/roles/docker/vars/ubuntu.yml +@@ -10,10 +10,16 @@ docker_versioned_pkg: + 'stable': docker-engine=17.03.0~ce-0~ubuntu-{{ ansible_distribution_release|lower }} + 'edge': docker-engine=17.03.0~ce-0~ubuntu-{{ ansible_distribution_release|lower }} + ++#docker_package_info: ++# pkg_mgr: apt ++# pkgs: ++# - name: "{{ docker_versioned_pkg[docker_version | string] }}" ++# force: yes ++ + docker_package_info: + pkg_mgr: apt + pkgs: +- - name: "{{ docker_versioned_pkg[docker_version | string] }}" ++ - name: docker.io + force: yes + + docker_repo_key_info: +-- +2.7.4 + diff --git a/compass-tasks-k8s/arm64/etcd-arm64.patch b/compass-tasks-k8s/arm64/etcd-arm64.patch new file mode 100644 index 0000000..8f914ef --- /dev/null +++ b/compass-tasks-k8s/arm64/etcd-arm64.patch @@ -0,0 +1,24 @@ +From 2ec3201a94ccc46406f7ff569545fb94d5a53aa5 Mon Sep 17 00:00:00 2001 +From: Yibo Cai +Date: Fri, 19 Jan 2018 11:00:38 +0800 +Subject: [PATCH] arm64 + +--- + roles/etcd/templates/etcd.j2 | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/roles/etcd/templates/etcd.j2 b/roles/etcd/templates/etcd.j2 +index 11f8f74..3a0e8f3 100644 +--- a/roles/etcd/templates/etcd.j2 ++++ b/roles/etcd/templates/etcd.j2 +@@ -3,6 +3,7 @@ + --restart=on-failure:5 \ + --env-file=/etc/etcd.env \ + --net=host \ ++ -e ETCD_UNSUPPORTED_ARCH=arm64 \ + -v /etc/ssl/certs:/etc/ssl/certs:ro \ + -v {{ etcd_cert_dir }}:{{ etcd_cert_dir }}:ro \ + -v {{ etcd_data_dir }}:{{ etcd_data_dir }}:rw \ +-- +2.7.4 + diff --git a/compass-tasks-k8s/arm64/run.sh b/compass-tasks-k8s/arm64/run.sh new file mode 100644 index 0000000..d75e28d --- /dev/null +++ b/compass-tasks-k8s/arm64/run.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +yum install git ntp wget ntpdate openssh-server python-devel sudo '@Development Tools' -y +#yum install -y python-yaml +systemctl stop firewalld +systemctl mask firewalld + +# get kubespray code and install requirement +rm -rf /opt/kargo_k8s +git clone https://github.com/kubernetes-incubator/kubespray.git /opt/kargo_k8s +cd /opt/kargo_k8s + +git checkout v2.2.1 + +# bugfix: https://github.com/kubernetes-incubator/kubespray/pull/1727 +git format-patch -1 dae9f6d3 --stdout | git apply +# support etcd on arm64 +git apply /root/etcd-arm64.patch +# increase container startup timeout +git apply /root/thunderx1.patch +# fix docker package +git apply /root/docker-pkg.patch + +pip install ansible==2.3.1.0 diff --git a/compass-tasks-k8s/arm64/thunderx1.patch b/compass-tasks-k8s/arm64/thunderx1.patch new file mode 100644 index 0000000..8ce9f73 --- /dev/null +++ b/compass-tasks-k8s/arm64/thunderx1.patch @@ -0,0 +1,53 @@ +From 97355abab655f9f2935e6e48fc11ec46dd3c7c26 Mon Sep 17 00:00:00 2001 +From: Yibo Cai +Date: Thu, 25 Jan 2018 16:17:02 +0800 +Subject: [PATCH] workaround thunderx with longer timeout + +--- + roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 | 2 +- + .../master/templates/manifests/kube-controller-manager.manifest.j2 | 2 +- + roles/kubernetes/master/templates/manifests/kube-scheduler.manifest.j2 | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 b/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 +index 58c7629..554410d 100644 +--- a/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 ++++ b/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 +@@ -102,7 +102,7 @@ spec: + host: 127.0.0.1 + path: /healthz + port: {{ kube_apiserver_insecure_port }} +- initialDelaySeconds: 30 ++ initialDelaySeconds: 120 + timeoutSeconds: 10 + volumeMounts: + - mountPath: {{ kube_config_dir }} +diff --git a/roles/kubernetes/master/templates/manifests/kube-controller-manager.manifest.j2 b/roles/kubernetes/master/templates/manifests/kube-controller-manager.manifest.j2 +index bf03e60..87e8b5c 100644 +--- a/roles/kubernetes/master/templates/manifests/kube-controller-manager.manifest.j2 ++++ b/roles/kubernetes/master/templates/manifests/kube-controller-manager.manifest.j2 +@@ -70,7 +70,7 @@ spec: + host: 127.0.0.1 + path: /healthz + port: 10252 +- initialDelaySeconds: 30 ++ initialDelaySeconds: 120 + timeoutSeconds: 10 + volumeMounts: + - mountPath: /etc/ssl +diff --git a/roles/kubernetes/master/templates/manifests/kube-scheduler.manifest.j2 b/roles/kubernetes/master/templates/manifests/kube-scheduler.manifest.j2 +index 6353ca1..cac8c64 100644 +--- a/roles/kubernetes/master/templates/manifests/kube-scheduler.manifest.j2 ++++ b/roles/kubernetes/master/templates/manifests/kube-scheduler.manifest.j2 +@@ -44,7 +44,7 @@ spec: + host: 127.0.0.1 + path: /healthz + port: 10251 +- initialDelaySeconds: 30 ++ initialDelaySeconds: 120 + timeoutSeconds: 10 + volumeMounts: + - mountPath: /etc/ssl +-- +2.7.4 + -- cgit 1.2.3-korg