-
Notifications
You must be signed in to change notification settings - Fork 173
ETCD-704: cluster-restore.sh: move extra /var/lib/etcd files to backup #1628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cf13962
5f56b3a
4b715f1
38bade7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,24 @@ function wait_for_containers_to_stop() { | |
| done | ||
| } | ||
|
|
||
| function backup_remaining_etcd_data_dir_contents() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so where do you call it in the other restore script?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cluster-restore-tnf.sh does not call it yet. After moving member/ to backup, Then it runs etcdctl snapshot restore. Extra files in /var/lib/etcd are cluster-restore.sh is the one that needs an empty dir for the restore pod
Happy to add the same call in cluster-restore-tnf.sh before rm -rf if you |
||
| local entry base extras_dir="${ETCD_DATA_DIR_BACKUP}/extra-data-dir-contents" | ||
|
|
||
| mkdir -p "${extras_dir}" | ||
|
|
||
| shopt -s nullglob dotglob | ||
| for entry in "${ETCD_DATA_DIR}"/*; do | ||
| base=$(basename "${entry}") | ||
| if [ -e "${extras_dir}/${base}" ]; then | ||
| echo "removing previous backup ${extras_dir}/${base}" | ||
| rm -rf "${extras_dir:?}/${base}" | ||
| fi | ||
| echo "Moving ${entry} to ${extras_dir}/" | ||
| mv "${entry}" "${extras_dir}/" | ||
| done | ||
| shopt -u nullglob dotglob | ||
| } | ||
|
|
||
| function mv_static_pods() { | ||
| local containers=("$@") | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Back up leftovers in the
ETCD_ETCDCTL_RESTOREbranch too.Right now the new helper only runs in the restore-pod path. When
ETCD_ETCDCTL_RESTOREis set, Line 120-122 still wipes${ETCD_DATA_DIR}directly, so any remaining top-level files are silently deleted instead of being preserved in backup. That leaves one supported restore mode outside the new contract.Suggested fix
else + backup_remaining_etcd_data_dir_contents echo "removing etcd data dir..." rm -rf "${ETCD_DATA_DIR}" mkdir -p "${ETCD_DATA_DIR}"Also applies to: 120-122
🤖 Prompt for AI Agents