Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: the zk metadata backup and restore #1140

Merged
merged 7 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,43 @@ spec:
pdb:
metadata:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}"
{{- with .Values.bookkeeper.customization }}
customization:
{{- with .Values.bookkeeper.customization }}
{{- toYaml . | nindent 2 -}}
{{- end }}
{{- if .Values.zookeeper.customTools.restore.enable}}
- match:
groupVersionKinds:
- kind: Job
name: .*-bk-init
manifest: |
spec:
template:
spec:
initContainers:
- name: pulsar-metadata-cleanup
image: "{{ .Values.images.zookeeper.customTools.restore.repository }}:{{ .Values.images.zookeeper.customTools.restore.tag }}"
command: ["sh", "-c"]
args:
- >
{{- include "pulsar.toolset.zookeeper.tls.settings" . | nindent 12 }}
{{ if and .Values.tls.enabled .Values.tls.zookeeper.enabled }}
export "$(cat conf/pulsar_env.sh | xargs)";
export OPTS="${PULSAR_EXTRA_OPTS} ${EXTRA_OPTS}";
env;
{{- end }}
bin/pulsar-metadata-tool cleanup
env:
- name: METADATA_TOOL_CONF
value: "/pulsar-metadata-tool/conf/pulsar-metadata-tool/pulsar-metadata-tool.properties"
- name: EXTRA_OPTS
value: {{ .Values.zookeeper.customTools.restore.configData.OPTS }}
volumeMounts:
- name: cleanup-config
mountPath: /pulsar-metadata-tool/conf/pulsar-metadata-tool
volumes:
- name: cleanup-config
configMap:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.customTools.restore.component }}"
{{- end }}
{{- end }}
24 changes: 0 additions & 24 deletions charts/sn-platform-slim/templates/broker/broker-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -336,30 +336,6 @@ spec:
PULSAR_PREFIX_managedLedgerOffloadServiceEndpoint: "{{ .Values.broker.offload.azureblob.managedLedgerOffloadServiceEndpoint }}"
{{- end}}
{{- end }}
initJobPod:
{{- if .Values.zookeeper.customTools.restore.enable }}
initContainers:
- name: cleanup
image: "{{ .Values.images.zookeeper.customTools.restore.repository }}:{{ .Values.images.zookeeper.customTools.restore.tag }}"
command:
- bash
- '-c'
args:
- "bin/pulsar-metadata-tool cleanup"
env:
- name: METADATA_TOOL_CONF
value: "/pulsar-metadata-tool/conf/pulsar-metadata-tool/pulsar-metadata-tool.properties"
volumeMounts:
- name: cleanup-config
mountPath: /pulsar-metadata-tool/conf/pulsar-metadata-tool
volumes:
- name: cleanup-config
configMap:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.customTools.restore.component }}"
{{- end }}
{{- if .Values.broker.resources }}
resources: {{- toYaml .Values.broker.resources | nindent 10 }}
{{- end }}
{{- if or .Values.tls.broker.enabled .Values.broker.extraVolumeMounts .Values.broker.extraVolumeClaimTemplates }}
apiObjects:
statefulSet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ spec:
{{- end }}
securityContext:
{{- with .Values.zookeeper.securityContext }}
{{ toYaml . | indent 8 }}
{{ toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.zookeeper.customTools.serviceAccount.use }}
serviceAccountName: {{ template "pulsar.zookeeper.backup.serviceAccount" . }}
Expand All @@ -85,7 +85,7 @@ spec:
containers:
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.customTools.backup.component }}-service"
image: "{{ .Values.images.zookeeper.customTools.backup.repository }}:{{ .Values.images.zookeeper.customTools.backup.tag }}"
imagePullPolicy: {{ .Values.zookeeper.customTools.backup.pullPolicy }}
imagePullPolicy: {{ .Values.images.zookeeper.customTools.backup.pullPolicy }}
command: ["sh", "-c"]
args:
- >
Expand Down Expand Up @@ -163,6 +163,7 @@ spec:
initialDelaySeconds: {{ .Values.zookeeper.probe.readiness.initialDelaySeconds }}
periodSeconds: {{ .Values.zookeeper.probe.readiness.periodSeconds }}
failureThreshold: {{ .Values.zookeeper.probe.readiness.failureThreshold }}
timeoutSeconds: {{ .Values.zookeeper.probe.readiness.timeoutSeconds }}
{{- end }}
{{- if .Values.zookeeper.probe.liveness.enabled }}
livenessProbe:
Expand All @@ -172,6 +173,7 @@ spec:
initialDelaySeconds: {{ .Values.zookeeper.probe.liveness.initialDelaySeconds }}
periodSeconds: {{ .Values.zookeeper.probe.liveness.periodSeconds }}
failureThreshold: {{ .Values.zookeeper.probe.liveness.failureThreshold }}
timeoutSeconds: {{ .Values.zookeeper.probe.liveness.timeoutSeconds }}
{{- end }}
{{- if .Values.zookeeper.probe.startup.enabled }}
startupProbe:
Expand All @@ -181,6 +183,7 @@ spec:
initialDelaySeconds: {{ .Values.zookeeper.probe.startup.initialDelaySeconds }}
periodSeconds: {{ .Values.zookeeper.probe.startup.periodSeconds }}
failureThreshold: {{ .Values.zookeeper.probe.startup.failureThreshold }}
timeoutSeconds: {{ .Values.zookeeper.probe.startup.timeoutSeconds }}
{{- end }}
volumeMounts:
{{- include "pulsar.zookeeper.data.volumeMounts" . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ data:
managedLedgerPath={{ .Values.zookeeper.customTools.restore.managedLedgerPath }}
webServerPort=8088
restoreVersion={{ .Values.zookeeper.customTools.restore.restoreVersion }}
cleanupBookieMeta={{ .Values.zookeeper.customTools.restore.cleanupBookieMeta }}
cleanupClusterMeta={{ .Values.zookeeper.customTools.restore.cleanupClusterMeta }}
{{ toYaml .Values.zookeeper.customTools.restore.configData | indent 2 }}
{{- end }}
5 changes: 5 additions & 0 deletions charts/sn-platform-slim/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,11 @@ images:
backup:
repository: "streamnative/pulsar-metadata-tool"
tag: "3.1.1.1"
pullPolicy: IfNotPresent
restore:
repository: "streamnative/pulsar-metadata-tool"
tag: "3.1.1.1"
pullPolicy: IfNotPresent
bookie:
repository: streamnative/sn-platform-slim
tag: "3.1.1.1"
Expand Down Expand Up @@ -583,16 +585,19 @@ zookeeper:
failureThreshold: 10
initialDelaySeconds: 10
periodSeconds: 30
timeoutSeconds: 10
readiness:
enabled: true
failureThreshold: 10
initialDelaySeconds: 10
periodSeconds: 30
timeoutSeconds: 10
startup:
enabled: false
failureThreshold: 30
initialDelaySeconds: 10
periodSeconds: 30
timeoutSeconds: 10
affinity:
anti_affinity: true
zone_anti_affinity: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,43 @@ spec:
pdb:
metadata:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}"
{{- with .Values.bookkeeper.customization }}
customization:
{{- with .Values.bookkeeper.customization }}
{{- toYaml . | nindent 2 -}}
{{- end }}
{{- if .Values.zookeeper.customTools.restore.enable}}
- match:
groupVersionKinds:
- kind: Job
name: .*-bk-init
manifest: |
spec:
template:
spec:
initContainers:
- name: pulsar-metadata-cleanup
image: "{{ .Values.images.zookeeper.customTools.restore.repository }}:{{ .Values.images.zookeeper.customTools.restore.tag }}"
command: ["sh", "-c"]
args:
- >
{{- include "pulsar.toolset.zookeeper.tls.settings" . | nindent 12 }}
{{ if and .Values.tls.enabled .Values.tls.zookeeper.enabled }}
export "$(cat conf/pulsar_env.sh | xargs)";
export OPTS="${PULSAR_EXTRA_OPTS} ${EXTRA_OPTS}";
env;
{{- end }}
bin/pulsar-metadata-tool cleanup
env:
- name: METADATA_TOOL_CONF
value: "/pulsar-metadata-tool/conf/pulsar-metadata-tool/pulsar-metadata-tool.properties"
- name: EXTRA_OPTS
value: {{ .Values.zookeeper.customTools.restore.configData.OPTS }}
volumeMounts:
- name: cleanup-config
mountPath: /pulsar-metadata-tool/conf/pulsar-metadata-tool
volumes:
- name: cleanup-config
configMap:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.customTools.restore.component }}"
{{- end }}
{{- end }}
24 changes: 0 additions & 24 deletions charts/sn-platform/templates/broker/broker-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -341,30 +341,6 @@ spec:
PULSAR_PREFIX_managedLedgerOffloadServiceEndpoint: "{{ .Values.broker.offload.azureblob.managedLedgerOffloadServiceEndpoint }}"
{{- end}}
{{- end }}
initJobPod:
{{- if .Values.zookeeper.customTools.restore.enable }}
initContainers:
- name: cleanup
image: "{{ .Values.images.zookeeper.customTools.restore.repository }}:{{ .Values.images.zookeeper.customTools.restore.tag }}"
command:
- bash
- '-c'
args:
- "bin/pulsar-metadata-tool cleanup"
env:
- name: METADATA_TOOL_CONF
value: "/pulsar-metadata-tool/conf/pulsar-metadata-tool/pulsar-metadata-tool.properties"
volumeMounts:
- name: cleanup-config
mountPath: /pulsar-metadata-tool/conf/pulsar-metadata-tool
volumes:
- name: cleanup-config
configMap:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.customTools.restore.component }}"
{{- end }}
{{- if .Values.broker.resources }}
resources: {{- toYaml .Values.broker.resources | nindent 10 }}
{{- end }}
{{- if or .Values.tls.broker.enabled .Values.broker.extraVolumeMounts .Values.broker.extraVolumeClaimTemplates }}
apiObjects:
statefulSet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ spec:
{{- end }}
securityContext:
{{- with .Values.zookeeper.securityContext }}
{{ toYaml . | indent 8 }}
{{ toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.zookeeper.customTools.serviceAccount.use }}
serviceAccountName: {{ template "pulsar.zookeeper.backup.serviceAccount" . }}
Expand Down Expand Up @@ -163,6 +163,7 @@ spec:
initialDelaySeconds: {{ .Values.zookeeper.probe.readiness.initialDelaySeconds }}
periodSeconds: {{ .Values.zookeeper.probe.readiness.periodSeconds }}
failureThreshold: {{ .Values.zookeeper.probe.readiness.failureThreshold }}
timeoutSeconds: {{ .Values.zookeeper.probe.readiness.timeoutSeconds }}
{{- end }}
{{- if .Values.zookeeper.probe.liveness.enabled }}
livenessProbe:
Expand All @@ -172,6 +173,7 @@ spec:
initialDelaySeconds: {{ .Values.zookeeper.probe.liveness.initialDelaySeconds }}
periodSeconds: {{ .Values.zookeeper.probe.liveness.periodSeconds }}
failureThreshold: {{ .Values.zookeeper.probe.liveness.failureThreshold }}
timeoutSeconds: {{ .Values.zookeeper.probe.liveness.timeoutSeconds }}
{{- end }}
{{- if .Values.zookeeper.probe.startup.enabled }}
startupProbe:
Expand All @@ -181,6 +183,7 @@ spec:
initialDelaySeconds: {{ .Values.zookeeper.probe.startup.initialDelaySeconds }}
periodSeconds: {{ .Values.zookeeper.probe.startup.periodSeconds }}
failureThreshold: {{ .Values.zookeeper.probe.startup.failureThreshold }}
timeoutSeconds: {{ .Values.zookeeper.probe.startup.timeoutSeconds }}
{{- end }}
volumeMounts:
{{- include "pulsar.zookeeper.data.volumeMounts" . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ data:
managedLedgerPath={{ .Values.zookeeper.customTools.restore.managedLedgerPath }}
webServerPort=8088
restoreVersion={{ .Values.zookeeper.customTools.restore.restoreVersion }}
cleanupBookieMeta={{ .Values.zookeeper.customTools.restore.cleanupBookieMeta }}
cleanupClusterMeta={{ .Values.zookeeper.customTools.restore.cleanupClusterMeta }}
{{ toYaml .Values.zookeeper.customTools.restore.configData | indent 2 }}
{{- end }}
5 changes: 5 additions & 0 deletions charts/sn-platform/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ images:
backup:
repository: "streamnative/pulsar-metadata-tool"
tag: "3.1.1.1"
pullPolicy: IfNotPresent
restore:
repository: "streamnative/pulsar-metadata-tool"
tag: "3.1.1.1"
pullPolicy: IfNotPresent
bookie:
repository: streamnative/sn-platform
tag: "3.1.1.1"
Expand Down Expand Up @@ -658,16 +660,19 @@ zookeeper:
failureThreshold: 10
initialDelaySeconds: 10
periodSeconds: 30
timeoutSeconds: 10
readiness:
enabled: true
failureThreshold: 10
initialDelaySeconds: 10
periodSeconds: 30
timeoutSeconds: 10
startup:
enabled: false
failureThreshold: 30
initialDelaySeconds: 10
periodSeconds: 30
timeoutSeconds: 10
affinity:
anti_affinity: true
zone_anti_affinity: true
Expand Down
Loading