diff --git a/helm-charts/bk-dbm/Chart.lock b/helm-charts/bk-dbm/Chart.lock index bc281186f1..0f3face760 100644 --- a/helm-charts/bk-dbm/Chart.lock +++ b/helm-charts/bk-dbm/Chart.lock @@ -19,7 +19,7 @@ dependencies: version: 7.9.8 - name: dbm repository: file://charts/dbm - version: 0.1.41 + version: 0.1.42 - name: dbconfig repository: file://charts/dbconfig version: 0.1.13 @@ -65,5 +65,5 @@ dependencies: - name: db-dbha repository: file://charts/db-dbha version: 0.1.0 -digest: sha256:505dce199e12c74e5852a426b8997b2c527c43c5cba321aebc58ef1040b43ff6 -generated: "2024-08-28T19:45:11.596886126+08:00" +digest: sha256:a0cc97116fc4c063d525b75adb4dab479456c1509f975700b887cc19517d1348 +generated: "2024-09-23T12:17:47.539237+08:00" diff --git a/helm-charts/bk-dbm/Chart.yaml b/helm-charts/bk-dbm/Chart.yaml index fa76ad51bb..8497a0bc70 100644 --- a/helm-charts/bk-dbm/Chart.yaml +++ b/helm-charts/bk-dbm/Chart.yaml @@ -27,7 +27,7 @@ dependencies: - condition: dbm.enabled name: dbm repository: file://charts/dbm - version: 0.1.41 + version: 0.1.42 - condition: dbconfig.enabled name: dbconfig repository: file://charts/dbconfig diff --git a/helm-charts/bk-dbm/charts/dbm/Chart.yaml b/helm-charts/bk-dbm/charts/dbm/Chart.yaml index e826d198c4..bbc9064456 100644 --- a/helm-charts/bk-dbm/charts/dbm/Chart.yaml +++ b/helm-charts/bk-dbm/charts/dbm/Chart.yaml @@ -3,4 +3,4 @@ appVersion: 1.5.0-alpha.535 description: A Helm chart for dbm name: dbm type: application -version: 0.1.41 +version: 0.1.42 diff --git a/helm-charts/bk-dbm/charts/dbm/templates/deployments/backend-api/backend-api.yaml b/helm-charts/bk-dbm/charts/dbm/templates/deployments/backend-api/backend-api.yaml index 0aeaddb7a8..d728bfbd0d 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/deployments/backend-api/backend-api.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/deployments/backend-api/backend-api.yaml @@ -1,4 +1,4 @@ -{{- if .Values.enabled -}} +{{- if .Values.saas.backendApi.enabled | default .Values.enabled -}} {{- $fullName := ( include "dbm.backend-api.fullname" .) -}} apiVersion: apps/v1 kind: Deployment @@ -7,8 +7,8 @@ metadata: labels: {{- include "dbm.labels" . | nindent 4 }} spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.saas.api.replicaCount }} + {{- if not .Values.saas.backendApi.autoscaling.enabled }} + replicas: {{ .Values.saas.backendApi.replicaCount }} {{- end }} selector: matchLabels: @@ -41,7 +41,7 @@ spec: - /bin/bash - -c args: - - export SERVICE_ONLY=true && gunicorn wsgi -w {{ .Values.saas.api.gunicornWorker }} -b :8000 --access-logfile - --error-logfile - --access-logformat '[%(h)s] %({request_id}i)s %(u)s %(t)s "%(r)s" %(s)s %(D)s %(b)s "%(f)s" "%(a)s"' + - export SERVICE_ONLY=true && gunicorn wsgi -w {{ .Values.saas.backendApi.gunicornWorker }} -b :8000 --access-logfile - --error-logfile - --access-logformat '[%(h)s] %({request_id}i)s %(u)s %(t)s "%(r)s" %(s)s %(D)s %(b)s "%(f)s" "%(a)s"' ports: - name: http containerPort: 8000 @@ -66,7 +66,7 @@ spec: failureThreshold: {{ .Values.readinessProbe.failureThreshold | default 3}} {{- include "dbm.container_env" . | nindent 10 }} resources: - {{- toYaml .Values.saas.api.resources | nindent 12 }} + {{- toYaml .Values.saas.backendApi.resources | nindent 12 }} {{- include "dbm.initContainersWaitForMigrate" . | nindent 6 }} {{- with .Values.nodeSelector }} nodeSelector: diff --git a/helm-charts/bk-dbm/charts/dbm/templates/deployments/backend-api/service.yaml b/helm-charts/bk-dbm/charts/dbm/templates/deployments/backend-api/service.yaml index 83e0289d33..30b27503d7 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/deployments/backend-api/service.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/deployments/backend-api/service.yaml @@ -1,4 +1,4 @@ -{{- if .Values.enabled -}} +{{- if .Values.saas.backendApi.enabled | default .Values.enabled -}} {{- $fullName := ( include "dbm.backend-api.fullname" .) -}} apiVersion: v1 kind: Service diff --git a/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery/celery-beater.yaml b/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery/celery-beater.yaml index b589dc3ec0..01f6f64efc 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery/celery-beater.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery/celery-beater.yaml @@ -7,9 +7,7 @@ metadata: labels: {{- include "dbm.labels" . | nindent 4 }} spec: - {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.saas.celeryBeat.replicaCount | default 1}} - {{- end }} selector: matchLabels: {{- include "dbm.selectorLabels" . | nindent 6 }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery/celery-worker.yaml b/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery/celery-worker.yaml index a56ec8f0dd..6e0976481c 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery/celery-worker.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery/celery-worker.yaml @@ -7,7 +7,7 @@ metadata: labels: {{- include "dbm.labels" . | nindent 4 }} spec: - {{- if not .Values.autoscaling.enabled }} + {{- if not .Values.saas.celeryWorker.autoscaling.enabled }} replicas: {{ .Values.saas.celeryWorker.replicaCount }} {{- end }} selector: diff --git a/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery/pipeline-worker.yaml b/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery/pipeline-worker.yaml index 9c0cbd759d..013179284a 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery/pipeline-worker.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery/pipeline-worker.yaml @@ -7,7 +7,7 @@ metadata: labels: {{- include "dbm.labels" . | nindent 4 }} spec: - {{- if not .Values.autoscaling.enabled }} + {{- if not .Values.saas.pipelineWorker.autoscaling.enabled }} replicas: {{ .Values.saas.pipelineWorker.replicaCount }} {{- end }} selector: diff --git a/helm-charts/bk-dbm/charts/dbm/templates/deployments/saas-api/saas-api.yaml b/helm-charts/bk-dbm/charts/dbm/templates/deployments/saas-api/saas-api.yaml index 771cea27f8..58420738b6 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/deployments/saas-api/saas-api.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/deployments/saas-api/saas-api.yaml @@ -1,4 +1,4 @@ -{{- if .Values.enabled -}} +{{- if .Values.saas.api.enabled | default .Values.enabled -}} {{- $fullName := ( include "dbm.saas-api.fullname" .) -}} apiVersion: apps/v1 kind: Deployment @@ -7,7 +7,7 @@ metadata: labels: {{- include "dbm.labels" . | nindent 4 }} spec: - {{- if not .Values.autoscaling.enabled }} + {{- if not .Values.saas.api.autoscaling.enabled }} replicas: {{ .Values.saas.api.replicaCount }} {{- end }} selector: diff --git a/helm-charts/bk-dbm/charts/dbm/templates/deployments/saas-api/service.yaml b/helm-charts/bk-dbm/charts/dbm/templates/deployments/saas-api/service.yaml index adbd4500fd..a8be479a04 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/deployments/saas-api/service.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/deployments/saas-api/service.yaml @@ -1,4 +1,4 @@ -{{- if .Values.enabled -}} +{{- if .Values.saas.api.enabled | default .Values.enabled -}} {{- $fullName := ( include "dbm.saas-api.fullname" .) -}} apiVersion: v1 kind: Service diff --git a/helm-charts/bk-dbm/charts/dbm/templates/hpa.yaml b/helm-charts/bk-dbm/charts/dbm/templates/hpa.yaml deleted file mode 100644 index 549fd6926e..0000000000 --- a/helm-charts/bk-dbm/charts/dbm/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "bk-dbm.fullname" . }} - labels: - {{- include "bk-dbm.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "bk-dbm.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/hpas/backend-api-hpa.yaml b/helm-charts/bk-dbm/charts/dbm/templates/hpas/backend-api-hpa.yaml new file mode 100644 index 0000000000..b1e7630754 --- /dev/null +++ b/helm-charts/bk-dbm/charts/dbm/templates/hpas/backend-api-hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.saas.backendApi.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "dbm.backend-api.fullname" . }} + labels: + {{- include "bk-dbm.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "dbm.backend-api.fullname" . }} + minReplicas: {{ .Values.saas.backendApi.autoscaling.minReplicas }} + maxReplicas: {{ .Values.saas.backendApi.autoscaling.maxReplicas }} + metrics: + {{- if .Values.saas.backendApi.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.saas.backendApi.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.saas.backendApi.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.saas.backendApi.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/hpas/celery-worker-hpa.yaml b/helm-charts/bk-dbm/charts/dbm/templates/hpas/celery-worker-hpa.yaml new file mode 100644 index 0000000000..dd2aecf14b --- /dev/null +++ b/helm-charts/bk-dbm/charts/dbm/templates/hpas/celery-worker-hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.saas.celeryWorker.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "dbm.celery-worker.fullname" . }} + labels: + {{- include "bk-dbm.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "dbm.celery-worker.fullname" . }} + minReplicas: {{ .Values.saas.celeryWorker.autoscaling.minReplicas }} + maxReplicas: {{ .Values.saas.celeryWorker.autoscaling.maxReplicas }} + metrics: + {{- if .Values.saas.celeryWorker.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.saas.celeryWorker.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.saas.celeryWorker.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.saas.celeryWorker.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/hpas/pipeline-worker-hpa.yaml b/helm-charts/bk-dbm/charts/dbm/templates/hpas/pipeline-worker-hpa.yaml new file mode 100644 index 0000000000..7fde8a8b06 --- /dev/null +++ b/helm-charts/bk-dbm/charts/dbm/templates/hpas/pipeline-worker-hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.saas.pipelineWorker.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "dbm.pipeline-worker.fullname" . }} + labels: + {{- include "bk-dbm.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "dbm.pipeline-worker.fullname" . }} + minReplicas: {{ .Values.saas.pipelineWorker.autoscaling.minReplicas }} + maxReplicas: {{ .Values.saas.pipelineWorker.autoscaling.maxReplicas }} + metrics: + {{- if .Values.saas.pipelineWorker.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.saas.pipelineWorker.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.saas.pipelineWorker.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.saas.pipelineWorker.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/hpas/saas-api-hpa.yaml b/helm-charts/bk-dbm/charts/dbm/templates/hpas/saas-api-hpa.yaml new file mode 100644 index 0000000000..489fcfe9cf --- /dev/null +++ b/helm-charts/bk-dbm/charts/dbm/templates/hpas/saas-api-hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.saas.api.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "bk-dbm.fullname" . }} + labels: + {{- include "bk-dbm.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "bk-dbm.fullname" . }} + minReplicas: {{ .Values.saas.api.autoscaling.minReplicas }} + maxReplicas: {{ .Values.saas.api.autoscaling.maxReplicas }} + metrics: + {{- if .Values.saas.api.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.saas.api.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.saas.api.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.saas.api.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/values.yaml b/helm-charts/bk-dbm/charts/dbm/values.yaml index 96d8e14bd6..5a656fe265 100644 --- a/helm-charts/bk-dbm/charts/dbm/values.yaml +++ b/helm-charts/bk-dbm/charts/dbm/values.yaml @@ -28,15 +28,44 @@ saas: resources: {} replicaCount: 1 gunicornWorker: 8 - celeryBeat: + autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + targetMemoryUtilizationPercentage: 80 + backendApi: enabled: true resources: {} replicaCount: 1 + gunicornWorker: 8 + autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + targetMemoryUtilizationPercentage: 80 celeryWorker: enabled: true resources: {} replicaCount: 1 + autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + targetMemoryUtilizationPercentage: 80 pipelineWorker: enabled: true resources: {} replicaCount: 1 + autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + targetMemoryUtilizationPercentage: 80 + celeryBeat: + enabled: true + resources: {} + replicaCount: 1 diff --git a/helm-charts/bk-dbm/values.yaml b/helm-charts/bk-dbm/values.yaml index 4a8837fef5..19063d3858 100644 --- a/helm-charts/bk-dbm/values.yaml +++ b/helm-charts/bk-dbm/values.yaml @@ -157,8 +157,22 @@ dbm: pathType: ImplementationSpecific tls: [] - autoscaling: - enabled: false + saas: + api: + enabled: true + replicaCount: 1 + backendApi: + enabled: true + replicaCount: 1 + celeryBeat: + enabled: true + replicaCount: 1 + celeryWorker: + enabled: true + replicaCount: 1 + pipelineWorker: + enabled: true + replicaCount: 1 migration: images: