diff --git a/dbm-ui/backend/db_monitor/migrations/0013_alter_monitorpolicy_target_level.py b/dbm-ui/backend/db_monitor/migrations/0013_alter_monitorpolicy_target_level.py index ae8736c6e1..d864ed1804 100644 --- a/dbm-ui/backend/db_monitor/migrations/0013_alter_monitorpolicy_target_level.py +++ b/dbm-ui/backend/db_monitor/migrations/0013_alter_monitorpolicy_target_level.py @@ -2,6 +2,8 @@ from django.db import migrations, models +from backend.db_monitor.constants import TargetLevel + class Migration(migrations.Migration): @@ -14,13 +16,7 @@ class Migration(migrations.Migration): model_name="monitorpolicy", name="target_level", field=models.CharField( - choices=[ - ("platform", "platform"), - ("appid", "app id"), - ("db_module", "db module"), - ("cluster_domain", "cluster domain"), - ("custom", "custom"), - ], + choices=TargetLevel.get_choices(), default="appid", max_length=64, verbose_name="监控目标级别,跟随targets调整", diff --git a/dbm-ui/backend/db_monitor/migrations/0014_alter_noticegroup_unique_together.py b/dbm-ui/backend/db_monitor/migrations/0014_alter_noticegroup_unique_together.py new file mode 100644 index 0000000000..09aeb40eab --- /dev/null +++ b/dbm-ui/backend/db_monitor/migrations/0014_alter_noticegroup_unique_together.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.19 on 2023-10-28 08:40 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("db_monitor", "0013_alter_monitorpolicy_target_level"), + ] + + operations = [ + migrations.AlterUniqueTogether( + name="noticegroup", + unique_together={("bk_biz_id", "name")}, + ), + ] diff --git a/dbm-ui/backend/db_report/migrations/0001_initial.py b/dbm-ui/backend/db_report/migrations/0001_initial.py index 9361860fea..7be29a9108 100644 --- a/dbm-ui/backend/db_report/migrations/0001_initial.py +++ b/dbm-ui/backend/db_report/migrations/0001_initial.py @@ -2,6 +2,9 @@ import django.db.models.deletion from django.db import migrations, models +from backend.db_meta.enums import ClusterType, MachineType +from backend.db_report.enums import MetaCheckSubType + class Migration(migrations.Migration): @@ -28,33 +31,7 @@ class Migration(migrations.Migration): ( "cluster_type", models.CharField( - choices=[ - ("tendbsingle", "tendbsingle"), - ("tendbha", "tendbha"), - ("tendbcluster", "tendbcluster"), - ("redis", "Redis集群"), - ("PredixyRedisCluster", "Redis集群"), - ("PredixyTendisplusCluster", "Tendisplus存储版集群"), - ("TwemproxyRedisInstance", "TendisCache集群"), - ("TwemproxyTendisSSDInstance", "TendisSSD集群"), - ("TwemproxyTendisplusInstance", "Tendis存储版集群"), - ("RedisInstance", "RedisCache主从版"), - ("TendisSSDInstance", "TendisSSD主从版"), - ("TendisplusInstance", "Tendisplus主从版"), - ("RedisCluster", "RedisCluster集群"), - ("TendisplusCluster", "TendisplusCluster集群"), - ("TendisplusInstance", "Tendisplus存储版集群 GetTendisType 获取redis类型值"), - ("RedisInstance", "TendisCache集群 GetTendisType 获取redis类型值"), - ("TendisSSDInstance", "TendisSSD集群 GetTendisType 获取redis类型值"), - ("es", "ES集群"), - ("kafka", "Kafka集群"), - ("hdfs", "Hdfs集群"), - ("influxdb", "Influxdb实例"), - ("pulsar", "Pulsar集群"), - ("MongoReplicaSet", "Mongo副本集"), - ("MongoShardedCluster", "Mongo分片集群"), - ("riak", "Riak集群"), - ], + choices=ClusterType.get_choices(), default="", max_length=64, ), @@ -62,34 +39,7 @@ class Migration(migrations.Migration): ( "machine_type", models.CharField( - choices=[ - ("spider", "spider"), - ("remote", "remote"), - ("proxy", "proxy"), - ("backend", "backend"), - ("single", "single"), - ("predixy", "predixy"), - ("twemproxy", "twemproxy"), - ("redis", "redis"), - ("tendiscache", "tendiscache"), - ("tendisssd", "tendisssd"), - ("tendisplus", "tendisplus"), - ("es_datanode", "es_datanode"), - ("es_master", "es_master"), - ("es_client", "es_client"), - ("broker", "broker"), - ("zookeeper", "zookeeper"), - ("hdfs_master", "hdfs_master"), - ("hdfs_datanode", "hdfs_datanode"), - ("mongos", "mongos"), - ("mongodb", "mongodb"), - ("mongo_config", "mongo_config"), - ("influxdb", "influxdb"), - ("pulsar_zookeeper", "pulsar_zookeeper"), - ("pulsar_bookkeeper", "pulsar_bookkeeper"), - ("pulsar_broker", "pulsar_broker"), - ("riak", "riak"), - ], + choices=MachineType.get_choices(), default="", max_length=64, ), @@ -97,11 +47,7 @@ class Migration(migrations.Migration): ( "subtype", models.CharField( - choices=[ - ("instance_belong", "实例集群归属"), - ("replicate_role", "数据同步实例角色"), - ("cluster_topo", "集群结构"), - ], + choices=MetaCheckSubType.get_choices(), default="", help_text="元数据检查子项", max_length=64, diff --git a/dbm-ui/backend/db_report/migrations/0002_alter_metacheckreport_cluster_type.py b/dbm-ui/backend/db_report/migrations/0002_alter_metacheckreport_cluster_type.py index d3570b993a..37eb4cc15e 100644 --- a/dbm-ui/backend/db_report/migrations/0002_alter_metacheckreport_cluster_type.py +++ b/dbm-ui/backend/db_report/migrations/0002_alter_metacheckreport_cluster_type.py @@ -2,6 +2,8 @@ from django.db import migrations, models +from backend.db_meta.enums import ClusterType + class Migration(migrations.Migration): @@ -14,33 +16,7 @@ class Migration(migrations.Migration): model_name="metacheckreport", name="cluster_type", field=models.CharField( - choices=[ - ("tendbsingle", "tendbsingle"), - ("tendbha", "tendbha"), - ("tendbcluster", "tendbcluster"), - ("redis", "Redis集群"), - ("PredixyRedisCluster", "Tendisplus集群"), - ("PredixyTendisplusCluster", "Tendisplus存储版集群"), - ("TwemproxyRedisInstance", "TendisCache集群"), - ("TwemproxyTendisSSDInstance", "TendisSSD集群"), - ("TwemproxyTendisplusInstance", "Tendis存储版集群"), - ("RedisInstance", "RedisCache主从版"), - ("TendisSSDInstance", "TendisSSD主从版"), - ("TendisplusInstance", "Tendisplus主从版"), - ("RedisCluster", "RedisCluster集群"), - ("TendisplusCluster", "TendisplusCluster集群"), - ("TendisplusInstance", "Tendisplus存储版集群 GetTendisType 获取redis类型值"), - ("RedisInstance", "TendisCache集群 GetTendisType 获取redis类型值"), - ("TendisSSDInstance", "TendisSSD集群 GetTendisType 获取redis类型值"), - ("es", "ES集群"), - ("kafka", "Kafka集群"), - ("hdfs", "Hdfs集群"), - ("influxdb", "Influxdb实例"), - ("pulsar", "Pulsar集群"), - ("MongoReplicaSet", "Mongo副本集"), - ("MongoShardedCluster", "Mongo分片集群"), - ("riak", "Riak集群"), - ], + choices=ClusterType.get_choices(), default="", max_length=64, ), diff --git a/dbm-ui/backend/db_report/migrations/0003_auto_20231023_1445.py b/dbm-ui/backend/db_report/migrations/0003_auto_20231023_1445.py index f9e5d929bc..268f6e9d78 100644 --- a/dbm-ui/backend/db_report/migrations/0003_auto_20231023_1445.py +++ b/dbm-ui/backend/db_report/migrations/0003_auto_20231023_1445.py @@ -2,6 +2,9 @@ from django.db import migrations, models +from backend.db_meta.enums import ClusterType +from backend.db_report.enums import RedisBackupCheckSubType + class Migration(migrations.Migration): @@ -26,33 +29,7 @@ class Migration(migrations.Migration): ( "cluster_type", models.CharField( - choices=[ - ("tendbsingle", "tendbsingle"), - ("tendbha", "tendbha"), - ("tendbcluster", "tendbcluster"), - ("redis", "Redis集群"), - ("PredixyRedisCluster", "Tendisplus集群"), - ("PredixyTendisplusCluster", "Tendisplus存储版集群"), - ("TwemproxyRedisInstance", "TendisCache集群"), - ("TwemproxyTendisSSDInstance", "TendisSSD集群"), - ("TwemproxyTendisplusInstance", "Tendis存储版集群"), - ("RedisInstance", "RedisCache主从版"), - ("TendisSSDInstance", "TendisSSD主从版"), - ("TendisplusInstance", "Tendisplus主从版"), - ("RedisCluster", "RedisCluster集群"), - ("TendisplusCluster", "TendisplusCluster集群"), - ("TendisplusInstance", "Tendisplus存储版集群 GetTendisType 获取redis类型值"), - ("RedisInstance", "TendisCache集群 GetTendisType 获取redis类型值"), - ("TendisSSDInstance", "TendisSSD集群 GetTendisType 获取redis类型值"), - ("es", "ES集群"), - ("kafka", "Kafka集群"), - ("hdfs", "Hdfs集群"), - ("influxdb", "Influxdb实例"), - ("pulsar", "Pulsar集群"), - ("MongoReplicaSet", "Mongo副本集"), - ("MongoShardedCluster", "Mongo分片集群"), - ("riak", "Riak集群"), - ], + choices=ClusterType.get_choices(), default="", max_length=64, ), @@ -61,11 +38,7 @@ class Migration(migrations.Migration): ( "subtype", models.CharField( - choices=[ - ("full_backup", "集群可用全备"), - ("binlog_slave", "从库binlog备份"), - ("binlog_seq", "binlog连续性检查"), - ], + choices=RedisBackupCheckSubType.get_choices(), default="", help_text="备份检查子项", max_length=64, @@ -85,33 +58,7 @@ class Migration(migrations.Migration): model_name="checksumcheckreport", name="cluster_type", field=models.CharField( - choices=[ - ("tendbsingle", "tendbsingle"), - ("tendbha", "tendbha"), - ("tendbcluster", "tendbcluster"), - ("redis", "Redis集群"), - ("PredixyRedisCluster", "Tendisplus集群"), - ("PredixyTendisplusCluster", "Tendisplus存储版集群"), - ("TwemproxyRedisInstance", "TendisCache集群"), - ("TwemproxyTendisSSDInstance", "TendisSSD集群"), - ("TwemproxyTendisplusInstance", "Tendis存储版集群"), - ("RedisInstance", "RedisCache主从版"), - ("TendisSSDInstance", "TendisSSD主从版"), - ("TendisplusInstance", "Tendisplus主从版"), - ("RedisCluster", "RedisCluster集群"), - ("TendisplusCluster", "TendisplusCluster集群"), - ("TendisplusInstance", "Tendisplus存储版集群 GetTendisType 获取redis类型值"), - ("RedisInstance", "TendisCache集群 GetTendisType 获取redis类型值"), - ("TendisSSDInstance", "TendisSSD集群 GetTendisType 获取redis类型值"), - ("es", "ES集群"), - ("kafka", "Kafka集群"), - ("hdfs", "Hdfs集群"), - ("influxdb", "Influxdb实例"), - ("pulsar", "Pulsar集群"), - ("MongoReplicaSet", "Mongo副本集"), - ("MongoShardedCluster", "Mongo分片集群"), - ("riak", "Riak集群"), - ], + choices=ClusterType.get_choices(), default="", max_length=64, verbose_name="集群类型", diff --git a/dbm-ui/backend/db_report/migrations/0004_auto_20231028_1640.py b/dbm-ui/backend/db_report/migrations/0004_auto_20231028_1640.py new file mode 100644 index 0000000000..4720255cfd --- /dev/null +++ b/dbm-ui/backend/db_report/migrations/0004_auto_20231028_1640.py @@ -0,0 +1,51 @@ +# Generated by Django 3.2.19 on 2023-10-28 08:40 + +from django.db import migrations, models + +from backend.db_meta.enums import ClusterType +from backend.db_report.enums import MysqlBackupCheckSubType + + +class Migration(migrations.Migration): + + dependencies = [ + ("db_report", "0003_auto_20231023_1445"), + ] + + operations = [ + migrations.CreateModel( + name="MysqlBackupCheckReport", + fields=[ + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("creator", models.CharField(max_length=64, verbose_name="创建人")), + ("create_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")), + ("updater", models.CharField(max_length=64, verbose_name="修改人")), + ("update_at", models.DateTimeField(auto_now=True, verbose_name="更新时间")), + ("bk_biz_id", models.IntegerField(default=0, help_text="业务的 cmdb id")), + ("bk_cloud_id", models.IntegerField(default=0, help_text="云区域 id")), + ("status", models.BooleanField(default=True, help_text="巡检结果状态, 默认正常")), + ("msg", models.TextField(default="", help_text="备注信息")), + ("cluster", models.CharField(default="", max_length=255)), + ("cluster_type", models.CharField(choices=ClusterType.get_choices(), default="", max_length=64)), + ( + "subtype", + models.CharField( + choices=MysqlBackupCheckSubType.get_choices(), default="", help_text="备份检查子项", max_length=64 + ), + ), + ], + options={ + "abstract": False, + }, + ), + migrations.AlterField( + model_name="redisbackupcheckreport", + name="subtype", + field=models.CharField( + choices=[("full_backup", "集群全备"), ("binlog_slave", "从库binlog备份")], + default="", + help_text="备份检查子项", + max_length=64, + ), + ), + ] diff --git a/dbm-ui/backend/db_services/redis/rollback/migrations/0011_auto_20231008_1938.py b/dbm-ui/backend/db_services/redis/rollback/migrations/0011_auto_20231008_1938.py index ad07849b63..8e6ff4ac98 100644 --- a/dbm-ui/backend/db_services/redis/rollback/migrations/0011_auto_20231008_1938.py +++ b/dbm-ui/backend/db_services/redis/rollback/migrations/0011_auto_20231008_1938.py @@ -2,6 +2,8 @@ from django.db import migrations, models +from backend.db_meta.enums import ClusterType + class Migration(migrations.Migration): @@ -14,33 +16,7 @@ class Migration(migrations.Migration): model_name="tbtendisrollbacktasks", name="prod_cluster_type", field=models.CharField( - choices=[ - ("tendbsingle", "tendbsingle"), - ("tendbha", "tendbha"), - ("tendbcluster", "tendbcluster"), - ("redis", "Redis集群"), - ("PredixyRedisCluster", "Tendisplus集群"), - ("PredixyTendisplusCluster", "Tendisplus存储版集群"), - ("TwemproxyRedisInstance", "TendisCache集群"), - ("TwemproxyTendisSSDInstance", "TendisSSD集群"), - ("TwemproxyTendisplusInstance", "Tendis存储版集群"), - ("RedisInstance", "RedisCache主从版"), - ("TendisSSDInstance", "TendisSSD主从版"), - ("TendisplusInstance", "Tendisplus主从版"), - ("RedisCluster", "RedisCluster集群"), - ("TendisplusCluster", "TendisplusCluster集群"), - ("TendisplusInstance", "Tendisplus存储版集群 GetTendisType 获取redis类型值"), - ("RedisInstance", "TendisCache集群 GetTendisType 获取redis类型值"), - ("TendisSSDInstance", "TendisSSD集群 GetTendisType 获取redis类型值"), - ("es", "ES集群"), - ("kafka", "Kafka集群"), - ("hdfs", "Hdfs集群"), - ("influxdb", "Influxdb实例"), - ("pulsar", "Pulsar集群"), - ("MongoReplicaSet", "Mongo副本集"), - ("MongoShardedCluster", "Mongo分片集群"), - ("riak", "Riak集群"), - ], + choices=ClusterType.get_choices(), default="", max_length=64, verbose_name="构造源集群类型", @@ -50,33 +26,7 @@ class Migration(migrations.Migration): model_name="tbtendisrollbacktasks", name="temp_cluster_type", field=models.CharField( - choices=[ - ("tendbsingle", "tendbsingle"), - ("tendbha", "tendbha"), - ("tendbcluster", "tendbcluster"), - ("redis", "Redis集群"), - ("PredixyRedisCluster", "Tendisplus集群"), - ("PredixyTendisplusCluster", "Tendisplus存储版集群"), - ("TwemproxyRedisInstance", "TendisCache集群"), - ("TwemproxyTendisSSDInstance", "TendisSSD集群"), - ("TwemproxyTendisplusInstance", "Tendis存储版集群"), - ("RedisInstance", "RedisCache主从版"), - ("TendisSSDInstance", "TendisSSD主从版"), - ("TendisplusInstance", "Tendisplus主从版"), - ("RedisCluster", "RedisCluster集群"), - ("TendisplusCluster", "TendisplusCluster集群"), - ("TendisplusInstance", "Tendisplus存储版集群 GetTendisType 获取redis类型值"), - ("RedisInstance", "TendisCache集群 GetTendisType 获取redis类型值"), - ("TendisSSDInstance", "TendisSSD集群 GetTendisType 获取redis类型值"), - ("es", "ES集群"), - ("kafka", "Kafka集群"), - ("hdfs", "Hdfs集群"), - ("influxdb", "Influxdb实例"), - ("pulsar", "Pulsar集群"), - ("MongoReplicaSet", "Mongo副本集"), - ("MongoShardedCluster", "Mongo分片集群"), - ("riak", "Riak集群"), - ], + choices=ClusterType.get_choices(), default="", max_length=64, verbose_name="临时集群类型", diff --git a/helm-charts/README.md b/helm-charts/README.md index be8bea0d32..a0beb9c018 100644 --- a/helm-charts/README.md +++ b/helm-charts/README.md @@ -1,5 +1,9 @@ # BKDBM Helm Charts +添加依赖的 repo 库 +`helm repo add bitnami https://charts.bitnami.com/bitnami` +`helm repo add stakater-charts https://stakater.github.io/stakater-charts` + 采用 subchart 模式管理 ``` ├── Chart.lock @@ -20,5 +24,6 @@ ``` 修改后: +在 helm-charts 目录下 1. 执行 `helm dependency update bk-dbm` 更新依赖 -2. 执行 `helm template bk-dbm bk-dbm` 渲染 helm template 并校验渲染是否成功 +2. 执行 `helm template ./bk-dbm -f bk-dbm/values.yaml` 渲染 helm template 并校验渲染是否成功 diff --git a/helm-charts/bk-dbm/Chart.lock b/helm-charts/bk-dbm/Chart.lock index dbaeba4f22..8a1fdd290e 100644 --- a/helm-charts/bk-dbm/Chart.lock +++ b/helm-charts/bk-dbm/Chart.lock @@ -10,7 +10,7 @@ dependencies: version: 16.13.2 - name: etcd repository: https://charts.bitnami.com/bitnami - version: 9.5.6 + version: 9.5.7 - name: reloader repository: https://stakater.github.io/stakater-charts version: 1.0.48 @@ -19,13 +19,13 @@ dependencies: version: 7.9.8 - name: dbm repository: file://charts/dbm - version: 0.1.23 + version: 0.1.28 - name: dbconfig repository: file://charts/dbconfig version: 0.1.8 - name: dbpriv repository: file://charts/dbpriv - version: 0.1.30 + version: 0.1.31 - name: dbpartition repository: file://charts/dbpartition version: 0.1.7 @@ -56,5 +56,5 @@ dependencies: - name: backup-consumer repository: file://charts/backup-consumer version: 0.0.3 -digest: sha256:79f8e300ba516183dc9e8dc2322fc113c6e3b09092e3dd51be7bf59ab4464c04 -generated: "2023-10-27T10:09:52.649624+08:00" +digest: sha256:02affbee7552bf245b5b5580bb5a1a1c37c45e80073041b16fabe74268d4f0be +generated: "2023-10-30T10:09:08.993106+08:00" diff --git a/helm-charts/bk-dbm/Chart.yaml b/helm-charts/bk-dbm/Chart.yaml index 6452cb4e05..462506c651 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.23 + version: 0.1.28 - condition: dbconfig.enabled name: dbconfig repository: file://charts/dbconfig @@ -35,7 +35,7 @@ dependencies: - condition: dbpriv.enabled name: dbpriv repository: file://charts/dbpriv - version: 0.1.30 + version: 0.1.31 - condition: dbpartition.enabled name: dbpartition repository: file://charts/dbpartition @@ -79,5 +79,5 @@ dependencies: description: A Helm chart for bkdbm name: bk-dbm type: application -version: 1.2.0-alpha.65 -appVersion: 1.2.0-alpha.65 +version: 1.2.0-alpha.70 +appVersion: 1.2.0-alpha.70 diff --git a/helm-charts/bk-dbm/charts/dbm/Chart.yaml b/helm-charts/bk-dbm/charts/dbm/Chart.yaml index 04df5d1bd6..12d6ccb2be 100644 --- a/helm-charts/bk-dbm/charts/dbm/Chart.yaml +++ b/helm-charts/bk-dbm/charts/dbm/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 -appVersion: 1.2.0-alpha.418 +appVersion: 1.2.0-alpha.421 description: A Helm chart for dbm name: dbm type: application -version: 0.1.23 +version: 0.1.28 diff --git a/helm-charts/bk-dbm/charts/dbm/templates/_helpers.tpl b/helm-charts/bk-dbm/charts/dbm/templates/_helpers.tpl index 756c83b779..5a93f0acd9 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/_helpers.tpl +++ b/helm-charts/bk-dbm/charts/dbm/templates/_helpers.tpl @@ -154,6 +154,8 @@ initContainers: args: - pod - -lapp.kubernetes.io/component={{ include "dbm.saas-api.fullname" .}} + resources: + {{- toYaml .Values.initJob.resources | nindent 6 }} {{- end }} {{- define "dbm.initContainersWaitForMigrate" -}} @@ -168,6 +170,26 @@ initContainers: {{- toYaml .Values.initJob.resources | nindent 6 }} {{- end }} +{{- define "dbm.initMedium" -}} +{{- $root := first . -}} +{{- $db_type := last . -}} +- name: dbm-medium-init-{{ $db_type }} + image: "{{ $root.Values.global.imageRegistry | default $root.Values.dbmedium.image.registry }}/{{ $root.Values.dbmedium.image.repository }}:{{ $root.Values.dbmedium.image.tag | default $root.Chart.AppVersion }}" + imagePullPolicy: {{ $root.Values.dbmedium.image.pullPolicy }} + command: + - /bin/bash + - -c + args: + - "python main.py --type upload --db {{ $db_type }} && python main.py --type sync --db {{ $db_type }}" + envFrom: + {{- if $root.Values.dbmedium.extraEnvVarsCM }} + - configMapRef: + name: {{ $root.Values.dbmedium.extraEnvVarsCM }} + {{- end }} + resources: + {{- toYaml $root.Values.initJob.resources | nindent 4 }} +{{- end }} + {{- define "dbm.container_env" -}} env: {{- include "dbm.envs" . | trim | nindent 2 }} 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 d6b41c322d..1897236da2 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 @@ -6,7 +6,6 @@ metadata: labels: {{- include "dbm.labels" . | nindent 4 }} spec: - backoffLimit: 0 template: metadata: labels: 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 1d4fdfae71..bff89dc022 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 @@ -6,7 +6,6 @@ metadata: labels: {{- include "dbm.labels" . | nindent 4 }} spec: - backoffLimit: 0 template: metadata: labels: 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 2ac7f914ac..9fe3cc9a90 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 @@ -6,7 +6,6 @@ metadata: labels: {{- include "dbm.labels" . | nindent 4 }} spec: - backoffLimit: 0 template: metadata: labels: 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 d2cc3dc0c5..ec1650e5ae 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 @@ -6,7 +6,6 @@ metadata: labels: {{- include "dbm.labels" . | nindent 4 }} spec: - backoffLimit: 0 template: metadata: labels: 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 baac9d53a4..f48fcb9950 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 @@ -6,7 +6,6 @@ metadata: labels: {{- include "dbm.labels" . | nindent 4 }} spec: - backoffLimit: 0 template: metadata: labels: 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 8f778718e0..9b0be6d2f3 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 @@ -6,7 +6,6 @@ metadata: labels: {{- include "dbm.labels" . | nindent 4 }} spec: - backoffLimit: 0 template: metadata: labels: 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 ee7e30f3f0..6178a55fea 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 @@ -6,7 +6,6 @@ metadata: labels: {{- include "dbm.labels" . | nindent 4 }} spec: - backoffLimit: 0 template: metadata: labels: @@ -19,24 +18,12 @@ spec: serviceAccountName: {{ include "dbm.serviceAccountName" . }} restartPolicy: Never containers: - - name: dbm-medium-init - image: "{{ .Values.global.imageRegistry | default .Values.dbmedium.image.registry }}/{{ .Values.dbmedium.image.repository }}:{{ .Values.dbmedium.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.dbmedium.image.pullPolicy }} - command: - - /bin/bash - - -c - args: - - | - type=('mysql' 'es' 'kafka' 'hdfs' 'pulsar' 'influxdb' 'redis'); - for element in ${type[@]}; do - python main.py --type upload --db $element && python main.py --type sync --db $element; - done - envFrom: - {{- if .Values.dbmedium.extraEnvVarsCM }} - - configMapRef: - name: {{ .Values.dbmedium.extraEnvVarsCM }} - {{- end }} - resources: - {{- toYaml .Values.initJob.resources | nindent 12 }} + {{- include "dbm.initMedium" (list . "mysql") | nindent 8 }} + {{- include "dbm.initMedium" (list . "es") | nindent 8 }} + {{- include "dbm.initMedium" (list . "kafka") | nindent 8 }} + {{- include "dbm.initMedium" (list . "hdfs") | nindent 8 }} + {{- include "dbm.initMedium" (list . "pulsar") | nindent 8 }} + {{- include "dbm.initMedium" (list . "influxdb") | nindent 8 }} + {{- include "dbm.initMedium" (list . "redis") | nindent 8 }} {{- 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 581d0587aa..813bdc7775 100644 --- a/helm-charts/bk-dbm/charts/dbm/templates/migrate-job.yaml +++ b/helm-charts/bk-dbm/charts/dbm/templates/migrate-job.yaml @@ -6,7 +6,6 @@ metadata: labels: {{- include "dbm.labels" . | nindent 4 }} spec: - backoffLimit: 0 template: metadata: labels: @@ -25,7 +24,7 @@ spec: - /bin/bash - -c args: - - "python manage.py migrate && python manage.py migrate --database=report_db && python manage.py createcachetable django_cache" + - "python manage.py migrate db_report --database=report_db && python manage.py migrate && python manage.py createcachetable django_cache" env: {{- include "dbm.envs" . | trim | nindent 12 }} envFrom: 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 ade47599ca..5ce4a5ab9a 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 @@ -6,7 +6,6 @@ metadata: labels: {{- include "dbm.labels" . | nindent 4 }} spec: - backoffLimit: 0 template: metadata: labels: diff --git a/helm-charts/bk-dbm/charts/dbpriv/Chart.yaml b/helm-charts/bk-dbm/charts/dbpriv/Chart.yaml index 8e05fbb3da..da77817f9b 100644 --- a/helm-charts/bk-dbm/charts/dbpriv/Chart.yaml +++ b/helm-charts/bk-dbm/charts/dbpriv/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: dbpriv description: A Helm chart for dbpriv type: application -version: 0.1.30 +version: 0.1.31 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 691dab59f8..d1d1335528 100644 --- a/helm-charts/bk-dbm/charts/dbpriv/templates/deployment.yaml +++ b/helm-charts/bk-dbm/charts/dbpriv/templates/deployment.yaml @@ -46,6 +46,7 @@ spec: - name: http containerPort: 80 protocol: TCP + {{- if .Values.livenessProbe.enabled }} livenessProbe: httpGet: path: {{ .Values.livenessProbe.path | default "/ping"}} @@ -55,6 +56,8 @@ spec: timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds | default 5}} successThreshold: {{ .Values.livenessProbe.successThreshold | default 1}} failureThreshold: {{ .Values.livenessProbe.failureThreshold | default 1}} + {{- end }} + {{- if .Values.readinessProbe.enabled }} readinessProbe: httpGet: path: {{ .Values.readinessProbe.path | default "/ping"}} @@ -64,6 +67,7 @@ spec: timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds | default 5}} successThreshold: {{ .Values.readinessProbe.successThreshold | default 1}} failureThreshold: {{ .Values.readinessProbe.failureThreshold | default 1}} + {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} volumeMounts: diff --git a/helm-charts/bk-dbm/charts/dbpriv/values.yaml b/helm-charts/bk-dbm/charts/dbpriv/values.yaml index 8e6ed008c4..6f62025620 100644 --- a/helm-charts/bk-dbm/charts/dbpriv/values.yaml +++ b/helm-charts/bk-dbm/charts/dbpriv/values.yaml @@ -91,6 +91,8 @@ tolerations: [] affinity: {} -livenessProbe: {} +livenessProbe: + enabled: false -readinessProbe: {} +readinessProbe: + enabled: false diff --git a/helm-charts/bk-dbm/values.yaml b/helm-charts/bk-dbm/values.yaml index 687ce9efee..5d6eb2bfbc 100644 --- a/helm-charts/bk-dbm/values.yaml +++ b/helm-charts/bk-dbm/values.yaml @@ -241,6 +241,9 @@ backup-server: stakater: enabled: true reloader: + deployment: + image: + name: stakater/reloader watchGlobally: false # bitnami mysql 配置项