mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
Migrate etcd data using correct etcd version in case of previous crash
This commit is contained in:
parent
e80afed777
commit
1ce544db9e
@ -52,6 +52,8 @@ if [ -z "${DATA_DIRECTORY:-}" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "$(date +'%Y-%m-%d %H:%M:%S') Detecting if migration is needed"
|
||||||
|
|
||||||
if [ "${TARGET_STORAGE}" != "etcd2" -a "${TARGET_STORAGE}" != "etcd3" ]; then
|
if [ "${TARGET_STORAGE}" != "etcd2" -a "${TARGET_STORAGE}" != "etcd3" ]; then
|
||||||
echo "Not supported version of storage: ${TARGET_STORAGE}"
|
echo "Not supported version of storage: ${TARGET_STORAGE}"
|
||||||
exit 1
|
exit 1
|
||||||
@ -187,7 +189,7 @@ for step in ${SUPPORTED_VERSIONS}; do
|
|||||||
CURRENT_VERSION=${step}
|
CURRENT_VERSION=${step}
|
||||||
echo "${CURRENT_VERSION}/${CURRENT_STORAGE}" > "${DATA_DIRECTORY}/${VERSION_FILE}"
|
echo "${CURRENT_VERSION}/${CURRENT_STORAGE}" > "${DATA_DIRECTORY}/${VERSION_FILE}"
|
||||||
fi
|
fi
|
||||||
if [ "$(echo ${CURRENT_VERSION} | cut -c1-2)" = "3." -a "${CURRENT_STORAGE}" = "etcd2" -a "${TARGET_STORAGE}" = "etcd3" ]; then
|
if [ "$(echo ${CURRENT_VERSION} | cut -c1-2)" = "3." -a "${CURRENT_VERSION}" = "${step}" -a "${CURRENT_STORAGE}" = "etcd2" -a "${TARGET_STORAGE}" = "etcd3" ]; then
|
||||||
# If it is the first 3.x release in the list and we are migrating
|
# If it is the first 3.x release in the list and we are migrating
|
||||||
# also from 'etcd2' to 'etcd3', do the migration now.
|
# also from 'etcd2' to 'etcd3', do the migration now.
|
||||||
echo "Performing etcd2 -> etcd3 migration"
|
echo "Performing etcd2 -> etcd3 migration"
|
||||||
@ -241,3 +243,5 @@ if [ "${CURRENT_STORAGE}" = "etcd3" -a "${TARGET_STORAGE}" = "etcd2" ]; then
|
|||||||
CURRENT_VERSION="2.3.7"
|
CURRENT_VERSION="2.3.7"
|
||||||
echo "${CURRENT_VERSION}/${CURRENT_STORAGE}" > "${DATA_DIRECTORY}/${VERSION_FILE}"
|
echo "${CURRENT_VERSION}/${CURRENT_STORAGE}" > "${DATA_DIRECTORY}/${VERSION_FILE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "$(date +'%Y-%m-%d %H:%M:%S') Migration finished"
|
||||||
|
Loading…
Reference in New Issue
Block a user