Merge "(etcd) Support dash shell"
This commit is contained in:
commit
3d7ecfd190
|
@ -14,12 +14,14 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
set -x
|
set -x
|
||||||
TEMP_MANIFEST=/tmp/etcd.yaml
|
TEMP_MANIFEST=/tmp/etcd.yaml
|
||||||
function sync_file {
|
|
||||||
|
sync_file () {
|
||||||
if ! cmp "$1" "$2"; then
|
if ! cmp "$1" "$2"; then
|
||||||
cp -f "$1" "$2"
|
cp -f "$1" "$2"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function sync_certificates {
|
|
||||||
|
sync_certificates () {
|
||||||
mkdir -p /etcd-etc/tls
|
mkdir -p /etcd-etc/tls
|
||||||
sync_file /etc/etcd/tls/certs/client-ca.pem /etcd-etc/tls/client-ca.pem
|
sync_file /etc/etcd/tls/certs/client-ca.pem /etcd-etc/tls/client-ca.pem
|
||||||
sync_file /etc/etcd/tls/certs/peer-ca.pem /etcd-etc/tls/peer-ca.pem
|
sync_file /etc/etcd/tls/certs/peer-ca.pem /etcd-etc/tls/peer-ca.pem
|
||||||
|
@ -28,14 +30,16 @@ function sync_certificates {
|
||||||
sync_file "/etc/etcd/tls/keys/${ETCD_NAME}-etcd-client-key.pem" /etcd-etc/tls/etcd-client-key.pem
|
sync_file "/etc/etcd/tls/keys/${ETCD_NAME}-etcd-client-key.pem" /etcd-etc/tls/etcd-client-key.pem
|
||||||
sync_file "/etc/etcd/tls/keys/${ETCD_NAME}-etcd-peer-key.pem" /etcd-etc/tls/etcd-peer-key.pem
|
sync_file "/etc/etcd/tls/keys/${ETCD_NAME}-etcd-peer-key.pem" /etcd-etc/tls/etcd-peer-key.pem
|
||||||
}
|
}
|
||||||
function create_manifest {
|
|
||||||
|
create_manifest () {
|
||||||
WIP=/tmp/wip-manifest.yaml
|
WIP=/tmp/wip-manifest.yaml
|
||||||
cp -f /anchor-etcd/{{ .Values.service.name }}.yaml $WIP
|
cp -f /anchor-etcd/{{ .Values.service.name }}.yaml $WIP
|
||||||
sed -i -e 's#_ETCD_INITIAL_CLUSTER_STATE_#'$2'#g' $WIP
|
sed -i -e 's#_ETCD_INITIAL_CLUSTER_STATE_#'$2'#g' $WIP
|
||||||
sed -i -e 's#_ETCD_INITIAL_CLUSTER_#'$1'#g' $WIP
|
sed -i -e 's#_ETCD_INITIAL_CLUSTER_#'$1'#g' $WIP
|
||||||
mv -f "$WIP" "$3"
|
mv -f "$WIP" "$3"
|
||||||
}
|
}
|
||||||
function sync_configuration {
|
|
||||||
|
sync_configuration () {
|
||||||
sync_certificates
|
sync_certificates
|
||||||
ETCD_INITIAL_CLUSTER=$(grep -v $PEER_ENDPOINT "$1" \
|
ETCD_INITIAL_CLUSTER=$(grep -v $PEER_ENDPOINT "$1" \
|
||||||
| awk -F ', ' '{ print $3 "=" $4 }' \
|
| awk -F ', ' '{ print $3 "=" $4 }' \
|
||||||
|
@ -47,7 +51,7 @@ function sync_configuration {
|
||||||
chmod go-rwx "${MANIFEST_PATH}"
|
chmod go-rwx "${MANIFEST_PATH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup_host {
|
cleanup_host () {
|
||||||
rm -f $MANIFEST_PATH
|
rm -f $MANIFEST_PATH
|
||||||
rm -rf /etcd-etc/tls/
|
rm -rf /etcd-etc/tls/
|
||||||
rm -rf /etcd-data/*
|
rm -rf /etcd-data/*
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
images:
|
images:
|
||||||
tags:
|
tags:
|
||||||
etcd: quay.io/coreos/etcd:v3.2.18
|
etcd: quay.io/coreos/etcd:v3.4.0
|
||||||
etcdctl: quay.io/coreos/etcd:v3.2.18
|
etcdctl: quay.io/coreos/etcd:v3.4.0
|
||||||
pull_policy: "IfNotPresent"
|
pull_policy: "IfNotPresent"
|
||||||
|
|
||||||
labels:
|
labels:
|
||||||
|
|
|
@ -27,14 +27,14 @@ spec:
|
||||||
- |-
|
- |-
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
function external_member_count() {
|
external_member_count () {
|
||||||
etcdctl member list \
|
etcdctl member list \
|
||||||
| grep '\bstarted\b' \
|
| grep '\bstarted\b' \
|
||||||
| grep -Ev "\\b(auxiliary-0|auxiliary-1)\\b" \
|
| grep -Ev "\\b(auxiliary-0|auxiliary-1)\\b" \
|
||||||
| wc -l
|
| wc -l
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_if_possible() {
|
remove_if_possible () {
|
||||||
MEMBER_NAME=$1
|
MEMBER_NAME=$1
|
||||||
MEMBER_ID=$(etcdctl member list | grep "${MEMBER_NAME}" | awk -F ', ' '{ print $1 }')
|
MEMBER_ID=$(etcdctl member list | grep "${MEMBER_NAME}" | awk -F ', ' '{ print $1 }')
|
||||||
if [ -n "${MEMBER_ID}" ]; then
|
if [ -n "${MEMBER_ID}" ]; then
|
||||||
|
|
Loading…
Reference in New Issue