From 531bfda510814db14e51cf3db82330d67f6fbb37 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sat, 28 Sep 2019 01:10:47 +0200 Subject: [PATCH] AArch64 support - spec: change hardcoded x86_64 arch to current platform arch; - Dockerfile(s): download arch-specific golang/dep binaries; - Dockerfile: Instead of pulling CentOS base images from dockerhub, create them from scratch from the official SIG-cloudinstance repo: http://artifacts.ci.centos.org/sig-cloudinstance/ - Parameterize flannel arch / CNI plugins arch; - spec: Bump minor RPM version; Co-authored-by: Jimmy Lafontaine Rivera Signed-off-by: Alexandru Avadanii Change-Id: I2f7c3b67f9944c778c78b2999838867ba7f70949 --- SPECS/caas-danm.spec | 16 ++++++++++++---- SPECS/caas-flannel.spec | 5 ++--- SPECS/caas-hyperdanm.spec | 8 +++++--- SPECS/caas-sriovdp.spec | 4 ++-- docker-build/cni-builder/Dockerfile | 9 ++++++--- docker-build/danm-builder/Dockerfile | 9 ++++++--- docker-build/flannel/Dockerfile | 5 ++--- 7 files changed, 35 insertions(+), 21 deletions(-) diff --git a/SPECS/caas-danm.spec b/SPECS/caas-danm.spec index 27cf04c..1885d62 100644 --- a/SPECS/caas-danm.spec +++ b/SPECS/caas-danm.spec @@ -15,7 +15,7 @@ %define COMPONENT danm %define RPM_NAME caas-%{COMPONENT} %define RPM_MAJOR_VERSION 4.1.0 -%define RPM_MINOR_VERSION 0 +%define RPM_MINOR_VERSION 1 %define DANM_VERSION 93b46c01682b492efec9c4661990d89976d2e3e5 %define CNI_VERSION 0.8.1 %define go_version 1.12.10 @@ -27,6 +27,12 @@ %define built_binaries_dir /binary-save %define danm_components danm fakeipam %define cnis flannel sriov +%define centos_build 191001 +%ifarch aarch64 +%define CNI_PLUGINS_ARCH arm64 +%else +%define CNI_PLUGINS_ARCH amd64 +%endif Name: %{RPM_NAME} Version: %{RPM_MAJOR_VERSION} @@ -34,12 +40,12 @@ Release: %{RPM_MINOR_VERSION}%{?dist} Summary: Containers as a Service %{COMPONENT} component License: %{_platform_license} and BSD 3-Clause License URL: https://github.com/nokia/danm -BuildArch: x86_64 +BuildArch: %{_arch} Vendor: %{_platform_vendor} and Nokia and Others unmodified Source0: %{name}-%{version}.tar.gz Requires: docker-ce >= 18.09.2, iputils, rsync -BuildRequires: docker-ce-cli >= 18.09.2, curl +BuildRequires: docker-ce-cli >= 18.09.2, curl, wget # more info at: https://fedoraproject.org/wiki/Packaging:Debuginfo No build ID note in Flannel %global debug_package %{nil} @@ -52,9 +58,10 @@ This RPM contains the DANM and related CNI binaries for CaaS subsystem. %build mkdir -p %{binary_build_dir}/cni -curl -fsSL -k https://github.com/containernetworking/plugins/releases/download/v%{CNI_VERSION}/cni-plugins-linux-amd64-v%{CNI_VERSION}.tgz | tar zx --strip-components=1 -C %{binary_build_dir}/cni +curl -fsSL -k https://github.com/containernetworking/plugins/releases/download/v%{CNI_VERSION}/cni-plugins-linux-%{CNI_PLUGINS_ARCH}-v%{CNI_VERSION}.tgz | tar zx --strip-components=1 -C %{binary_build_dir}/cni # Build DANM binaries +wget --progress=dot:giga http://artifacts.ci.centos.org/sig-cloudinstance/centos-7-%{centos_build}/%{_arch}/centos-7-%{_arch}-docker.tar.xz -O %{docker_build_dir}/danm-builder/centos-7-docker.tar.xz docker build \ --network=host \ --no-cache \ @@ -81,6 +88,7 @@ docker rm -f ${builder_container} docker rmi danm-builder:%{IMAGE_TAG} # Build CNI binaries +wget --progress=dot:giga http://artifacts.ci.centos.org/sig-cloudinstance/centos-7-%{centos_build}/%{_arch}/centos-7-%{_arch}-docker.tar.xz -O %{docker_build_dir}/cni-builder/centos-7-docker.tar.xz docker build \ --network=host \ --no-cache \ diff --git a/SPECS/caas-flannel.spec b/SPECS/caas-flannel.spec index 427b29f..9dc688f 100644 --- a/SPECS/caas-flannel.spec +++ b/SPECS/caas-flannel.spec @@ -15,7 +15,7 @@ %define COMPONENT flannel %define RPM_NAME caas-%{COMPONENT} %define RPM_MAJOR_VERSION 0.11.0 -%define RPM_MINOR_VERSION 9 +%define RPM_MINOR_VERSION 10 %define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION} Name: %{RPM_NAME} @@ -24,7 +24,7 @@ Release: %{RPM_MINOR_VERSION}%{?dist} Summary: Containers as a Service flannel component License: %{_platform_license} and MIT license and BSD and Apache License and ISC License and COMMON DEVELOPMENT AND DISTRIBUTION LICENSE and GNU Lesser General Public License v3.0 only URL: https://github.com/coreos/flannel -BuildArch: x86_64 +BuildArch: %{_arch} Vendor: %{_platform_vendor} and coreos/flannel unmodified Source0: %{name}-%{version}.tar.gz @@ -49,7 +49,6 @@ docker build \ --build-arg https_proxy="${https_proxy}" \ --build-arg no_proxy="${no_proxy}" \ --build-arg FLANNEL="%{RPM_MAJOR_VERSION}" \ - --build-arg FLANNEL_ARCHITECTURE="amd64" \ --tag %{COMPONENT}:%{IMAGE_TAG} \ %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-build/%{COMPONENT}/ diff --git a/SPECS/caas-hyperdanm.spec b/SPECS/caas-hyperdanm.spec index 4420017..7a07092 100644 --- a/SPECS/caas-hyperdanm.spec +++ b/SPECS/caas-hyperdanm.spec @@ -15,7 +15,7 @@ %define COMPONENT hyperdanm %define RPM_NAME caas-%{COMPONENT} %define RPM_MAJOR_VERSION 4.1.0 -%define RPM_MINOR_VERSION 0 +%define RPM_MINOR_VERSION 1 %define DANM_VERSION 93b46c01682b492efec9c4661990d89976d2e3e5 %define go_version 1.12.10 %define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION} @@ -24,6 +24,7 @@ %define docker_save_dir %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-save %define binary_build_dir %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/binary-save %define built_binaries_dir /binary-save +%define centos_build 191001 Name: %{RPM_NAME} Version: %{RPM_MAJOR_VERSION} @@ -31,12 +32,12 @@ Release: %{RPM_MINOR_VERSION}%{?dist} Summary: Containers as a Service %{COMPONENT} component License: %{_platform_license} and BSD 3-Clause License URL: https://github.com/nokia/danm -BuildArch: x86_64 +BuildArch: %{_arch} Vendor: %{_platform_vendor} and Nokia and Others unmodified Source0: %{name}-%{version}.tar.gz Requires: docker-ce >= 18.09.2, rsync -BuildRequires: docker-ce-cli >= 18.09.2, xz +BuildRequires: docker-ce-cli >= 18.09.2, xz, wget Obsoletes: caas-danm-webhook <= 4.0.0, caas-netwatcher <= 4.0.0, caas-svcwatcher <= 4.0.0 %description @@ -46,6 +47,7 @@ This RPM contains the %{COMPONENT} container image, and related deployment artif %autosetup %build +wget --progress=dot:giga http://artifacts.ci.centos.org/sig-cloudinstance/centos-7-%{centos_build}/%{_arch}/centos-7-%{_arch}-docker.tar.xz -O %{docker_build_dir}/danm-builder/centos-7-docker.tar.xz # Build DANM binaries docker build \ --network=host \ diff --git a/SPECS/caas-sriovdp.spec b/SPECS/caas-sriovdp.spec index b1f377d..90f8d83 100644 --- a/SPECS/caas-sriovdp.spec +++ b/SPECS/caas-sriovdp.spec @@ -15,7 +15,7 @@ %define COMPONENT sriovdp %define RPM_NAME caas-%{COMPONENT} %define RPM_MAJOR_VERSION 3.0.0 -%define RPM_MINOR_VERSION 1 +%define RPM_MINOR_VERSION 2 %define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION} %define go_version 1.12.10 %define SRIOVDP_HASH a015e56ae715e2b6dae15e42827e4e8f43eeceac @@ -26,7 +26,7 @@ Release: %{RPM_MINOR_VERSION}%{?dist} Summary: Containers as a Service sriov network device plugin component License: %{_platform_license} and Apache License 2.0 URL: https://github.com/intel/sriov-network-device-plugin/ -BuildArch: x86_64 +BuildArch: %{_arch} Vendor: %{_platform_vendor} and intel/sriov-network-device-plugin unmodified Source0: %{name}-%{version}.tar.gz diff --git a/docker-build/cni-builder/Dockerfile b/docker-build/cni-builder/Dockerfile index a9d13e8..fd49892 100644 --- a/docker-build/cni-builder/Dockerfile +++ b/docker-build/cni-builder/Dockerfile @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM centos:7.6.1810 +FROM scratch +ADD centos-7-docker.tar.xz / +CMD ["/bin/bash"] MAINTAINER Krisztian Lengyel ARG SRIOV_VERSION @@ -39,10 +41,11 @@ RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n golang \ && set -x \ && mkdir -p ${go_install_dir} \ -&& curl -fsSL -k https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz | tar zx --strip-components=1 -C ${go_install_dir} \ +&& if [ $(uname -m) == 'aarch64' ]; then HOST_ARCH=arm64; else HOST_ARCH=amd64; fi \ +&& curl -fsSL -k https://dl.google.com/go/go${go_version}.linux-${HOST_ARCH}.tar.gz | tar zx --strip-components=1 -C ${go_install_dir} \ && glide_version="$(curl -sSLf https://glide.sh/version)" \ && mkdir -p ${glide_install_dir} \ -&& curl -fsSL https://github.com/Masterminds/glide/releases/download/${glide_version}/glide-${glide_version}-linux-amd64.tar.gz | tar zx --strip-components=1 -C ${glide_install_dir} \ +&& curl -fsSL https://github.com/Masterminds/glide/releases/download/${glide_version}/glide-${glide_version}-linux-${HOST_ARCH}.tar.gz | tar zx --strip-components=1 -C ${glide_install_dir} \ && mkdir -p ${binaries} \ # # Get Flannel diff --git a/docker-build/danm-builder/Dockerfile b/docker-build/danm-builder/Dockerfile index 7b27c45..fb8160a 100644 --- a/docker-build/danm-builder/Dockerfile +++ b/docker-build/danm-builder/Dockerfile @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM centos:7.6.1810 +FROM scratch +ADD centos-7-docker.tar.xz / +CMD ["/bin/bash"] MAINTAINER Krisztian Lengyel ARG DANM_VERSION @@ -42,10 +44,11 @@ RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n golang \ && set -x \ && mkdir -p ${go_install_dir} \ -&& curl -fsSL -k https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz | tar zx --strip-components=1 -C ${go_install_dir} \ +&& if [ $(uname -m) == 'aarch64' ]; then HOST_ARCH=arm64; else HOST_ARCH=amd64; fi \ +&& curl -fsSL -k https://dl.google.com/go/go${go_version}.linux-${HOST_ARCH}.tar.gz | tar zx --strip-components=1 -C ${go_install_dir} \ && glide_version="$(curl -sSLf https://glide.sh/version)" \ && mkdir -p ${glide_install_dir} \ -&& curl -fsSL https://github.com/Masterminds/glide/releases/download/${glide_version}/glide-${glide_version}-linux-amd64.tar.gz | tar zx --strip-components=1 -C ${glide_install_dir} \ +&& curl -fsSL https://github.com/Masterminds/glide/releases/download/${glide_version}/glide-${glide_version}-linux-${HOST_ARCH}.tar.gz | tar zx --strip-components=1 -C ${glide_install_dir} \ && mkdir -p $GOPATH/src/github.com/nokia \ && git clone https://github.com/nokia/danm.git $GOPATH/src/github.com/nokia/danm \ && cd $GOPATH/src/github.com/nokia/danm \ diff --git a/docker-build/flannel/Dockerfile b/docker-build/flannel/Dockerfile index 45c6e97..5dd12d6 100644 --- a/docker-build/flannel/Dockerfile +++ b/docker-build/flannel/Dockerfile @@ -17,14 +17,13 @@ MAINTAINER Levente Kale ARG FLANNEL ENV FLANNEL_VERSION=$FLANNEL -ARG FLANNEL_ARCHITECTURE -ENV FLANNEL_ARCH=$FLANNEL_ARCHITECTURE RUN apk add --no-cache wget iproute2 net-tools ca-certificates iptables strongswan && update-ca-certificates && \ apk add wireguard-tools --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community RUN mkdir -p /opt/bin && \ - wget -O /opt/bin/flanneld https://github.com/coreos/flannel/releases/download/v${FLANNEL_VERSION}/flanneld-${FLANNEL_ARCH} && \ + if [ $(uname -m) == 'aarch64' ]; then HOST_ARCH=arm64; else HOST_ARCH=amd64; fi && \ + wget -O /opt/bin/flanneld https://github.com/coreos/flannel/releases/download/v${FLANNEL_VERSION}/flanneld-${HOST_ARCH} && \ chmod +x /opt/bin/flanneld && \ wget -O /opt/bin/mk-docker-opts.sh https://github.com/coreos/flannel/blob/v${FLANNEL_VERSION}/dist/mk-docker-opts.sh -- 2.16.6