From 6b9cdd817fb7354adf433fc3426d6a0e654b5fb8 Mon Sep 17 00:00:00 2001 From: Alok Bhatt Date: Wed, 11 Nov 2020 06:40:32 +0000 Subject: [PATCH] Enabling helm3 Support for xapp-onboarder. Added env variable in Dockerfile & used it in application code. The helm2 will still be working Issue-ID: RIC-679 Signed-off-by: Alok Bhatt Change-Id: I197c665241d477eb1606de454c0f08c8af1ce234 --- ci/xapp_onboarder/Dockerfile | 4 ++-- xapp_onboarder/xapp_onboarder/helm_controller/xApp_builder.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ci/xapp_onboarder/Dockerfile b/ci/xapp_onboarder/Dockerfile index 28a72b1..3f594c4 100644 --- a/ci/xapp_onboarder/Dockerfile +++ b/ci/xapp_onboarder/Dockerfile @@ -17,11 +17,11 @@ FROM python:3.7-alpine ADD ./xapp_onboarder /opt/xapp_onboarder - RUN cd /opt/xapp_onboarder && pip3 install . && rm -r /opt/xapp_onboarder ARG HELM_VERSION="2.12.3" +ENV HELM_VERSION=${HELM_VERSION} -RUN wget https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz && tar -xvf helm-v${HELM_VERSION}-linux-amd64.tar.gz && mv linux-amd64/helm /usr/local/bin/helm && rm -r linux-amd64 && rm helm-v${HELM_VERSION}-linux-amd64.tar.gz +RUN wget https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz && tar -xvf helm-v${HELM_VERSION}-linux-amd64.tar.gz && mv linux-amd64/helm /usr/local/bin/helm && rm -r linux-amd64 && rm helm-v${HELM_VERSION}-linux-amd64.tar.gz ENTRYPOINT ["xapp_onboarder"] diff --git a/xapp_onboarder/xapp_onboarder/helm_controller/xApp_builder.py b/xapp_onboarder/xapp_onboarder/helm_controller/xApp_builder.py index ab314ad..da9f34a 100644 --- a/xapp_onboarder/xapp_onboarder/helm_controller/xApp_builder.py +++ b/xapp_onboarder/xapp_onboarder/helm_controller/xApp_builder.py @@ -209,7 +209,12 @@ class xApp(): self.change_chart_name_version() self.helm_lint() try: - process = subprocess.run([self.helm_client_path, "package", self.chart_workspace_path + "/" + self.chart_name, "-d" + + if settings.HELM_VERSION.startswith("3") == True: + process = subprocess.run([self.helm_client_path, "package", self.chart_workspace_path + "/" + self.chart_name, "-d" + ,self.chart_workspace_path], stdout=PIPE, stderr=PIPE, check=True) + else: + process = subprocess.run([self.helm_client_path, "package", self.chart_workspace_path + "/" + self.chart_name, "-d" ,self.chart_workspace_path,"--save=false"], stdout=PIPE, stderr=PIPE, check=True) except OSError as err: -- 2.16.6