Skip to content
Open
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
1 change: 1 addition & 0 deletions charts/ozone/templates/om/om-service-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ metadata:
app.kubernetes.io/component: om
spec:
clusterIP: None
publishNotReadyAddresses: true
ports:
- name: ui
port: {{ .Values.om.service.port }}
Expand Down
18 changes: 18 additions & 0 deletions charts/ozone/templates/om/om-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ spec:
{{- include "ozone.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: om
spec:
{{- if gt (int .Values.om.replicas) 1 }}
terminationGracePeriodSeconds: 150
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -101,6 +104,21 @@ spec:
containerPort: {{ .Values.om.service.port }}
- name: ratis
containerPort: {{ .Values.om.service.ratisPort }}
{{- if gt (int .Values.om.replicas) 1 }}
lifecycle:
preStop:
exec:
command:
- sh
- -c
- |
LEADER=$(ozone admin om roles -id {{ .Values.clusterId }} 2>/dev/null | grep LEADER | awk '{print $1}')
if [ "$LEADER" = "$(hostname)" ]; then
echo "This OM is leader, transferring leadership..."
ozone admin om transfer -id {{ .Values.clusterId }} -r || true
sleep 10
fi
{{- end }}
livenessProbe:
httpGet:
path: /
Expand Down
1 change: 1 addition & 0 deletions charts/ozone/templates/scm/scm-service-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ metadata:
app.kubernetes.io/component: scm
spec:
clusterIP: None
publishNotReadyAddresses: true
ports:
- name: ui
port: {{ .Values.scm.service.port }}
Expand Down
18 changes: 18 additions & 0 deletions charts/ozone/templates/scm/scm-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ spec:
{{- include "ozone.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: scm
spec:
{{- if gt (int .Values.scm.replicas) 1 }}
terminationGracePeriodSeconds: 150
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -120,6 +123,21 @@ spec:
- name: grpc
containerPort: {{ .Values.scm.service.grpcPort }}
{{- end }}
{{- if gt (int .Values.scm.replicas) 1 }}
lifecycle:
preStop:
exec:
command:
- sh
- -c
- |
LEADER_HOST=$(ozone admin scm roles 2>/dev/null | grep LEADER | cut -d: -f1)
if [ "$LEADER_HOST" = "$(hostname -f)" ]; then
echo "This SCM is leader, transferring leadership..."
ozone admin scm transfer -id {{ .Values.clusterId }} -r || true
sleep 10
fi
{{- end }}
livenessProbe:
httpGet:
path: /
Expand Down