From 0a030b328032488b4cbe576dcfbd79ca5f5fe2d8 Mon Sep 17 00:00:00 2001 From: durant <826035498@qq.com> Date: Mon, 23 Oct 2023 21:55:17 +0800 Subject: [PATCH] =?UTF-8?q?chore(helm-charts):=20=E4=BC=98=E5=8C=96=20helm?= =?UTF-8?q?-charts=20#1359?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../slow-query-parser-service/Dockerfile | 4 +- helm-charts/bk-dbm/Chart.lock | 36 ++++---- helm-charts/bk-dbm/Chart.yaml | 35 +++++--- .../bk-dbm/charts/backup-consumer/Chart.yaml | 2 +- .../backup-consumer/templates/deployment.yaml | 4 +- .../bk-dbm/charts/backup-server/Chart.yaml | 2 +- .../backup-server/templates/deployment.yaml | 4 +- .../charts/db-celery-service/Chart.yaml | 2 +- .../templates/deployment.yaml | 4 +- .../bk-dbm/charts/db-dns-api/Chart.yaml | 2 +- .../db-dns-api/templates/deployment.yaml | 2 + .../bk-dbm/charts/db-resource/Chart.yaml | 2 +- .../db-resource/templates/deployment.yaml | 4 +- .../bk-dbm/charts/db-simulation/Chart.yaml | 2 +- .../db-simulation/templates/deployment.yaml | 4 +- helm-charts/bk-dbm/charts/dbconfig/Chart.yaml | 2 +- .../charts/dbconfig/templates/deployment.yaml | 4 +- helm-charts/bk-dbm/charts/dbm/Chart.yaml | 2 +- .../bk-dbm/charts/dbm/templates/_helpers.tpl | 30 +++++++ .../charts/dbm/templates/apigw-init-job.yaml | 20 +---- .../charts/dbm/templates/bkcc-init-job.yaml | 20 +---- .../charts/dbm/templates/bkjob-init-job.yaml | 20 +---- .../charts/dbm/templates/bklog-init-job.yaml | 20 +---- .../dbm/templates/bkmonitor-init-job.yaml | 20 +---- .../templates/deployments/celery-beater.yaml | 22 +---- .../templates/deployments/celery-worker.yaml | 22 +---- .../deployments/pipeline-worker.yaml | 22 +---- .../dbm/templates/deployments/saas-api.yaml | 32 ++++--- .../charts/dbm/templates/itsm-init-job.yaml | 20 +---- .../charts/dbm/templates/medium-init-job.yaml | 12 +-- .../charts/dbm/templates/migrate-job.yaml | 2 +- .../charts/dbm/templates/ssl-init-job.yaml | 20 +---- helm-charts/bk-dbm/charts/dbm/values.yaml | 46 +++++++++- .../bk-dbm/charts/dbpartition/Chart.yaml | 2 +- .../dbpartition/templates/deployment.yaml | 4 +- helm-charts/bk-dbm/charts/dbpriv/Chart.yaml | 20 +---- .../charts/dbpriv/templates/deployment.yaml | 4 +- helm-charts/bk-dbm/charts/hadb-api/Chart.yaml | 20 +---- .../charts/hadb-api/templates/deployment.yaml | 4 +- .../slow-query-parser-service/Chart.yaml | 6 ++ .../templates/NOTES.txt | 22 +++++ .../templates/_helpers.tpl | 62 ++++++++++++++ .../templates/deployment.yaml | 53 ++++++++++++ .../templates/hpa.yaml | 28 +++++++ .../templates/ingress.yaml | 61 ++++++++++++++ .../templates/service.yaml | 15 ++++ .../templates/serviceaccount.yaml | 12 +++ .../templates/tests/test-connection.yaml | 15 ++++ .../slow-query-parser-service/values.yaml | 84 +++++++++++++++++++ helm-charts/bk-dbm/values.yaml | 40 ++++----- 50 files changed, 566 insertions(+), 331 deletions(-) create mode 100644 helm-charts/bk-dbm/charts/slow-query-parser-service/Chart.yaml create mode 100644 helm-charts/bk-dbm/charts/slow-query-parser-service/templates/NOTES.txt create mode 100644 helm-charts/bk-dbm/charts/slow-query-parser-service/templates/_helpers.tpl create mode 100644 helm-charts/bk-dbm/charts/slow-query-parser-service/templates/deployment.yaml create mode 100644 helm-charts/bk-dbm/charts/slow-query-parser-service/templates/hpa.yaml create mode 100644 helm-charts/bk-dbm/charts/slow-query-parser-service/templates/ingress.yaml create mode 100644 helm-charts/bk-dbm/charts/slow-query-parser-service/templates/service.yaml create mode 100644 helm-charts/bk-dbm/charts/slow-query-parser-service/templates/serviceaccount.yaml create mode 100644 helm-charts/bk-dbm/charts/slow-query-parser-service/templates/tests/test-connection.yaml create mode 100644 helm-charts/bk-dbm/charts/slow-query-parser-service/values.yaml diff --git a/dbm-services/mysql/slow-query-parser-service/Dockerfile b/dbm-services/mysql/slow-query-parser-service/Dockerfile index d83313873f..a8c7b2a9d1 100644 --- a/dbm-services/mysql/slow-query-parser-service/Dockerfile +++ b/dbm-services/mysql/slow-query-parser-service/Dockerfile @@ -1,6 +1,6 @@ -FROM mirrors.tencent.com/sccmsp/tmysqlparse:3.0.7 +FROM mirrors.tencent.com/sccmsp/tmysqlparse:latest ADD build/slow-query-parser-service / WORKDIR / -ENTRYPOINT ["/slow-query-parser-service", "run"] \ No newline at end of file +ENTRYPOINT ["/slow-query-parser-service", "run", "--address=0.0.0.0:80", "--tmysqlparse-bin=/tmysqlparse"] diff --git a/helm-charts/bk-dbm/Chart.lock b/helm-charts/bk-dbm/Chart.lock index f00ca04bb0..a8574e1b0d 100644 --- a/helm-charts/bk-dbm/Chart.lock +++ b/helm-charts/bk-dbm/Chart.lock @@ -4,51 +4,57 @@ dependencies: version: 1.13.0 - name: mysql repository: https://charts.bitnami.com/bitnami - version: 9.12.4 + version: 9.12.5 - name: redis repository: https://charts.bitnami.com/bitnami version: 16.13.2 - name: etcd repository: https://charts.bitnami.com/bitnami - version: 9.5.5 + version: 9.5.6 +- name: reloader + repository: https://stakater.github.io/stakater-charts + version: 1.0.46 - name: grafana repository: file://./charts/grafana version: 7.9.8 - name: dbm repository: file://charts/dbm - version: 0.1.20 + version: 0.1.21 - name: dbconfig repository: file://charts/dbconfig - version: 0.1.6 + version: 0.1.7 - name: dbpriv repository: file://charts/dbpriv - version: 0.1.28 + version: 0.1.29 - name: dbpartition repository: file://charts/dbpartition - version: 0.1.4 + version: 0.1.5 - name: db-simulation repository: file://charts/db-simulation - version: 0.1.7 + version: 0.1.8 - name: db-remote-service repository: file://charts/db-remote-service version: 0.9.5 - name: db-dns-api repository: file://charts/db-dns-api - version: 0.1.3 + version: 0.1.4 - name: hadb-api repository: file://charts/hadb-api - version: 0.0.10 + version: 0.0.11 - name: db-resource repository: file://charts/db-resource - version: 0.0.7 + version: 0.0.8 - name: db-celery-service repository: file://charts/db-celery-service - version: 0.0.4 + version: 0.0.5 +- name: slow-query-parser-service + repository: file://charts/slow-query-parser-service + version: 0.0.1 - name: backup-server repository: file://charts/backup-server - version: 0.0.2 + version: 0.0.3 - name: backup-consumer repository: file://charts/backup-consumer - version: 0.0.2 -digest: sha256:bca62d6538530facd8b271d761816f51bf547f767d6757f238b00c9e6469565e -generated: "2023-10-12T10:20:26.956839+08:00" + version: 0.0.3 +digest: sha256:2441eb65d88a908703d8d83b392ad5472d9469ef532aecc8e0b12c112e80b114 +generated: "2023-10-23T21:16:42.422636+08:00" diff --git a/helm-charts/bk-dbm/Chart.yaml b/helm-charts/bk-dbm/Chart.yaml index a030818261..0c9b280dd1 100644 --- a/helm-charts/bk-dbm/Chart.yaml +++ b/helm-charts/bk-dbm/Chart.yaml @@ -15,6 +15,11 @@ dependencies: name: etcd version: 9.x.x repository: https://charts.bitnami.com/bitnami + - name: reloader + repository: https://stakater.github.io/stakater-charts + version: 1.0.x + condition: stakater.enabled + alias: stakater - name: grafana repository: file://./charts/grafana version: 7.x.x @@ -22,23 +27,23 @@ dependencies: - condition: dbm.enabled name: dbm repository: file://charts/dbm - version: 0.1.20 + version: 0.1.21 - condition: dbconfig.enabled name: dbconfig repository: file://charts/dbconfig - version: 0.1.6 + version: 0.1.7 - condition: dbpriv.enabled name: dbpriv repository: file://charts/dbpriv - version: 0.1.28 + version: 0.1.29 - condition: dbpartition.enabled name: dbpartition repository: file://charts/dbpartition - version: 0.1.4 + version: 0.1.5 - condition: db-simulation.enabled name: db-simulation repository: file://charts/db-simulation - version: 0.1.7 + version: 0.1.8 - condition: dbRemoteService.enabled name: db-remote-service repository: file://charts/db-remote-service @@ -46,29 +51,33 @@ dependencies: - condition: db-dns-api.enabled name: db-dns-api repository: file://charts/db-dns-api - version: 0.1.3 + version: 0.1.4 - condition: hadb-api.enabled name: hadb-api repository: file://charts/hadb-api - version: 0.0.10 + version: 0.0.11 - condition: db-resource.enabled name: db-resource repository: file://charts/db-resource - version: 0.0.7 + version: 0.0.8 - condition: db-celery-service.enabled name: db-celery-service repository: file://charts/db-celery-service - version: 0.0.4 + version: 0.0.5 + - condition: slow-query-parser-service.enabled + name: slow-query-parser-service + repository: file://charts/slow-query-parser-service + version: 0.0.1 - condition: backup-server.enabled name: backup-server repository: file://charts/backup-server - version: 0.0.2 + version: 0.0.3 - condition: backup-consumer.enabled name: backup-consumer repository: file://charts/backup-consumer - version: 0.0.2 + version: 0.0.3 description: A Helm chart for bkdbm name: bk-dbm type: application -version: 1.2.0-alpha.58 -appVersion: 1.2.0-alpha.58 +version: 1.2.0-alpha.60 +appVersion: 1.2.0-alpha.60 diff --git a/helm-charts/bk-dbm/charts/backup-consumer/Chart.yaml b/helm-charts/bk-dbm/charts/backup-consumer/Chart.yaml index 47d059028f..a7a8638b68 100644 --- a/helm-charts/bk-dbm/charts/backup-consumer/Chart.yaml +++ b/helm-charts/bk-dbm/charts/backup-consumer/Chart.yaml @@ -3,4 +3,4 @@ appVersion: 0.0.1-alpha.4 description: A Helm chart for backup-consumer name: backup-consumer type: application -version: 0.0.2 +version: 0.0.3 diff --git a/helm-charts/bk-dbm/charts/backup-consumer/templates/deployment.yaml b/helm-charts/bk-dbm/charts/backup-consumer/templates/deployment.yaml index 62b56aa5e1..6add1e4e59 100644 --- a/helm-charts/bk-dbm/charts/backup-consumer/templates/deployment.yaml +++ b/helm-charts/bk-dbm/charts/backup-consumer/templates/deployment.yaml @@ -13,10 +13,8 @@ spec: {{- include "backup-consumer.selectorLabels" . | nindent 6 }} template: metadata: - {{- with .Values.podAnnotations }} annotations: - {{- toYaml . | nindent 8 }} - {{- end }} + reloader.stakater.com/auto: "true" labels: {{- include "backup-consumer.selectorLabels" . | nindent 8 }} spec: diff --git a/helm-charts/bk-dbm/charts/backup-server/Chart.yaml b/helm-charts/bk-dbm/charts/backup-server/Chart.yaml index 9e9c532da6..b9766f4aec 100644 --- a/helm-charts/bk-dbm/charts/backup-server/Chart.yaml +++ b/helm-charts/bk-dbm/charts/backup-server/Chart.yaml @@ -3,4 +3,4 @@ appVersion: 0.0.1-alpha.6 description: A Helm chart for backup-server name: backup-server type: application -version: 0.0.2 +version: 0.0.3 diff --git a/helm-charts/bk-dbm/charts/backup-server/templates/deployment.yaml b/helm-charts/bk-dbm/charts/backup-server/templates/deployment.yaml index 7b30891928..9918a12da5 100644 --- a/helm-charts/bk-dbm/charts/backup-server/templates/deployment.yaml +++ b/helm-charts/bk-dbm/charts/backup-server/templates/deployment.yaml @@ -13,10 +13,8 @@ spec: {{- include "backup-server.selectorLabels" . | nindent 6 }} template: metadata: - {{- with .Values.podAnnotations }} annotations: - {{- toYaml . | nindent 8 }} - {{- end }} + reloader.stakater.com/auto: "true" labels: {{- include "backup-server.selectorLabels" . | nindent 8 }} spec: diff --git a/helm-charts/bk-dbm/charts/db-celery-service/Chart.yaml b/helm-charts/bk-dbm/charts/db-celery-service/Chart.yaml index f503f87b11..f48977664f 100644 --- a/helm-charts/bk-dbm/charts/db-celery-service/Chart.yaml +++ b/helm-charts/bk-dbm/charts/db-celery-service/Chart.yaml @@ -3,4 +3,4 @@ appVersion: 0.0.1-alpha.8 description: A Helm chart for Kubernetes name: db-celery-service type: application -version: 0.0.4 +version: 0.0.5 diff --git a/helm-charts/bk-dbm/charts/db-celery-service/templates/deployment.yaml b/helm-charts/bk-dbm/charts/db-celery-service/templates/deployment.yaml index 34619e5df0..8bd49fb586 100644 --- a/helm-charts/bk-dbm/charts/db-celery-service/templates/deployment.yaml +++ b/helm-charts/bk-dbm/charts/db-celery-service/templates/deployment.yaml @@ -13,10 +13,8 @@ spec: {{- include "db-celery-service.selectorLabels" . | nindent 6 }} template: metadata: - {{- with .Values.podAnnotations }} annotations: - {{- toYaml . | nindent 8 }} - {{- end }} + reloader.stakater.com/auto: "true" labels: {{- include "db-celery-service.selectorLabels" . | nindent 8 }} spec: diff --git a/helm-charts/bk-dbm/charts/db-dns-api/Chart.yaml b/helm-charts/bk-dbm/charts/db-dns-api/Chart.yaml index 493dbf2f5e..96f482e6cb 100644 --- a/helm-charts/bk-dbm/charts/db-dns-api/Chart.yaml +++ b/helm-charts/bk-dbm/charts/db-dns-api/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v1 appVersion: 0.0.1-alpha.2 description: A Helm chart for Kubernetes name: db-dns-api -version: 0.1.3 +version: 0.1.4 diff --git a/helm-charts/bk-dbm/charts/db-dns-api/templates/deployment.yaml b/helm-charts/bk-dbm/charts/db-dns-api/templates/deployment.yaml index e95dd2d3cf..d45e0fb0a3 100644 --- a/helm-charts/bk-dbm/charts/db-dns-api/templates/deployment.yaml +++ b/helm-charts/bk-dbm/charts/db-dns-api/templates/deployment.yaml @@ -12,6 +12,8 @@ spec: app.kubernetes.io/instance: {{ .Release.Name }} template: metadata: + annotations: + reloader.stakater.com/auto: "true" labels: app.kubernetes.io/name: {{ include "db-dns-api.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/helm-charts/bk-dbm/charts/db-resource/Chart.yaml b/helm-charts/bk-dbm/charts/db-resource/Chart.yaml index 4fbed7f5ae..59e088d124 100644 --- a/helm-charts/bk-dbm/charts/db-resource/Chart.yaml +++ b/helm-charts/bk-dbm/charts/db-resource/Chart.yaml @@ -3,4 +3,4 @@ appVersion: 0.0.1-alpha.47 description: A Helm chart for Kubernetes name: db-resource type: application -version: 0.0.7 +version: 0.0.8 diff --git a/helm-charts/bk-dbm/charts/db-resource/templates/deployment.yaml b/helm-charts/bk-dbm/charts/db-resource/templates/deployment.yaml index 1bc0b4a588..b56fb4398f 100644 --- a/helm-charts/bk-dbm/charts/db-resource/templates/deployment.yaml +++ b/helm-charts/bk-dbm/charts/db-resource/templates/deployment.yaml @@ -13,10 +13,8 @@ spec: {{- include "db-resource.selectorLabels" . | nindent 6 }} template: metadata: - {{- with .Values.podAnnotations }} annotations: - {{- toYaml . | nindent 8 }} - {{- end }} + reloader.stakater.com/auto: "true" labels: {{- include "db-resource.selectorLabels" . | nindent 8 }} spec: diff --git a/helm-charts/bk-dbm/charts/db-simulation/Chart.yaml b/helm-charts/bk-dbm/charts/db-simulation/Chart.yaml index 2261b656d2..0fa76f5f20 100644 --- a/helm-charts/bk-dbm/charts/db-simulation/Chart.yaml +++ b/helm-charts/bk-dbm/charts/db-simulation/Chart.yaml @@ -3,4 +3,4 @@ appVersion: 0.0.1-alpha.39 description: A Helm chart for Kubernetes name: db-simulation type: application -version: 0.1.7 +version: 0.1.8 diff --git a/helm-charts/bk-dbm/charts/db-simulation/templates/deployment.yaml b/helm-charts/bk-dbm/charts/db-simulation/templates/deployment.yaml index 35c54330d7..ab2768b9a4 100644 --- a/helm-charts/bk-dbm/charts/db-simulation/templates/deployment.yaml +++ b/helm-charts/bk-dbm/charts/db-simulation/templates/deployment.yaml @@ -13,10 +13,8 @@ spec: {{- include "db-simulation.selectorLabels" . | nindent 6 }} template: metadata: - {{- with .Values.podAnnotations }} annotations: - {{- toYaml . | nindent 8 }} - {{- end }} + reloader.stakater.com/auto: "true" labels: {{- include "db-simulation.selectorLabels" . | nindent 8 }} spec: diff --git a/helm-charts/bk-dbm/charts/dbconfig/Chart.yaml b/helm-charts/bk-dbm/charts/dbconfig/Chart.yaml index 12ca8bcc10..309eaa1927 100644 --- a/helm-charts/bk-dbm/charts/dbconfig/Chart.yaml +++ b/helm-charts/bk-dbm/charts/dbconfig/Chart.yaml @@ -3,4 +3,4 @@ appVersion: 0.0.1-alpha.50 description: A Helm chart for dbconfig name: dbconfig type: application -version: 0.1.6 +version: 0.1.7 diff --git a/helm-charts/bk-dbm/charts/dbconfig/templates/deployment.yaml b/helm-charts/bk-dbm/charts/dbconfig/templates/deployment.yaml index 25db00cdb2..286c1cb678 100644 --- a/helm-charts/bk-dbm/charts/dbconfig/templates/deployment.yaml +++ b/helm-charts/bk-dbm/charts/dbconfig/templates/deployment.yaml @@ -13,10 +13,8 @@ spec: {{- include "dbconfig.selectorLabels" . | nindent 6 }} template: metadata: - {{- with .Values.podAnnotations }} annotations: - {{- toYaml . | nindent 8 }} - {{- end }} + reloader.stakater.com/auto: "true" labels: {{- include "dbconfig.selectorLabels" . | nindent 8 }} spec: diff --git a/helm-charts/bk-dbm/charts/dbm/Chart.yaml b/helm-charts/bk-dbm/charts/dbm/Chart.yaml index f0fcd19607..bade7a4b03 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.2.0-alpha.405 description: A Helm chart for dbm name: dbm type: application -version: 0.1.20 +version: 0.1.21 diff --git a/helm-charts/bk-dbm/charts/dbm/templates/_helpers.tpl b/helm-charts/bk-dbm/charts/dbm/templates/_helpers.tpl index 94f828b808..16e481d013 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/_helpers.tpl +++ b/helm-charts/bk-dbm/charts/dbm/templates/_helpers.tpl @@ -145,3 +145,33 @@ environment variables {{- define "dbm.celery-worker.fullname" -}} {{- printf "%s-%s" (include "dbm.fullname" .) "celery-worker" -}} {{- end -}} + +{{- define "dbm.initContainersWaitForSaaS" -}} +initContainers: + - name: check-saas-api + image: {{ include "dbm.migration.k8sWaitFor.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - pod + - -lapp.kubernetes.io/component={{ include "dbm.saas-api.fullname" .}} +{{- end }} + +{{- define "dbm.initContainersWaitForMigrate" -}} +initContainers: + - name: check-migrate-job + image: {{ include "dbm.migration.k8sWaitFor.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - job + - {{ include "dbm.migrateJobName" . }} +{{- end }} + +{{- define "dbm.container_env" -}} +env: + {{- include "dbm.envs" . | trim | nindent 2 }} +envFrom: + {{- if .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ .Values.extraEnvVarsCM }} + {{- end }} +{{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/apigw-init-job.yaml b/helm-charts/bk-dbm/charts/dbm/templates/apigw-init-job.yaml index 8f8f9c6190..d6b41c322d 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/apigw-init-job.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/apigw-init-job.yaml @@ -27,22 +27,8 @@ spec: - -c args: - "python manage.py sync_saas_apigw" - env: - {{- include "dbm.envs" . | trim | nindent 12 }} - envFrom: - {{- if .Values.extraEnvVarsCM }} - - configMapRef: - name: {{ .Values.extraEnvVarsCM }} - {{- end }} + {{- include "dbm.container_env" . | nindent 10 }} resources: - {{- toYaml .Values.resources | nindent 12 }} - initContainers: - - name: check-saas-api - image: {{ include "dbm.migration.k8sWaitFor.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - args: - - pod - - -lapp.kubernetes.io/component={{ include "dbm.saas-api.fullname" .}} - resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.initJob.resources | nindent 12 }} + {{- include "dbm.initContainersWaitForMigrate" . | nindent 6 }} {{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/bkcc-init-job.yaml b/helm-charts/bk-dbm/charts/dbm/templates/bkcc-init-job.yaml index 8f33a73af4..1d4fdfae71 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/bkcc-init-job.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/bkcc-init-job.yaml @@ -27,22 +27,8 @@ spec: - -c args: - "python manage.py services_init bkcc" - env: - {{- include "dbm.envs" . | trim | nindent 12 }} - envFrom: - {{- if .Values.extraEnvVarsCM }} - - configMapRef: - name: {{ .Values.extraEnvVarsCM }} - {{- end }} + {{- include "dbm.container_env" . | nindent 10 }} resources: - {{- toYaml .Values.resources | nindent 12 }} - initContainers: - - name: check-saas-api - image: {{ include "dbm.migration.k8sWaitFor.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - args: - - pod - - -lapp.kubernetes.io/component={{ include "dbm.saas-api.fullname" .}} - resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.initJob.resources | nindent 12 }} + {{- include "dbm.initContainersWaitForMigrate" . | nindent 6 }} {{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/bkjob-init-job.yaml b/helm-charts/bk-dbm/charts/dbm/templates/bkjob-init-job.yaml index 46b1c31acc..2ac7f914ac 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/bkjob-init-job.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/bkjob-init-job.yaml @@ -27,22 +27,8 @@ spec: - -c args: - "python manage.py services_init bkjob" - env: - {{- include "dbm.envs" . | trim | nindent 12 }} - envFrom: - {{- if .Values.extraEnvVarsCM }} - - configMapRef: - name: {{ .Values.extraEnvVarsCM }} - {{- end }} + {{- include "dbm.container_env" . | nindent 10 }} resources: - {{- toYaml .Values.resources | nindent 12 }} - initContainers: - - name: check-saas-api - image: {{ include "dbm.migration.k8sWaitFor.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - args: - - pod - - -lapp.kubernetes.io/component={{ include "dbm.saas-api.fullname" .}} - resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.initJob.resources | nindent 12 }} + {{- include "dbm.initContainersWaitForMigrate" . | nindent 6 }} {{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/bklog-init-job.yaml b/helm-charts/bk-dbm/charts/dbm/templates/bklog-init-job.yaml index cff4ffdd59..d2cc3dc0c5 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/bklog-init-job.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/bklog-init-job.yaml @@ -27,22 +27,8 @@ spec: - -c args: - "python manage.py services_init bklog" - env: - {{- include "dbm.envs" . | trim | nindent 12 }} - envFrom: - {{- if .Values.extraEnvVarsCM }} - - configMapRef: - name: {{ .Values.extraEnvVarsCM }} - {{- end }} + {{- include "dbm.container_env" . | nindent 10 }} resources: - {{- toYaml .Values.resources | nindent 12 }} - initContainers: - - name: check-saas-api - image: {{ include "dbm.migration.k8sWaitFor.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - args: - - pod - - -lapp.kubernetes.io/component={{ include "dbm.saas-api.fullname" .}} - resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.initJob.resources | nindent 12 }} + {{- include "dbm.initContainersWaitForMigrate" . | nindent 6 }} {{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/bkmonitor-init-job.yaml b/helm-charts/bk-dbm/charts/dbm/templates/bkmonitor-init-job.yaml index 532e9ad912..baac9d53a4 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/bkmonitor-init-job.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/bkmonitor-init-job.yaml @@ -27,22 +27,8 @@ spec: - -c args: - "python manage.py services_init bkmonitor_alarm && python manage.py services_init bkmonitor_channel" - env: - {{- include "dbm.envs" . | trim | nindent 12 }} - envFrom: - {{- if .Values.extraEnvVarsCM }} - - configMapRef: - name: {{ .Values.extraEnvVarsCM }} - {{- end }} + {{- include "dbm.container_env" . | nindent 10 }} resources: - {{- toYaml .Values.resources | nindent 12 }} - initContainers: - - name: check-saas-api - image: {{ include "dbm.migration.k8sWaitFor.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - args: - - pod - - -lapp.kubernetes.io/component={{ include "dbm.saas-api.fullname" .}} - resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.initJob.resources | nindent 12 }} + {{- include "dbm.initContainersWaitForMigrate" . | nindent 6 }} {{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery-beater.yaml b/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery-beater.yaml index 94e78323f5..89c91ca5eb 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery-beater.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery-beater.yaml @@ -8,7 +8,7 @@ metadata: {{- include "dbm.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} + replicas: 1 {{- end }} selector: matchLabels: @@ -42,24 +42,10 @@ spec: - -c args: - celery beat -A {{ .Values.envs.djangoSettingsModule }} -l info - env: - {{- include "dbm.envs" . | trim | nindent 12 }} - envFrom: - {{- if .Values.extraEnvVarsCM }} - - configMapRef: - name: {{ .Values.extraEnvVarsCM }} - {{- end }} + {{- include "dbm.container_env" . | nindent 10 }} resources: - {{- toYaml .Values.resources | nindent 12 }} - initContainers: - - name: check-migrate-job - image: {{ include "dbm.migration.k8sWaitFor.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - args: - - job - - {{ include "dbm.migrateJobName" . }} - resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.saas.celeryBeat.resources | nindent 12 }} + {{- include "dbm.initContainersWaitForMigrate" . | nindent 6 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery-worker.yaml b/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery-worker.yaml index 0046068819..ce76608613 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery-worker.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/deployments/celery-worker.yaml @@ -8,7 +8,7 @@ metadata: {{- include "dbm.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} + replicas: {{ .Values.saas.celeryWorker.replicaCount }} {{- end }} selector: matchLabels: @@ -42,24 +42,10 @@ spec: - -c args: - celery worker -A {{ .Values.envs.djangoSettingsModule }} --autoscale 6,2 -l info - env: - {{- include "dbm.envs" . | trim | nindent 12 }} - envFrom: - {{- if .Values.extraEnvVarsCM }} - - configMapRef: - name: {{ .Values.extraEnvVarsCM }} - {{- end }} + {{- include "dbm.container_env" . | nindent 10 }} resources: - {{- toYaml .Values.resources | nindent 12 }} - initContainers: - - name: check-migrate-job - image: {{ include "dbm.migration.k8sWaitFor.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - args: - - job - - {{ include "dbm.migrateJobName" . }} - resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.saas.celeryWorker.resources | nindent 12 }} + {{- include "dbm.initContainersWaitForMigrate" . | nindent 6 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/deployments/pipeline-worker.yaml b/helm-charts/bk-dbm/charts/dbm/templates/deployments/pipeline-worker.yaml index 8527c231b0..4ba3c6a13a 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/deployments/pipeline-worker.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/deployments/pipeline-worker.yaml @@ -8,7 +8,7 @@ metadata: {{- include "dbm.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} + replicas: {{ .Values.saas.pipelineWorker.replicaCount }} {{- end }} selector: matchLabels: @@ -42,24 +42,10 @@ spec: - -c args: - celery worker -A {{ .Values.envs.djangoSettingsModule }} -Q er_execute,er_schedule --autoscale 8,2 -l info - env: - {{- include "dbm.envs" . | trim | nindent 12 }} - envFrom: - {{- if .Values.extraEnvVarsCM }} - - configMapRef: - name: {{ .Values.extraEnvVarsCM }} - {{- end }} + {{- include "dbm.container_env" . | nindent 10 }} resources: - {{- toYaml .Values.resources | nindent 12 }} - initContainers: - - name: check-migrate-job - image: {{ include "dbm.migration.k8sWaitFor.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - args: - - job - - {{ include "dbm.migrateJobName" . }} - resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.saas.pipelineWorker.resources | nindent 12 }} + {{- include "dbm.initContainersWaitForMigrate" . | nindent 6 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/deployments/saas-api.yaml b/helm-charts/bk-dbm/charts/dbm/templates/deployments/saas-api.yaml index 455aaf6c14..7a6d48a4cd 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/deployments/saas-api.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/deployments/saas-api.yaml @@ -8,7 +8,7 @@ metadata: {{- include "dbm.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} + replicas: {{ .Values.saas.api.replicaCount }} {{- end }} selector: matchLabels: @@ -46,24 +46,22 @@ spec: - name: http containerPort: 8000 protocol: TCP - env: - {{- include "dbm.envs" . | trim | nindent 12 }} - envFrom: - {{- if .Values.extraEnvVarsCM }} - - configMapRef: - name: {{ .Values.extraEnvVarsCM }} - {{- end }} - resources: - {{- toYaml .Values.resources | nindent 12 }} - initContainers: - - name: check-migrate-job - image: {{ include "dbm.migration.k8sWaitFor.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - args: - - job - - {{ include "dbm.migrateJobName" . }} + + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: {{ .Values.livenessProbe.path }} + port: http + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- include "dbm.container_env" . | nindent 10 }} resources: {{- toYaml .Values.resources | nindent 12 }} + {{- include "dbm.initContainersWaitForMigrate" . | nindent 6 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/itsm-init-job.yaml b/helm-charts/bk-dbm/charts/dbm/templates/itsm-init-job.yaml index 5b174a21a6..8f778718e0 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/itsm-init-job.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/itsm-init-job.yaml @@ -27,22 +27,8 @@ spec: - -c args: - "python manage.py services_init itsm" - env: - {{- include "dbm.envs" . | trim | nindent 12 }} - envFrom: - {{- if .Values.extraEnvVarsCM }} - - configMapRef: - name: {{ .Values.extraEnvVarsCM }} - {{- end }} + {{- include "dbm.container_env" . | nindent 10 }} resources: - {{- toYaml .Values.resources | nindent 12 }} - initContainers: - - name: check-saas-api - image: {{ include "dbm.migration.k8sWaitFor.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - args: - - pod - - -lapp.kubernetes.io/component={{ include "dbm.saas-api.fullname" .}} - resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.initJob.resources | nindent 12 }} + {{- include "dbm.initContainersWaitForMigrate" . | nindent 6 }} {{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/medium-init-job.yaml b/helm-charts/bk-dbm/charts/dbm/templates/medium-init-job.yaml index 74308438f5..ee7e30f3f0 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/medium-init-job.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/medium-init-job.yaml @@ -37,14 +37,6 @@ spec: name: {{ .Values.dbmedium.extraEnvVarsCM }} {{- end }} resources: - {{- toYaml .Values.resources | nindent 12 }} - initContainers: - - name: check-saas-api - image: {{ include "dbm.migration.k8sWaitFor.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - args: - - pod - - -lapp.kubernetes.io/component={{ include "dbm.saas-api.fullname" .}} - resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.initJob.resources | nindent 12 }} + {{- include "dbm.initContainersWaitForSaaS" . | nindent 6 }} {{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/migrate-job.yaml b/helm-charts/bk-dbm/charts/dbm/templates/migrate-job.yaml index 574948ad4c..581d0587aa 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/migrate-job.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/migrate-job.yaml @@ -34,5 +34,5 @@ spec: name: {{ .Values.extraEnvVarsCM }} {{- end }} resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.initJob.resources | nindent 12 }} {{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/templates/ssl-init-job.yaml b/helm-charts/bk-dbm/charts/dbm/templates/ssl-init-job.yaml index d5ff57ad0a..ade47599ca 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/ssl-init-job.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/ssl-init-job.yaml @@ -27,22 +27,8 @@ spec: - -c args: - "python manage.py services_init ssl" - env: - {{- include "dbm.envs" . | trim | nindent 12 }} - envFrom: - {{- if .Values.extraEnvVarsCM }} - - configMapRef: - name: {{ .Values.extraEnvVarsCM }} - {{- end }} + {{- include "dbm.container_env" . | nindent 10 }} resources: - {{- toYaml .Values.resources | nindent 12 }} - initContainers: - - name: check-saas-api - image: {{ include "dbm.migration.k8sWaitFor.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - args: - - pod - - -lapp.kubernetes.io/component={{ include "dbm.saas-api.fullname" .}} - resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.initJob.resources | nindent 12 }} + {{- include "dbm.initContainersWaitForMigrate" . | nindent 6 }} {{- end }} diff --git a/helm-charts/bk-dbm/charts/dbm/values.yaml b/helm-charts/bk-dbm/charts/dbm/values.yaml index f4085f81b8..5e7d999623 100644 --- a/helm-charts/bk-dbm/charts/dbm/values.yaml +++ b/helm-charts/bk-dbm/charts/dbm/values.yaml @@ -1 +1,45 @@ -# use parent values \ No newline at end of file +# use parent values + +nameOverride: "" +fullnameOverride: "" + +podAnnotations: {} + +podSecurityContext: {} + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +securityContext: {} + +livenessProbe: + enabled: true + path: /ping + initialDelaySeconds: 5 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + +replicaCount: 1 +resources: {} + +initJob: + resources: {} + +saas: + api: + resources: {} + replicaCount: 1 + celeryBeat: + resources: {} + replicaCount: 1 + celeryWorker: + resources: {} + replicaCount: 1 + pipelineWorker: + resources: {} + replicaCount: 1 diff --git a/helm-charts/bk-dbm/charts/dbpartition/Chart.yaml b/helm-charts/bk-dbm/charts/dbpartition/Chart.yaml index 050b0f6d58..0f0c296070 100644 --- a/helm-charts/bk-dbm/charts/dbpartition/Chart.yaml +++ b/helm-charts/bk-dbm/charts/dbpartition/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: dbpartition description: A Helm chart for db partition service type: application -version: 0.1.4 +version: 0.1.5 appVersion: 0.0.1-alpha.116 diff --git a/helm-charts/bk-dbm/charts/dbpartition/templates/deployment.yaml b/helm-charts/bk-dbm/charts/dbpartition/templates/deployment.yaml index 4831b94afa..75ddb92bd3 100644 --- a/helm-charts/bk-dbm/charts/dbpartition/templates/deployment.yaml +++ b/helm-charts/bk-dbm/charts/dbpartition/templates/deployment.yaml @@ -13,10 +13,8 @@ spec: {{- include "dbpartition.selectorLabels" . | nindent 6 }} template: metadata: - {{- with .Values.podAnnotations }} annotations: - {{- toYaml . | nindent 8 }} - {{- end }} + reloader.stakater.com/auto: "true" labels: {{- include "dbpartition.selectorLabels" . | nindent 8 }} spec: diff --git a/helm-charts/bk-dbm/charts/dbpriv/Chart.yaml b/helm-charts/bk-dbm/charts/dbpriv/Chart.yaml index 9217ac91de..da776bca8f 100644 --- a/helm-charts/bk-dbm/charts/dbpriv/Chart.yaml +++ b/helm-charts/bk-dbm/charts/dbpriv/Chart.yaml @@ -1,25 +1,7 @@ apiVersion: v2 name: dbpriv description: A Helm chart for dbpriv - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.28 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. +version: 0.1.29 appVersion: 0.0.1-alpha.51 diff --git a/helm-charts/bk-dbm/charts/dbpriv/templates/deployment.yaml b/helm-charts/bk-dbm/charts/dbpriv/templates/deployment.yaml index 0d5344335a..d3c7e321a0 100644 --- a/helm-charts/bk-dbm/charts/dbpriv/templates/deployment.yaml +++ b/helm-charts/bk-dbm/charts/dbpriv/templates/deployment.yaml @@ -13,10 +13,8 @@ spec: {{- include "dbpriv.selectorLabels" . | nindent 6 }} template: metadata: - {{- with .Values.podAnnotations }} annotations: - {{- toYaml . | nindent 8 }} - {{- end }} + reloader.stakater.com/auto: "true" labels: {{- include "dbpriv.selectorLabels" . | nindent 8 }} spec: diff --git a/helm-charts/bk-dbm/charts/hadb-api/Chart.yaml b/helm-charts/bk-dbm/charts/hadb-api/Chart.yaml index d08c2d0bd0..9d1672b21c 100644 --- a/helm-charts/bk-dbm/charts/hadb-api/Chart.yaml +++ b/helm-charts/bk-dbm/charts/hadb-api/Chart.yaml @@ -1,24 +1,6 @@ apiVersion: v2 name: hadb-api description: A Helm chart for Kubernetes - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.0.10 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. +version: 0.0.11 appVersion: 0.0.1-alpha.11 diff --git a/helm-charts/bk-dbm/charts/hadb-api/templates/deployment.yaml b/helm-charts/bk-dbm/charts/hadb-api/templates/deployment.yaml index cdec0297e3..1a4fb4fe62 100644 --- a/helm-charts/bk-dbm/charts/hadb-api/templates/deployment.yaml +++ b/helm-charts/bk-dbm/charts/hadb-api/templates/deployment.yaml @@ -13,10 +13,8 @@ spec: {{- include "hadb-api.selectorLabels" . | nindent 6 }} template: metadata: - {{- with .Values.podAnnotations }} annotations: - {{- toYaml . | nindent 8 }} - {{- end }} + reloader.stakater.com/auto: "true" labels: {{- include "hadb-api.selectorLabels" . | nindent 8 }} spec: diff --git a/helm-charts/bk-dbm/charts/slow-query-parser-service/Chart.yaml b/helm-charts/bk-dbm/charts/slow-query-parser-service/Chart.yaml new file mode 100644 index 0000000000..687762da57 --- /dev/null +++ b/helm-charts/bk-dbm/charts/slow-query-parser-service/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +appVersion: 0.0.1-alpha.4 +description: A Helm chart for Kubernetes +name: slow-query-parser-service +type: application +version: 0.0.1 diff --git a/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/NOTES.txt b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/NOTES.txt new file mode 100644 index 0000000000..e33446b74d --- /dev/null +++ b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "slow-query-parser-service.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "slow-query-parser-service.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "slow-query-parser-service.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "slow-query-parser-service.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/_helpers.tpl b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/_helpers.tpl new file mode 100644 index 0000000000..68f0325f8f --- /dev/null +++ b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "slow-query-parser-service.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "slow-query-parser-service.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "slow-query-parser-service.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "slow-query-parser-service.labels" -}} +helm.sh/chart: {{ include "slow-query-parser-service.chart" . }} +{{ include "slow-query-parser-service.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "slow-query-parser-service.selectorLabels" -}} +app.kubernetes.io/name: {{ include "slow-query-parser-service.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "slow-query-parser-service.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "slow-query-parser-service.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/deployment.yaml b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/deployment.yaml new file mode 100644 index 0000000000..e671ca98a5 --- /dev/null +++ b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/deployment.yaml @@ -0,0 +1,53 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "slow-query-parser-service.fullname" . }} + labels: + {{- include "slow-query-parser-service.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "slow-query-parser-service.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "slow-query-parser-service.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "slow-query-parser-service.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.global.imageRegistry | default .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/hpa.yaml b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/hpa.yaml new file mode 100644 index 0000000000..d14b2b4784 --- /dev/null +++ b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "slow-query-parser-service.fullname" . }} + labels: + {{- include "slow-query-parser-service.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "slow-query-parser-service.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/slow-query-parser-service/templates/ingress.yaml b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/ingress.yaml new file mode 100644 index 0000000000..d7a3f3a0ec --- /dev/null +++ b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "slow-query-parser-service.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "slow-query-parser-service.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/service.yaml b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/service.yaml new file mode 100644 index 0000000000..41f698ce07 --- /dev/null +++ b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "slow-query-parser-service.fullname" . }} + labels: + {{- include "slow-query-parser-service.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "slow-query-parser-service.selectorLabels" . | nindent 4 }} diff --git a/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/serviceaccount.yaml b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/serviceaccount.yaml new file mode 100644 index 0000000000..815bb9bf20 --- /dev/null +++ b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "slow-query-parser-service.serviceAccountName" . }} + labels: + {{- include "slow-query-parser-service.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/tests/test-connection.yaml b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/tests/test-connection.yaml new file mode 100644 index 0000000000..f3862bf61e --- /dev/null +++ b/helm-charts/bk-dbm/charts/slow-query-parser-service/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "slow-query-parser-service.fullname" . }}-test-connection" + labels: + {{- include "slow-query-parser-service.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "slow-query-parser-service.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/helm-charts/bk-dbm/charts/slow-query-parser-service/values.yaml b/helm-charts/bk-dbm/charts/slow-query-parser-service/values.yaml new file mode 100644 index 0000000000..1e4eb595a6 --- /dev/null +++ b/helm-charts/bk-dbm/charts/slow-query-parser-service/values.yaml @@ -0,0 +1,84 @@ +# Default values for db-simulation. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + registry: "mirrors.tencent.com" + repository: "build/blueking/slow-query-parser-service" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "bk-dbm-slow-query-parser-service" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/helm-charts/bk-dbm/values.yaml b/helm-charts/bk-dbm/values.yaml index d794611fac..7ec0705ac4 100644 --- a/helm-charts/bk-dbm/values.yaml +++ b/helm-charts/bk-dbm/values.yaml @@ -59,7 +59,6 @@ bk: dbm: extraEnvVarsCM: bk-dbm-db-env enabled: true - replicaCount: 1 serviceInit: itsmEnabled: true @@ -78,13 +77,6 @@ dbm: # Overrides the image tag whose default is the chart appVersion. tag: "" - nameOverride: "" - fullnameOverride: "" - - podAnnotations: {} - - podSecurityContext: {} - serviceAccount: # Specifies whether a service account should be created create: true @@ -156,21 +148,6 @@ dbm: pullPolicy: IfNotPresent tag: "" - securityContext: {} - - resources: - limits: - cpu: 2000m - memory: 2048Mi - requests: - cpu: 300m - memory: 512Mi - - nodeSelector: {} - - tolerations: [] - - affinity: {} # bk-dbconfig values @@ -242,7 +219,10 @@ db-remote-service: enabled: false db-celery-service: - enabled: false + enabled: true + +slow-query-parser-service: + enabled: true backup-consumer: enabled: true @@ -257,6 +237,16 @@ backup-server: api_sys_id: "test" api_key: "test key" +# reloader +stakater: + enabled: true + reloader: + watchGlobally: false + deployment: + image: + name: stakater/reloader + tag: v0.0.114 + # bitnami mysql 配置项 mysql: enabled: false @@ -343,7 +333,7 @@ redis: etcd: enabled: false -## 第三方 etcd 配置(TODO) +## 第三方 etcd 配置 externalEtcd: ## 地址 host: "etcd.example.com"