mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #35783 from wojtek-t/support_rollback
Automatic merge from submit-queue Better logging and support for running non-default version from etcd image Ref #20504
This commit is contained in:
commit
cda55a7847
@ -57,6 +57,12 @@ if [ "${TARGET_STORAGE}" != "etcd2" -a "${TARGET_STORAGE}" != "etcd3" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Correctly support upgrade and rollback to non-default version.
|
||||
if [ "${DO_NOT_MOVE_BINARIES:-}" != "true" ]; then
|
||||
cp "/usr/local/bin/etcd-${TARGET_VERSION}" "/usr/local/bin/etcd"
|
||||
cp "/usr/local/bin/etcdctl-${TARGET_VERSION}" "/usr/local/bin/etcdctl"
|
||||
fi
|
||||
|
||||
# NOTE: SUPPORTED_VERSION has to match release binaries present in the
|
||||
# etcd image (to make this script work correctly).
|
||||
# We cannot use array since sh doesn't support it.
|
||||
@ -156,9 +162,9 @@ for step in ${SUPPORTED_VERSIONS}; do
|
||||
fi
|
||||
# Kill etcd and wait until this is down.
|
||||
stop_etcd
|
||||
CURRENT_VERSION=${step}
|
||||
echo "${CURRENT_VERSION}/${CURRENT_STORAGE}" > "${DATA_DIRECTORY}/${VERSION_FILE}"
|
||||
fi
|
||||
CURRENT_VERSION=${step}
|
||||
echo "${CURRENT_VERSION}/${CURRENT_STORAGE}" > "${DATA_DIRECTORY}/${VERSION_FILE}"
|
||||
if [ "$(echo ${CURRENT_VERSION} | cut -c1-2)" = "3." -a "${CURRENT_STORAGE}" = "etcd2" -a "${TARGET_STORAGE}" = "etcd3" ]; then
|
||||
# If it is the first 3.x release in the list and we are migrating
|
||||
# also from 'etcd2' to 'etcd3', do the migration now.
|
||||
|
@ -37,7 +37,7 @@
|
||||
"command": [
|
||||
"/bin/sh",
|
||||
"-c",
|
||||
"if [ -e /usr/local/bin/migrate-if-needed.sh ]; then /usr/local/bin/migrate-if-needed.sh; fi; /usr/local/bin/etcd --name etcd-{{ hostname }} --listen-peer-urls http://{{ hostname }}:{{ server_port }} --initial-advertise-peer-urls http://{{ hostname }}:{{ server_port }} --advertise-client-urls http://127.0.0.1:{{ port }} --listen-client-urls http://127.0.0.1:{{ port }} --data-dir /var/etcd/data{{ suffix }} --initial-cluster-state {{ cluster_state }} --initial-cluster {{ etcd_cluster }} 1>>/var/log/etcd{{ suffix }}.log 2>&1"
|
||||
"if [ -e /usr/local/bin/migrate-if-needed.sh ]; then /usr/local/bin/migrate-if-needed.sh 1>>/var/log/etcd{{ suffix }}.log 2>&1; fi; /usr/local/bin/etcd --name etcd-{{ hostname }} --listen-peer-urls http://{{ hostname }}:{{ server_port }} --initial-advertise-peer-urls http://{{ hostname }}:{{ server_port }} --advertise-client-urls http://127.0.0.1:{{ port }} --listen-client-urls http://127.0.0.1:{{ port }} --data-dir /var/etcd/data{{ suffix }} --initial-cluster-state {{ cluster_state }} --initial-cluster {{ etcd_cluster }} 1>>/var/log/etcd{{ suffix }}.log 2>&1"
|
||||
],
|
||||
"env": [
|
||||
{ "name": "TARGET_STORAGE",
|
||||
|
@ -165,6 +165,7 @@ TARGET_STORAGE="etcd3" \
|
||||
ETCD=$(which etcd) \
|
||||
ETCDCTL=$(which etcdctl) \
|
||||
ATTACHLEASE="${KUBE_OUTPUT_HOSTBIN}/attachlease" \
|
||||
DO_NOT_MOVE_BINARIES="true" \
|
||||
${KUBE_ROOT}/cluster/images/etcd/migrate-if-needed.sh
|
||||
kube::etcd::start
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user