From 1af2a3abedc15fa0bf73180f55179ba1fce1a065 Mon Sep 17 00:00:00 2001
From: lijianguo <lijianguo@zhumengyuan.com>
Date: Mon, 26 Jul 2021 13:55:38 +0800
Subject: [PATCH 1/2] chore(chart): modify the problem of using buildpack

---
 charts/controller/templates/controller-celery.yaml        | 4 ----
 charts/controller/templates/controller-cronjob-daily.yaml | 6 ------
 charts/controller/templates/controller-deployment.yaml    | 2 --
 3 files changed, 12 deletions(-)

diff --git a/charts/controller/templates/controller-celery.yaml b/charts/controller/templates/controller-celery.yaml
index 3d1f34d23..c4832f7f3 100644
--- a/charts/controller/templates/controller-celery.yaml
+++ b/charts/controller/templates/controller-celery.yaml
@@ -33,7 +33,6 @@ spec:
             - celery -A api worker -Q priority.high --autoscale=32,1 --loglevel=WARNING
           {{- include "controller.limits" . | indent 10 }}
           {{- include "controller.envs" . | indent 10 }}
-          {{- include "controller.volumeMounts" . | indent 10 }}
         - name: drycc-controller-celery-middle
           image: {{.Values.image_registry}}/{{.Values.org}}/controller:{{.Values.image_tag}}
           imagePullPolicy: {{.Values.image_pull_policy}}
@@ -44,7 +43,6 @@ spec:
             - celery -A api worker -Q priority.middle --autoscale=16,1 --loglevel=WARNING
           {{- include "controller.limits" . | indent 10 }}
           {{- include "controller.envs" . | indent 10 }}
-          {{- include "controller.volumeMounts" . | indent 10 }}
         - name: drycc-controller-celery-low
           image: {{.Values.image_registry}}/{{.Values.org}}/controller:{{.Values.image_tag}}
           imagePullPolicy: {{.Values.image_pull_policy}}
@@ -55,5 +53,3 @@ spec:
             - celery -A api worker -Q priority.low --autoscale=8,1 --loglevel=WARNING
           {{- include "controller.limits" . | indent 10 }}
           {{- include "controller.envs" . | indent 10 }}
-          {{- include "controller.volumeMounts" . | indent 10 }}
-      {{- include "controller.volumes" . | indent 6 }}
diff --git a/charts/controller/templates/controller-cronjob-daily.yaml b/charts/controller/templates/controller-cronjob-daily.yaml
index 03296e073..9bf1bbafa 100644
--- a/charts/controller/templates/controller-cronjob-daily.yaml
+++ b/charts/controller/templates/controller-cronjob-daily.yaml
@@ -26,7 +26,6 @@ spec:
             args:
               - python /app/manage.py load_db_state_to_k8s
             {{- include "controller.envs" . | indent 12 }}
-            {{- include "controller.volumeMounts" . | indent 12 }}
           - image: {{.Values.image_registry}}/{{.Values.org}}/controller:{{.Values.image_tag}}
             imagePullPolicy: {{.Values.pull_policy}}
             name: drycc-controller-measure-app
@@ -36,7 +35,6 @@ spec:
             args:
               - python -u /app/manage.py measure_app
             {{- include "controller.envs" . | indent 12 }}
-            {{- include "controller.volumeMounts" . | indent 12 }}
           - image: {{.Values.image_registry}}/{{.Values.org}}/controller:{{.Values.image_tag}}
             imagePullPolicy: {{.Values.pull_policy}}
             name: drycc-controller-measure-config
@@ -46,7 +44,6 @@ spec:
             args:
               - python -u /app/manage.py measure_config
             {{- include "controller.envs" . | indent 12 }}
-            {{- include "controller.volumeMounts" . | indent 12 }}
           - image: {{.Values.image_registry}}/{{.Values.org}}/controller:{{.Values.image_tag}}
             imagePullPolicy: {{.Values.pull_policy}}
             name: drycc-controller-measure-resources
@@ -56,7 +53,6 @@ spec:
             args:
               - python -u /app/manage.py measure_resources
             {{- include "controller.envs" . | indent 12 }}
-            {{- include "controller.volumeMounts" . | indent 12 }}
           - image: {{.Values.image_registry}}/{{.Values.org}}/controller:{{.Values.image_tag}}
             imagePullPolicy: {{.Values.pull_policy}}
             name: drycc-controller-measure-volumes
@@ -66,5 +62,3 @@ spec:
             args:
               - python -u /app/manage.py measure_volumes
             {{- include "controller.envs" . | indent 12 }}
-            {{- include "controller.volumeMounts" . | indent 12 }}
-          {{- include "controller.volumes" . | indent 10 }}
diff --git a/charts/controller/templates/controller-deployment.yaml b/charts/controller/templates/controller-deployment.yaml
index deabcdc9d..13bd297a5 100644
--- a/charts/controller/templates/controller-deployment.yaml
+++ b/charts/controller/templates/controller-deployment.yaml
@@ -44,5 +44,3 @@ spec:
               name: http
           {{- include "controller.limits" . | indent 10 }}
           {{- include "controller.envs" . | indent 10 }}
-          {{- include "controller.volumeMounts" . | indent 10 }}
-      {{- include "controller.volumes" . | indent 6 }}

From cdea890109751000c29efc198921b1f3c3fc9d73 Mon Sep 17 00:00:00 2001
From: lijianguo <lijianguo@zhumengyuan.com>
Date: Mon, 26 Jul 2021 13:56:10 +0800
Subject: [PATCH 2/2] chore(controller): pretty pods list print

---
 rootfs/api/views.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/rootfs/api/views.py b/rootfs/api/views.py
index 84de70e31..2d5fe51e6 100644
--- a/rootfs/api/views.py
+++ b/rootfs/api/views.py
@@ -352,6 +352,8 @@ def list(self, *args, **kwargs):
             exist_pod_type = list(set([_["type"] for _ in data if _["type"]]))
             structure = self.get_app().structure
             procfile_structure = self.get_app().procfile_structure
+            # remove prev release container type
+            structure = {k: v for k, v in structure.items() if (v != 0 or k in procfile_structure)} # noqa
             for _ in structure.keys():
                 if _ not in exist_pod_type:
                     replicas = str(autoscale[_]['min']) + '-' + str(autoscale[_]['max']) \
