From 41e97b6c42e1ef28b40924005ec01affa58ea543 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sat, 28 Sep 2019 01:02:31 +0200 Subject: [PATCH] AArch64 support - spec: change hardcoded x86_64 arch to current platform arch; - spec: bump dependency manager version from 0.5.0 to 0.5.4, the first golang/dep release to include arm64 (aarch64) bins; - Dockerfile(s): download arch-specific golang/dep binaries; - spec: Bump minor RPM version; Co-authored-by: Jimmy Lafontaine Rivera Signed-off-by: Alexandru Avadanii Change-Id: Ic2d1cf245bb1a2eff6ee508c10a7ccb0d7f135ef --- SPECS/caas-custom_metrics.spec | 6 +++--- SPECS/caas-metrics_server.spec | 6 +++--- SPECS/caas-prometheus.spec | 4 ++-- docker-build/custom_metrics/Dockerfile | 5 +++-- docker-build/metrics_server/Dockerfile | 7 ++++--- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/SPECS/caas-custom_metrics.spec b/SPECS/caas-custom_metrics.spec index 98382e0..fff433a 100644 --- a/SPECS/caas-custom_metrics.spec +++ b/SPECS/caas-custom_metrics.spec @@ -15,9 +15,9 @@ %define COMPONENT custom_metrics %define RPM_NAME caas-%{COMPONENT} %define RPM_MAJOR_VERSION 0.5.0 -%define RPM_MINOR_VERSION 2 +%define RPM_MINOR_VERSION 3 %define go_version 1.12.9 -%define DEP_MAN_VERSION 0.5.0 +%define DEP_MAN_VERSION 0.5.4 %define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION} Name: %{RPM_NAME} @@ -26,7 +26,7 @@ Release: %{RPM_MINOR_VERSION}%{?dist} Summary: Containers as a Service Custom Metrics component License: %{_platform_license} and Apache License URL: https://github.com/DirectXMan12/k8s-prometheus-adapter -BuildArch: x86_64 +BuildArch: %{_arch} Vendor: %{_platform_vendor} and DirectXMan12/k8s-prometheus-adapter unmodified Source0: %{name}-%{version}.tar.gz diff --git a/SPECS/caas-metrics_server.spec b/SPECS/caas-metrics_server.spec index c09b0dd..4fc5e6d 100644 --- a/SPECS/caas-metrics_server.spec +++ b/SPECS/caas-metrics_server.spec @@ -15,9 +15,9 @@ %define COMPONENT metrics_server %define RPM_NAME caas-%{COMPONENT} %define RPM_MAJOR_VERSION 0.3.3 -%define RPM_MINOR_VERSION 2 +%define RPM_MINOR_VERSION 3 %define go_version 1.12.9 -%define DEP_MAN_VERSION 0.5.0 +%define DEP_MAN_VERSION 0.5.4 %define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION} Name: %{RPM_NAME} @@ -26,7 +26,7 @@ Release: %{RPM_MINOR_VERSION}%{?dist} Summary: Containers as a Service Metrics Server component License: %{_platform_license} and MIT license and BSD and Apache License and GNU LGPLv3 URL: https://github.com/kubernetes-incubator/metrics-server -BuildArch: x86_64 +BuildArch: %{_arch} Vendor: %{_platform_vendor} and kubernetes-incubator/metrics-server unmodified Source0: %{name}-%{version}.tar.gz diff --git a/SPECS/caas-prometheus.spec b/SPECS/caas-prometheus.spec index e5d86db..3de617f 100644 --- a/SPECS/caas-prometheus.spec +++ b/SPECS/caas-prometheus.spec @@ -15,7 +15,7 @@ %define COMPONENT prometheus %define RPM_NAME caas-%{COMPONENT} %define RPM_MAJOR_VERSION 2.11.1 -%define RPM_MINOR_VERSION 1 +%define RPM_MINOR_VERSION 2 %define go_version 1.12.9 %define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION} @@ -25,7 +25,7 @@ Release: %{RPM_MINOR_VERSION}%{?dist} Summary: Containers as a Service Prometheus component License: %{_platform_license} and BSD and Apache License and MIT license and Mozilla Public License and Lesser General Public License and GNU General Public License v2.0 only URL: https://github.com/prometheus/prometheus -BuildArch: x86_64 +BuildArch: %{_arch} Vendor: %{_platform_vendor} and prometheus/prometheus unmodified Source0: %{name}-%{version}.tar.gz diff --git a/docker-build/custom_metrics/Dockerfile b/docker-build/custom_metrics/Dockerfile index 902ab79..e013656 100644 --- a/docker-build/custom_metrics/Dockerfile +++ b/docker-build/custom_metrics/Dockerfile @@ -29,8 +29,9 @@ RUN apk add --no-cache --virtual .build-deps build-base go godep curl tar git gl && mkdir -p ${GOPATH}/src/github.com/directxman12/k8s-prometheus-adapter \ && curl -fsSL -k https://github.com/DirectXMan12/k8s-prometheus-adapter/archive/v${CUSTOM_METRICS_VERSION}.tar.gz | tar zx --strip-components=1 -C ${GOPATH}/src/github.com/directxman12/k8s-prometheus-adapter \ && cd ${GOPATH}/src/github.com/directxman12/k8s-prometheus-adapter \ -&& make all \ -&& mv _output/amd64/adapter /adapter \ +&& if [ $(uname -m) == 'aarch64' ]; then HOST_ARCH=arm64; else HOST_ARCH=amd64; fi \ +&& make all ARCH=${HOST_ARCH} \ +&& mv _output/${HOST_ARCH}/adapter /adapter \ && chmod +x /adapter \ && apk del .build-deps \ && rm -rf ${GOPATH} \ diff --git a/docker-build/metrics_server/Dockerfile b/docker-build/metrics_server/Dockerfile index 7c012b5..4a7a792 100644 --- a/docker-build/metrics_server/Dockerfile +++ b/docker-build/metrics_server/Dockerfile @@ -29,7 +29,8 @@ RUN apk add --no-cache --virtual .build-deps build-base go godep curl tar git ba && curl -fsSL -k https://dl.google.com/go/go${go_version}.src.tar.gz | tar zx --strip-components=1 -C ${go_install_dir} \ && cd ${go_install_dir}/src/ \ && ./make.bash \ -&& curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v${DEP_MAN_VERSION}/dep-linux-amd64 \ +&& if [ $(uname -m) == 'aarch64' ]; then HOST_ARCH=arm64; else HOST_ARCH=amd64; fi \ +&& curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v${DEP_MAN_VERSION}/dep-linux-${HOST_ARCH} \ && chmod +x /usr/local/bin/dep \ && mkdir -p ${GOPATH}/src/github.com/kubernetes-incubator/metrics-server/ \ && curl -fsSL -k https://github.com/kubernetes-incubator/metrics-server/archive/v${METRICS_SERVER_VERSION}.tar.gz | tar zx --strip-components=1 -C ${GOPATH}/src/github.com/kubernetes-incubator/metrics-server/ \ @@ -37,8 +38,8 @@ RUN apk add --no-cache --virtual .build-deps build-base go godep curl tar git ba && dep ensure --vendor-only \ # static linking added && sed -i "s?LDFLAGS=-w \$(VERSION_LDFLAGS)?LDFLAGS='-extldflags "-static"' -w \$(VERSION_LDFLAGS)?" ./Makefile \ -&& make \ -&& mv ./_output/amd64/metrics-server /metrics-server \ +&& make ARCH=${HOST_ARCH} \ +&& mv ./_output/${HOST_ARCH}/metrics-server /metrics-server \ && apk del .build-deps \ && rm -rf ${GOPATH} \ && rm -rf $go_install_dir \ -- 2.16.6