Skip to content

Commit

Permalink
fix(backend): 增加dbpartition启动依赖dbm特性 #1330
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud authored and zhangzhw8 committed Oct 10, 2023
1 parent 21ce9f8 commit ac7cde8
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,12 @@ def aggregate_backup_log_by_id(self, backup_logs: List[Dict[str, Any]]) -> List[
for field in delete_fields:
backup_id__backup_logs_map[backup_id].pop(field)

backup_id__backup_logs_map[backup_id]["file_list"].append(file_name)
backup_id__backup_logs_map[backup_id]["file_list_details"].append(
{"file_name": file_name, "size": log["file_size"], "task_id": log["task_id"]}
)
file_info = {"file_name": file_name, "size": log["file_size"], "task_id": log["task_id"]}
backup_id__backup_logs_map[backup_id]["file_list"].append(file_info["file_name"])
backup_id__backup_logs_map[backup_id]["file_list_details"].append(file_info)

if log["file_type"] in ["index", "priv"]:
backup_id__backup_logs_map[log["backup_id"]][log["file_type"]] = file_name
backup_id__backup_logs_map[log["backup_id"]][log["file_type"]] = file_info

return list(backup_id__backup_logs_map.values())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def validate(self, attrs):


class MysqlRestoreSlaveParamBuilder(builders.FlowParamBuilder):
controller = MySQLController.mysql_restore_slave_scene
controller = MySQLController.mysql_restore_slave_remote_scene

def format_ticket_data(self):
self.ticket_data["add_slave_only"] = False
Expand Down
8 changes: 4 additions & 4 deletions helm-charts/bk-dbm/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ dependencies:
version: 1.13.0
- name: mysql
repository: https://charts.bitnami.com/bitnami
version: 9.12.3
version: 9.12.4
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 16.13.2
- name: etcd
repository: https://charts.bitnami.com/bitnami
version: 9.5.1
version: 9.5.4
- name: grafana
repository: file://./charts/grafana
version: 7.9.8
Expand Down Expand Up @@ -50,5 +50,5 @@ dependencies:
- name: backup-consumer
repository: file://charts/backup-consumer
version: 0.0.2
digest: sha256:6b169baac096552bd3988867a19d3d4e4498abae76a118c0115a784018420783
generated: "2023-10-09T17:52:12.115867+08:00"
digest: sha256:6b5728014c60aa1e59b0805b9c63a84915e3ed5ea1581f8f4546daf4c0602027
generated: "2023-10-10T15:44:19.332544+08:00"
11 changes: 11 additions & 0 deletions helm-charts/bk-dbm/charts/dbpartition/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,14 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
k8sWaitFor Image
*/}}
{{- define "dbpartition.k8sWaitFor.image" -}}
{{- if and .Values.global .Values.global.imageRegistry -}}
{{- include "common.images.image" (dict "imageRoot" .Values.image.k8sWaitFor "global" .Values.global) -}}
{{- else -}}
{{- include "dbm.migration.image" (dict "image" .Values.image.k8sWaitFor "imageRoot" .Values.image) -}}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ spec:
{{- toYaml .Values.resources | nindent 12 }}
initContainers:
- name: check-saas-api
image: {{ include "dbm.migration.k8sWaitFor.image" . }}
image: {{ include "dbpartition.k8sWaitFor.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- pod
- -lapp.kubernetes.io/component={{ include "dbm.saas-api.fullname" .}}
- -lapp.kubernetes.io/component=bk-dbm-saas-api
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,33 @@ metadata:
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "dbpartition.fullname" . }}-role
rules:
- apiGroups:
- batch
- ""
resources:
- jobs
- pods
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "dbpartition.fullname" . }}-role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "dbpartition.fullname" . }}-role
subjects:
- kind: ServiceAccount
name: {{ include "dbpartition.serviceAccountName" . }}
namespace: {{ default "default" .Release.Namespace }}
{{- end }}
5 changes: 5 additions & 0 deletions helm-charts/bk-dbm/charts/dbpartition/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ image:
# Overrides the image tag whose default is the chart appVersion.
tag: ""

k8sWaitFor:
registry: "mirrors.tencent.com"
repository: "build/blueking/k8s-wait-for"
tag: "v1.5.1"

imagePullSecrets: []
nameOverride: ""
fullnameOverride: "bk-dbm-dbpartition"
Expand Down

0 comments on commit ac7cde8

Please sign in to comment.