From 382147847becb857f41f17d0fa796c48e0780b89 Mon Sep 17 00:00:00 2001 From: Jonathan Ervine <57888439+jervine-gogo@users.noreply.github.com> Date: Wed, 16 Dec 2020 11:55:14 +0800 Subject: [PATCH 1/4] Use helm3 for chart list --- main.py | 5 ++--- routes/kube_helm_routes.py | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 9fa1e69..63261ff 100644 --- a/main.py +++ b/main.py @@ -49,9 +49,8 @@ def get_deployments(namespace): data = json.loads(output) return data -def get_charts(tiller_ns, namespace): - command = "/usr/local/bin/helm --tiller-namespace " + tiller_ns + " list --output json" #helm2 - #command = "/usr/local/bin/helm -n " + namespace + " list -ojson" #helm3 +def get_charts(ns): + command = "/usr/local/bin/helm -n " + ns + " list -ojson" #helm3 info(f"Running command: {command}") try: output = check_output(command.split(" "), stderr=STDOUT).decode("utf-8") diff --git a/routes/kube_helm_routes.py b/routes/kube_helm_routes.py index 184de81..32835eb 100644 --- a/routes/kube_helm_routes.py +++ b/routes/kube_helm_routes.py @@ -25,9 +25,9 @@ def chartVersions(): return render_template('chartRevisionList.html', table=table) -@routes.route('/nsLookup//') -def namespaceLookup(tiller_ns, namespace): - charts = get_charts(tiller_ns, namespace) +@routes.route('/nsLookup//') +def namespaceLookup(ns): + charts = get_charts(ns) return jsonify(charts) @routes.route('/deployChartRevision///', methods=['POST']) From ce93547df7b633d965fe4b0fd6235a70879f74ed Mon Sep 17 00:00:00 2001 From: Jonathan Ervine <57888439+jervine-gogo@users.noreply.github.com> Date: Mon, 28 Dec 2020 15:48:07 +0800 Subject: [PATCH 2/4] 'pklk --- main.py | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/main.py b/main.py index ab09c7e..f205039 100644 --- a/main.py +++ b/main.py @@ -23,33 +23,6 @@ def get_namespaces(): ns = v1.list_namespace() return ns -<<<<<<< HEAD -def get_tiller_namespaces(): - command = "/usr/local/bin/kubectl get deploy --all-namespaces -l name=tiller -ojson" - info(f"Running command: {command}") - try: - output = check_output(command.split(" "), stderr=STDOUT).decode("utf-8") - except CalledProcessError as err: - error(err.output.decode("utf-8")) - raise err - info(f"Output from command:\n{output}") - data = json.loads(output) - return data - -def get_deployments(namespace): - command = "/usr/local/bin/kubectl -n " + namespace + " get deploy -ojson" - info(f"Running command: {command}") - try: - output = check_output(command.split(" "), stderr=STDOUT).decode("utf-8") - except CalledProcessError as err: - error(err.output.decode("utf-8")) - raise err - info(f"Output from command:\n{output}") - data = json.loads(output) - return data - -======= ->>>>>>> a7df40eb7710553f5d0185c3fa04ea6991c06f89 def get_charts(ns): command = "/usr/local/bin/helm -n " + ns + " list -ojson" #helm3 info(f"Running command: {command}") From fac92ff0405399b8f6d27b20144a41adea0fa500 Mon Sep 17 00:00:00 2001 From: Jonny Ervine Date: Mon, 4 Jan 2021 03:05:29 +0000 Subject: [PATCH 3/4] Update 'routes/kube_helm_routes.py' --- routes/kube_helm_routes.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/routes/kube_helm_routes.py b/routes/kube_helm_routes.py index 53ba0ce..0f51d40 100644 --- a/routes/kube_helm_routes.py +++ b/routes/kube_helm_routes.py @@ -23,12 +23,7 @@ def chartVersions(): table.classes = ['table-striped', 'table-condensed', 'table-hover'] return render_template('chartRevisionList.html', table=table) - -<<<<<<< HEAD -@routes.route('/nsLookup//') -======= @routes.route('/nsLookup/') ->>>>>>> a7df40eb7710553f5d0185c3fa04ea6991c06f89 def namespaceLookup(ns): charts = get_charts(ns) return jsonify(charts) From fccdf0f2b276bc44b58920b166bb130f3548059d Mon Sep 17 00:00:00 2001 From: Jonny Ervine Date: Mon, 4 Jan 2021 03:11:45 +0000 Subject: [PATCH 4/4] Update 'Dockerfile' --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c093629..1b1d8bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,8 +14,8 @@ RUN apk update && \ adduser -D python && \ mkdir /data && cd /data && git clone --single-branch --branch issue-#2 https://github.com/jervine-gogo/python-helm-web /data && \ pip3 install -r /data/requirements.txt && \ - curl -L https://get.helm.sh/helm-v2.13.1-linux-amd64.tar.gz -o /tmp/helm-2.13.1.tgz && \ - tar -zxvf /tmp/helm-2.13.1.tgz --strip-components=1 -C /usr/local/bin linux-amd64/helm && \ + curl -L https://get.helm.sh/helm-v3.4.2-linux-amd64.tar.gz -o /tmp/helm-3.4.2.tgz && \ + tar -zxvf /tmp/helm-3.4.2.tgz --strip-components=1 -C /usr/local/bin linux-amd64/helm && \ rm -rf /tmp/src && rm -rf /var/cache/apk/* EXPOSE 3000