From f18a21e5b400b9ac36b4b5f8f3d7ce3948c5d062 Mon Sep 17 00:00:00 2001
From: duanhongyi <duanhongyi@doopai.com>
Date: Tue, 15 Aug 2023 10:50:27 +0800
Subject: [PATCH] chore(controller): bump common 1.1.2

---
 charts/controller/Chart.yaml                  |  2 +-
 .../templates/controller-api-deployment.yaml  |  6 +--
 .../controller-celery-deloyment.yaml          |  6 +--
 .../controller-webhook-deloyment.yaml         |  6 +--
 charts/controller/values.yaml                 | 47 +++++--------------
 5 files changed, 22 insertions(+), 45 deletions(-)

diff --git a/charts/controller/Chart.yaml b/charts/controller/Chart.yaml
index a8ac76fa6..ce28fa54e 100644
--- a/charts/controller/Chart.yaml
+++ b/charts/controller/Chart.yaml
@@ -5,7 +5,7 @@ appVersion: 1.0.0
 dependencies:
   - name: common
     repository: oci://registry.drycc.cc/charts
-    version: ~1.1.1
+    version: ~1.1.2
 description: Drycc Workflow Controller (API).
 maintainers:
   - name: Drycc Team
diff --git a/charts/controller/templates/controller-api-deployment.yaml b/charts/controller/templates/controller-api-deployment.yaml
index 00e3abfbf..c6e0f5310 100644
--- a/charts/controller/templates/controller-api-deployment.yaml
+++ b/charts/controller/templates/controller-api-deployment.yaml
@@ -18,12 +18,12 @@ spec:
       app: drycc-controller-api
   template:
     metadata:
-      labels:
+      labels: {{- include "common.labels.standard" . | nindent 8 }}
         app: drycc-controller-api
     spec:
       affinity:
-        podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.api.podAffinityPreset.type "key" .Values.api.podAffinityPreset.key "values" .Values.api.podAffinityPreset.values ) | nindent 10 }}
-        podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.api.podAntiAffinityPreset.type "key" .Values.api.podAntiAffinityPreset.key "values" .Values.api.podAntiAffinityPreset.values ) | nindent 10 }}
+        podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.api.podAffinityPreset.type "component" "" "extraMatchLabels" .Values.api.podAffinityPreset.extraMatchLabels "topologyKey" "" "context" $) | nindent 10 }}
+        podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.api.podAntiAffinityPreset.type "component" "" "extraMatchLabels" .Values.api.podAntiAffinityPreset.extraMatchLabels "topologyKey" "" "context" $) | nindent 10 }}
         nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.api.nodeAffinityPreset.type "key" .Values.api.nodeAffinityPreset.key "values" .Values.api.nodeAffinityPreset.values ) | nindent 10 }}
       serviceAccount: drycc-controller
       initContainers:
diff --git a/charts/controller/templates/controller-celery-deloyment.yaml b/charts/controller/templates/controller-celery-deloyment.yaml
index 2fc485241..924c94e74 100644
--- a/charts/controller/templates/controller-celery-deloyment.yaml
+++ b/charts/controller/templates/controller-celery-deloyment.yaml
@@ -18,12 +18,12 @@ spec:
       app: drycc-controller-celery
   template:
     metadata:
-      labels:
+      labels: {{- include "common.labels.standard" . | nindent 8 }}
         app: drycc-controller-celery
     spec:
       affinity:
-        podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.celery.podAffinityPreset.type "key" .Values.celery.podAffinityPreset.key "values" .Values.celery.podAffinityPreset.values ) | nindent 10 }}
-        podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.celery.podAntiAffinityPreset.type "key" .Values.celery.podAntiAffinityPreset.key "values" .Values.celery.podAntiAffinityPreset.values ) | nindent 10 }}
+        podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.celery.podAffinityPreset.type "component" "" "extraMatchLabels" .Values.celery.podAffinityPreset.extraMatchLabels "topologyKey" "" "context" $) | nindent 10 }}
+        podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.celery.podAntiAffinityPreset.type "component" "" "extraMatchLabels" .Values.celery.podAntiAffinityPreset.extraMatchLabels "topologyKey" "" "context" $) | nindent 10 }}
         nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.celery.nodeAffinityPreset.type "key" .Values.celery.nodeAffinityPreset.key "values" .Values.celery.nodeAffinityPreset.values ) | nindent 10 }}
       serviceAccount: drycc-controller
       initContainers:
diff --git a/charts/controller/templates/controller-webhook-deloyment.yaml b/charts/controller/templates/controller-webhook-deloyment.yaml
index d55db1309..6375ae1d3 100644
--- a/charts/controller/templates/controller-webhook-deloyment.yaml
+++ b/charts/controller/templates/controller-webhook-deloyment.yaml
@@ -9,12 +9,12 @@ spec:
       component: drycc-controller-webhook
   template:
     metadata:
-      labels:
+      labels: {{- include "common.labels.standard" . | nindent 8 }}
         component: drycc-controller-webhook
     spec:
       affinity:
-        podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.webhook.podAffinityPreset.type "key" .Values.webhook.podAffinityPreset.key "values" .Values.webhook.podAffinityPreset.values ) | nindent 10 }}
-        podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.webhook.podAntiAffinityPreset.type "key" .Values.webhook.podAntiAffinityPreset.key "values" .Values.webhook.podAntiAffinityPreset.values ) | nindent 10 }}
+        podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.webhook.podAffinityPreset.type "component" "" "extraMatchLabels" .Values.webhook.podAffinityPreset.extraMatchLabels "topologyKey" "" "context" $) | nindent 10 }}
+        podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.webhook.podAntiAffinityPreset.type "component" "" "extraMatchLabels" .Values.webhook.podAntiAffinityPreset.extraMatchLabels "topologyKey" "" "context" $) | nindent 10 }}
         nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.webhook.nodeAffinityPreset.type "key" .Values.webhook.nodeAffinityPreset.key "values" .Values.webhook.nodeAffinityPreset.values ) | nindent 10 }}
       initContainers:
       - name: drycc-controller-init
diff --git a/charts/controller/values.yaml b/charts/controller/values.yaml
index a471b96be..5e9e42149 100644
--- a/charts/controller/values.yaml
+++ b/charts/controller/values.yaml
@@ -67,15 +67,13 @@ api:
     values:
     - "true"
   podAffinityPreset:
-    key: "security"
     type: ""
-    values:
-    - "drycc-security"
+    extraMatchLabels:
+      security: "drycc-security"
   podAntiAffinityPreset:
-    key: "app"
     type: "soft"
-    values:
-    - "drycc-controller-api"
+    extraMatchLabels:
+      app: "drycc-controller-api"
 
 celery:
   nodeAffinityPreset:
@@ -84,15 +82,13 @@ celery:
     values:
     - "true"
   podAffinityPreset:
-    key: "security"
     type: ""
-    values:
-    - "drycc-security"
+    extraMatchLabels:
+      security: "drycc-security"
   podAntiAffinityPreset:
-    key: "app"
     type: "soft"
-    values:
-    - "drycc-controller-celery"
+    extraMatchLabels:
+      app: "drycc-controller-celery"
 
 webhook:
   nodeAffinityPreset:
@@ -101,32 +97,13 @@ webhook:
     values:
     - "true"
   podAffinityPreset:
-    key: "security"
-    type: ""
-    values:
-    - "drycc-security"
-  podAntiAffinityPreset:
-    key: "app"
-    type: "soft"
-    values:
-    - "drycc-controller-webhook"
-
-cronjob:
-  nodeAffinityPreset:
-    key: "drycc.cc/node"
-    type: "soft"
-    values:
-    - "true"
-  podAffinityPreset:
-    key: "security"
     type: ""
-    values:
-    - "drycc-security"
+    extraMatchLabels:
+      security: "drycc-security"
   podAntiAffinityPreset:
-    key: "app"
     type: "soft"
-    values:
-    - "drycc-controller-webhook"
+    extraMatchLabels:
+      component: "drycc-controller-webhook"
 
 redis:
   replicas: 1
