From 491cc9200405931de807234cb0dc299bff76e3ea Mon Sep 17 00:00:00 2001 From: Krisztian Lengyel Date: Fri, 7 Jun 2019 11:45:44 +0200 Subject: [PATCH] Update CPU-Pooler version Update to a yet unreleased version of CPU-Pooler. Change-Id: Ib60165c9e5ece887a9ab4519515d4dbded3b6af4 Signed-off-by: Krisztian Lengyel --- ansible/roles/cpupooler/defaults/main.yaml | 22 ---------------------- .../cpupooler/templates/cpu_pooler_config.yaml.j2 | 4 ++-- docker-build/cpupooler/Dockerfile | 16 +++++++++------- docker-build/process-starter/Dockerfile | 15 ++++++++------- rpmbuild.spec | 7 ++++--- 5 files changed, 23 insertions(+), 41 deletions(-) delete mode 100644 ansible/roles/cpupooler/defaults/main.yaml diff --git a/ansible/roles/cpupooler/defaults/main.yaml b/ansible/roles/cpupooler/defaults/main.yaml deleted file mode 100644 index c0ebce3..0000000 --- a/ansible/roles/cpupooler/defaults/main.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -# Copyright 2019 Nokia -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -cpu_allocation_mapping: - caas_exclusive: - pool_name: exclusive_caas - caas_shared: - pool_name: shared_caas - caas_default: - pool_name: default diff --git a/ansible/roles/cpupooler/templates/cpu_pooler_config.yaml.j2 b/ansible/roles/cpupooler/templates/cpu_pooler_config.yaml.j2 index c138125..c9ee90c 100644 --- a/ansible/roles/cpupooler/templates/cpu_pooler_config.yaml.j2 +++ b/ansible/roles/cpupooler/templates/cpu_pooler_config.yaml.j2 @@ -21,8 +21,8 @@ limitations under the License. pools: {% set cpu_allocation = hostdata.get('ansible_local', {}).get('cpu_allocation', {}) %} {% for allocation_name, allocation in cpu_allocation.iteritems() %} - {% if allocation_name in cpu_allocation_mapping %} - {{ cpu_allocation_mapping[allocation_name]['pool_name'] }}: + {% if allocation_name in caas.cpu_allocation_mapping %} + {{ caas.cpu_allocation_mapping[allocation_name]['pool_name'] }}: cpus: "{{ allocation.get('list', '') }}" {% endif %} {% endfor %} diff --git a/docker-build/cpupooler/Dockerfile b/docker-build/cpupooler/Dockerfile index 33dad86..52e3a26 100644 --- a/docker-build/cpupooler/Dockerfile +++ b/docker-build/cpupooler/Dockerfile @@ -21,27 +21,29 @@ ARG CPUPOOLER ENV CPUPOOLER_VERSION=$CPUPOOLER ENV GOPATH /build ENV PATH /usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV BUILD_DIR="$GOPATH/src/github.com/nokia/CPU-Pooler" RUN apk update \ && apk upgrade \ && apk add --no-cache --virtual .build-deps build-base git mercurial go glide bash tar curl \ -&& mkdir -p $GOPATH/src/github.com/nokia/CPU-Pooler \ && curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 \ && chmod +x /usr/local/bin/dep \ -&& curl -fsSL -k https://github.com/nokia/CPU-Pooler/archive/v${CPUPOOLER_VERSION}.tar.gz | tar zx --strip-components=1 -C $GOPATH/src/github.com/nokia/CPU-Pooler \ -&& cd $GOPATH/src/github.com/nokia/CPU-Pooler \ +&& mkdir -p $BUILD_DIR \ +&& git clone https://github.com/Levovar/CPU-Pooler.git $BUILD_DIR \ +&& cd $BUILD_DIR \ +&& git fetch --tags \ +&& git checkout ${CPUPOOLER_VERSION} \ && dep ensure --vendor-only \ # cpu-device-plugin && CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o cpu-device-plugin ./cmd/cpu-device-plugin \ -&& mv $GOPATH/src/github.com/nokia/CPU-Pooler/cpu-device-plugin /cpu-device-plugin \ +&& mv $BUILD_DIR/cpu-device-plugin /cpu-device-plugin \ # cpu-setter && CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o cpu-setter ./cmd/cpusetter \ -&& mv $GOPATH/src/github.com/nokia/CPU-Pooler/cpu-setter /cpu-setter \ +&& mv $BUILD_DIR/cpu-setter /cpu-setter \ # cpu-webhook && CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o cpu-device-webhook ./cmd/webhook \ -&& mv $GOPATH/src/github.com/nokia/CPU-Pooler/cpu-device-webhook /cpu-device-webhook \ +&& mv $BUILD_DIR/cpu-device-webhook /cpu-device-webhook \ && apk del .build-deps \ && rm -rf $GOPATH \ && rm -rf /build \ && rm -rf /root/.glide - diff --git a/docker-build/process-starter/Dockerfile b/docker-build/process-starter/Dockerfile index 2f474e1..bcb1e0c 100644 --- a/docker-build/process-starter/Dockerfile +++ b/docker-build/process-starter/Dockerfile @@ -20,6 +20,7 @@ ENV DEP_VERSION=$DEPENDENCY_MANAGER ARG CPUPOOLER ENV CPUPOOLER_VERSION=$CPUPOOLER ENV GOPATH /build +ENV BUILD_DIR="$GOPATH/src/github.com/nokia/CPU-Pooler" RUN yum update -y \ && yum install -y \ @@ -42,13 +43,13 @@ RUN yum update -y \ && yum install -y golang \ && curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 \ && chmod +x /usr/local/bin/dep \ -&& mkdir -p $GOPATH/src/github.com/nokia/CPU-Pooler \ -&& curl -fsSL -k https://github.com/nokia/CPU-Pooler/archive/v${CPUPOOLER_VERSION}.tar.gz | tar zx --strip-components=1 -C $GOPATH/src/github.com/nokia/CPU-Pooler \ -&& cd $GOPATH/src/github.com/nokia/CPU-Pooler \ +&& mkdir -p $BUILD_DIR \ +&& git clone https://github.com/Levovar/CPU-Pooler.git $BUILD_DIR \ +&& cd $BUILD_DIR \ +&& git fetch --tags \ +&& git checkout ${CPUPOOLER_VERSION} \ && dep ensure --vendor-only \ # process-starter && CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o process-starter ./cmd/process-starter \ -&& mv $GOPATH/src/github.com/nokia/CPU-Pooler/process-starter /process-starter \ -&& rm -rf $GOPATH - - +&& mv $BUILD_DIR/process-starter /process-starter \ +&& rm -rf $GOPATH diff --git a/rpmbuild.spec b/rpmbuild.spec index bae169b..0d75738 100644 --- a/rpmbuild.spec +++ b/rpmbuild.spec @@ -16,7 +16,8 @@ %define COMPONENT_PART process-starter %define RPM_NAME caas-%{COMPONENT} %define RPM_MAJOR_VERSION 0.2.0 -%define RPM_MINOR_VERSION 2 +%define RPM_MINOR_VERSION 3 +%define CPUPOOLER_VERSION 808b717165c10b0752bbafd4e2898d4e20c2fae8 %define DEPENDENCY_MANAGER_VERSION 0.5.0 %define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION} %define PROCESS_STARTER_INSTALL_PATH /opt/bin/ @@ -57,7 +58,7 @@ docker build \ --build-arg https_proxy="${https_proxy}" \ --build-arg no_proxy="${no_proxy}" \ --build-arg DEPENDENCY_MANAGER="%{DEPENDENCY_MANAGER_VERSION}" \ - --build-arg CPUPOOLER="%{RPM_MAJOR_VERSION}" \ + --build-arg CPUPOOLER="%{CPUPOOLER_VERSION}" \ --tag %{COMPONENT_PART}:builder \ %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-build/%{COMPONENT_PART}/ @@ -103,7 +104,7 @@ docker build \ --build-arg https_proxy="${https_proxy}" \ --build-arg no_proxy="${no_proxy}" \ --build-arg DEPENDENCY_MANAGER="%{DEPENDENCY_MANAGER_VERSION}" \ - --build-arg CPUPOOLER="%{RPM_MAJOR_VERSION}" \ + --build-arg CPUPOOLER="%{CPUPOOLER_VERSION}" \ --tag %{COMPONENT}:%{IMAGE_TAG} \ %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-build/%{COMPONENT}/ -- 2.16.6