mirror of
https://github.com/wahyd4/charts.git
synced 2026-08-24 20:46:37 +10:00
Apply bash style fixes
This commit is contained in:
@@ -94,30 +94,30 @@ spec:
|
||||
}
|
||||
|
||||
## Create data dir if not exists
|
||||
if [ ! -d ${DATA_DIR} ]; then
|
||||
if [ ! -d "${DATA_DIR}" ]; then
|
||||
echo "==> Creating data dir..."
|
||||
mkdir -p ${DATA_DIR}
|
||||
mkdir -p "${DATA_DIR}"
|
||||
## Setting up new cluster
|
||||
echo "==> There is no data at all. Creating new cluster"
|
||||
export ETCDCTL_ENDPOINTS="{{ $etcdClientProtocol }}://{{ $etcdFullname }}-0.{{ $etcdHeadlessServiceName }}.{{ .Release.Namespace }}.svc.cluster.local:{{ $clientPort }}"
|
||||
store_member_id &
|
||||
if [ ! -z "$ETCD_ROOT_PASSWORD" ] && [ `hostname -s` == '{{ $etcdFullname }}-0' ]; then
|
||||
if [ -n "${ETCD_ROOT_PASSWORD}" ] && [ "${HOSTNAME}" == "{{ $etcdFullname }}-0" ]; then
|
||||
echo "==> Configuring RBAC authentication!"
|
||||
etcd > /dev/null 2>&1 &
|
||||
ETCD_PID=$!
|
||||
sleep 5
|
||||
echo "$ETCD_ROOT_PASSWORD" | etcdctl user add root
|
||||
echo "${ETCD_ROOT_PASSWORD}" | etcdctl user add root
|
||||
etcdctl auth enable
|
||||
etcdctl ${AUTH_OPTIONS} role revoke guest -path '/*' --readwrite
|
||||
kill $ETCD_PID
|
||||
kill "${ETCD_PID}"
|
||||
sleep 5
|
||||
fi
|
||||
else
|
||||
## Re-joining failed node
|
||||
if [ -d ${DATA_DIR}/member/snap ]; then
|
||||
if [ -d "${DATA_DIR}/member/snap" ]; then
|
||||
echo "==> Data exists. Re-joining etcd member"
|
||||
member_id=$(cat ${DATA_DIR}/member_id)
|
||||
if [ `hostname -s` != '{{ $etcdFullname }}-0' ]; then
|
||||
member_id=$(cat "${DATA_DIR}/member_id")
|
||||
if [ "${HOSTNAME}" != "{{ $etcdFullname }}-0" ]; then
|
||||
echo "==> Updating member in existing cluster."
|
||||
export ETCDCTL_ENDPOINTS="{{ $etcdClientProtocol }}://{{ $etcdFullname }}-0.{{ $etcdHeadlessServiceName }}.{{ .Release.Namespace }}.svc.cluster.local:{{ $clientPort }}"
|
||||
etcdctl ${AUTH_OPTIONS} member update ${member_id} {{ $etcdPeerProtocol }}://`hostname -s`.{{ $etcdHeadlessServiceName }}.{{ .Release.Namespace }}.svc.cluster.local:{{ $peerPort }}
|
||||
@@ -131,7 +131,7 @@ spec:
|
||||
sed -ie 's/^/export /' /bitnami/etcd/data/new_member_envs
|
||||
|
||||
echo "==> Loading env vars of existing cluster"
|
||||
source ${DATA_DIR}/new_member_envs
|
||||
source "${DATA_DIR}/new_member_envs"
|
||||
|
||||
store_member_id &
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user