-
Notifications
You must be signed in to change notification settings - Fork 39k
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
Support events in restore script #35784
Support events in restore script #35784
Conversation
# Make it possible to overwrite version file (or default version) | ||
# with VERSION_CONTENTS env var. | ||
if [ ! -z "${VERSION_CONTENTS:-}" ]; then | ||
echo "${VERSION_CONTENTS}" > "${VERSION_FILE}" |
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.
will this fail if version.txt already exists?
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.
No. Should it?
@@ -205,6 +212,13 @@ mv /var/etcd/data "${MNT_DISK}/var/etcd-corrupted" | |||
# Replace the corrupted data dir with the resotred data. | |||
mv "${BACKUP_DIR}" /var/etcd/data | |||
|
|||
if [ "${RESTORE_EVENT_ETCD:-}" == "true" ]; then |
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.
since this doesn't restore, it just resets, maybe we could name this RESET_EVENT_ETCD
or something that is more closely aligned with the effect.
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.
done
|
||
# Make it possible to overwrite version file (or default version) | ||
# with VERSION_CONTENTS env var. | ||
if [ ! -z "${VERSION_CONTENTS:-}" ]; then |
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.
Might just be me, but I find if [ -n "$blah" ]; then
more idiomatic.
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.
done
# with VERSION_CONTENTS env var. | ||
if [ ! -z "${VERSION_CONTENTS:-}" ]; then | ||
echo "${VERSION_CONTENTS}" > "${VERSION_FILE}" | ||
echo "TARGET_STORAGE variable unset - skipping migration" |
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.
Why this message? We haven't even checked TARGET_STORAGE
.
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.
Copy-paster error.
@@ -205,6 +212,13 @@ mv /var/etcd/data "${MNT_DISK}/var/etcd-corrupted" | |||
# Replace the corrupted data dir with the resotred data. | |||
mv "${BACKUP_DIR}" /var/etcd/data | |||
|
|||
if [ "${RESTORE_EVENT_ETCD:-}" == "true" ]; then | |||
# Save the corrupted data (clean directory if it is already non-empty). | |||
rm -rf "${MNT_DISK}/var/etcd-events-corrupted" |
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.
Maybe put this directory name in a variable, since we repeat it three times.
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.
done
54babbd
to
7fe1e06
Compare
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.
PTAL
|
||
# Make it possible to overwrite version file (or default version) | ||
# with VERSION_CONTENTS env var. | ||
if [ ! -z "${VERSION_CONTENTS:-}" ]; then |
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.
done
# with VERSION_CONTENTS env var. | ||
if [ ! -z "${VERSION_CONTENTS:-}" ]; then | ||
echo "${VERSION_CONTENTS}" > "${VERSION_FILE}" | ||
echo "TARGET_STORAGE variable unset - skipping migration" |
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.
Copy-paster error.
@@ -205,6 +212,13 @@ mv /var/etcd/data "${MNT_DISK}/var/etcd-corrupted" | |||
# Replace the corrupted data dir with the resotred data. | |||
mv "${BACKUP_DIR}" /var/etcd/data | |||
|
|||
if [ "${RESTORE_EVENT_ETCD:-}" == "true" ]; then | |||
# Save the corrupted data (clean directory if it is already non-empty). | |||
rm -rf "${MNT_DISK}/var/etcd-events-corrupted" |
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.
done
@@ -205,6 +212,13 @@ mv /var/etcd/data "${MNT_DISK}/var/etcd-corrupted" | |||
# Replace the corrupted data dir with the resotred data. | |||
mv "${BACKUP_DIR}" /var/etcd/data | |||
|
|||
if [ "${RESTORE_EVENT_ETCD:-}" == "true" ]; then |
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.
done
Jenkins GCI GKE smoke e2e failed for commit 7fe1e06. Full PR test history. The magic incantation to run this job again is |
LGTM, but it looks like @roberthbailey still has one outstanding question. |
Talked with @roberthbailey offline and discussed his comment. He agreed that what is now is ok. So applying lgtm label. |
lgtm |
Automatic merge from submit-queue |
Ref #20504
This change is![Reviewable](https://camo.githubusercontent.com/2d899f4291d07d3cd2fa4aaae1e3b243f164c23fce87d30a589ace0d496a444c/68747470733a2f2f72657669657761626c652e6b756265726e657465732e696f2f7265766965775f627574746f6e2e737667)