(etcd) Support dash shell
- Rewrite some anchor scripting to support dash - 'function' not supported, refactor POSIX function declarations - Rewrite aux monitor to support dash - Same Change-Id: If44c59be2f30fd30c1a668bc27e58b37575610b5
This commit is contained in:
parent
b3533b8522
commit
6aeab9e490
|
@ -14,12 +14,14 @@
|
|||
# limitations under the License.
|
||||
set -x
|
||||
TEMP_MANIFEST=/tmp/etcd.yaml
|
||||
function sync_file {
|
||||
|
||||
sync_file () {
|
||||
if ! cmp "$1" "$2"; then
|
||||
cp -f "$1" "$2"
|
||||
fi
|
||||
}
|
||||
function sync_certificates {
|
||||
|
||||
sync_certificates () {
|
||||
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/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-peer-key.pem" /etcd-etc/tls/etcd-peer-key.pem
|
||||
}
|
||||
function create_manifest {
|
||||
|
||||
create_manifest () {
|
||||
WIP=/tmp/wip-manifest.yaml
|
||||
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_#'$1'#g' $WIP
|
||||
mv -f "$WIP" "$3"
|
||||
}
|
||||
function sync_configuration {
|
||||
|
||||
sync_configuration () {
|
||||
sync_certificates
|
||||
ETCD_INITIAL_CLUSTER=$(grep -v $PEER_ENDPOINT "$1" \
|
||||
| awk -F ', ' '{ print $3 "=" $4 }' \
|
||||
|
@ -47,7 +51,7 @@ function sync_configuration {
|
|||
chmod go-rwx "${MANIFEST_PATH}"
|
||||
}
|
||||
|
||||
function cleanup_host {
|
||||
cleanup_host () {
|
||||
rm -f $MANIFEST_PATH
|
||||
rm -rf /etcd-etc/tls/
|
||||
rm -rf /etcd-data/*
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
images:
|
||||
tags:
|
||||
etcd: quay.io/coreos/etcd:v3.2.18
|
||||
etcdctl: quay.io/coreos/etcd:v3.2.18
|
||||
etcd: quay.io/coreos/etcd:v3.4.0
|
||||
etcdctl: quay.io/coreos/etcd:v3.4.0
|
||||
pull_policy: "IfNotPresent"
|
||||
|
||||
labels:
|
||||
|
|
|
@ -27,14 +27,14 @@ spec:
|
|||
- |-
|
||||
set -x
|
||||
|
||||
function external_member_count() {
|
||||
external_member_count () {
|
||||
etcdctl member list \
|
||||
| grep '\bstarted\b' \
|
||||
| grep -Ev "\\b(auxiliary-0|auxiliary-1)\\b" \
|
||||
| wc -l
|
||||
}
|
||||
|
||||
function remove_if_possible() {
|
||||
remove_if_possible () {
|
||||
MEMBER_NAME=$1
|
||||
MEMBER_ID=$(etcdctl member list | grep "${MEMBER_NAME}" | awk -F ', ' '{ print $1 }')
|
||||
if [ -n "${MEMBER_ID}" ]; then
|
||||
|
|
Loading…
Reference in New Issue