mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
[stable/graylog] fix the logic to determine master node. (#19552)
* fix the logic to determine master node. When container was recreated or restart or other conditions, pod is not bing removed, then the master node may becomes a coordinator . This commit add a condition to check if master ip equals the ip of pod itself. If master ip equals the ip of pod itself, it is master node. fix https://github.com/helm/charts/issues/17550 Signed-off-by: fuyuan.chu <fuyuan.chu@daocloud.io> * fix unexpected new line Signed-off-by: fuyuan.chu <fuyuan.chu@daocloud.io>
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
cd7ae22ce1
commit
4d1eef4a81
@@ -1,7 +1,7 @@
|
||||
apiVersion: v1
|
||||
name: graylog
|
||||
home: https://www.graylog.org
|
||||
version: 1.4.0
|
||||
version: 1.4.1
|
||||
appVersion: 3.1
|
||||
description: Graylog is the centralized log management solution built to open standards for capturing, storing, and enabling real-time analysis of terabytes of machine data.
|
||||
keywords:
|
||||
|
||||
@@ -141,15 +141,23 @@ data:
|
||||
MASTER_NAME="{{ template "graylog.fullname" . }}-master.{{ .Release.Namespace }}.svc.cluster.local"
|
||||
# Looking for Master IP
|
||||
MASTER_IP=`/k8s/kubectl --namespace {{ .Release.Namespace }} get pod -o jsonpath='{range .items[*]}{.metadata.name} {.status.podIP}{"\n"}{end}' -l graylog-role=master --field-selector=status.phase=Running|awk '{print $2}'`
|
||||
SELF_IP=`/k8s/kubectl --namespace {{ .Release.Namespace }} get pod $HOSTNAME -o jsonpath='{.status.podIP}'`
|
||||
echo "Current master is $MASTER_IP"
|
||||
echo "Self IP is $SELF_IP"
|
||||
if [[ -z "$MASTER_IP" ]]; then
|
||||
echo "Launching $HOSTNAME as master"
|
||||
export GRAYLOG_IS_MASTER="true"
|
||||
/k8s/kubectl --namespace {{ .Release.Namespace }} label --overwrite pod $HOSTNAME graylog-role="master"
|
||||
else
|
||||
echo "Launching $HOSTNAME as coordinating"
|
||||
export GRAYLOG_IS_MASTER="false"
|
||||
/k8s/kubectl --namespace {{ .Release.Namespace }} label --overwrite pod $HOSTNAME graylog-role="coordinating"
|
||||
# When container was recreated or restart, MASTER_IP == SELF_IP, running as master and no need to change label graylog-role="master"
|
||||
if [ "$SELF_IP" == "$MASTER_IP" ];then
|
||||
export GRAYLOG_IS_MASTER="true"
|
||||
else
|
||||
# MASTER_IP != SELF_IP, running as coordinating
|
||||
echo "Launching $HOSTNAME as coordinating"
|
||||
export GRAYLOG_IS_MASTER="false"
|
||||
/k8s/kubectl --namespace {{ .Release.Namespace }} label --overwrite pod $HOSTNAME graylog-role="coordinating"
|
||||
fi
|
||||
fi
|
||||
# Download plugins
|
||||
{{- if .Values.graylog.plugins }}
|
||||
|
||||
Reference in New Issue
Block a user