Skip to content
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

Bug 1810469: The disaster recovery scripts need simplification #220

Merged

Conversation

retroflexer
Copy link
Contributor

@retroflexer retroflexer commented Feb 28, 2020

With the introduction of cluster-etcd-operator, much of the functionality in the old scripts is no longer needed. Therefore the scripts needed to be trimmed down and simplified. This PR attempts to achieve that goal.

@openshift-ci-robot openshift-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 28, 2020
@retroflexer retroflexer changed the title Scripts simplification [wip]: Scripts simplification Feb 28, 2020
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 28, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 2, 2020
echo 'Path to the directory containing backup files is required: ./etcd-snapshot-restore.sh <path-to-backup>'
exit 1
function usage {
echo 'Path to the directory containing backup files is required: ./etcd-snapshot-restore.sh <path-to-backup>'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't descriptive enough for me. What content is expected here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, our current backup is expected to be in a directory containing two components:

  1. etcd snapshot
  2. Bundle of Static POD resources (which includes kube-apiserver's static pod resources, that may include encryption key)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, our current backup is expected to be in a directory containing two components:

  1. etcd snapshot
  2. Bundle of Static POD resources (which includes kube-apiserver's static pod resources, that may include encryption key)

don't tell me, write in the usage for everyone :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to the usage.

@retroflexer retroflexer force-pushed the scripts-simplification branch 2 times, most recently from 253a5f1 to 1c67ced Compare March 2, 2020 15:02
@retroflexer
Copy link
Contributor Author

retroflexer commented Mar 2, 2020

Currently, the scripts assume that the following variables come from etcd.env file:

${ASSET_DIR}
${CONFIG_FILE_DIR}
${ETCD_DATA_DIR_BACKUP}
${MANIFEST_DIR}
${MANIFEST_STOPPED_DIR}
${RESTORE_ETCD_POD_YAML}
${STATIC_POD}

and ${IMAGE} for downloading the etcdctl binary.

@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 2, 2020
@retroflexer retroflexer changed the title [wip]: Scripts simplification Scripts simplification Mar 4, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 4, 2020
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Mar 5, 2020
echo "etcd snapshot ${SNAPSHOT_FILE} does not exist."
exit 1
fi

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity, why do we not care to check if BACKUP_FILE is not empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well. We didn't have the size check in the past scripts :-). I was just trying to simplify the existing scripts.



# Restore static pod resources
tar -C ${CONFIG_FILE_DIR} -xzf ${BACKUP_FILE} static-pod-resources
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again just curious: should moving kube static pod be after etcd is moved few lines below?

That way when kube-apiserver is started it will have an etcd to talk to, or we have made an effort for etcd to exist :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can move it below. In the older scripts, we stopped kubelet, and restarted kubelet at the end. But based on David's comments, we let the kubelet be dirty.

@retroflexer
Copy link
Contributor Author

/retest

1 similar comment
@hexfusion
Copy link
Contributor

/retest

@retroflexer
Copy link
Contributor Author

/test e2e-gcp

@retroflexer retroflexer closed this Mar 5, 2020
@retroflexer retroflexer reopened this Mar 5, 2020
@openshift-ci-robot
Copy link

@retroflexer: This pull request references Bugzilla bug 1810469, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1810469: The disaster recovery scripts need simplification

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@retroflexer
Copy link
Contributor Author

/retest

2 similar comments
@hexfusion
Copy link
Contributor

/retest

@retroflexer
Copy link
Contributor Author

/retest

@hexfusion
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 6, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hexfusion, retroflexer

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@hexfusion
Copy link
Contributor

/retest

1 similar comment
@retroflexer
Copy link
Contributor Author

/retest

@openshift-ci-robot
Copy link

@retroflexer: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-azure 0531dc4 link /test e2e-azure

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@hexfusion
Copy link
Contributor

/cherrypick release-4.4

@openshift-cherrypick-robot

@hexfusion: once the present PR merges, I will cherry-pick it on top of release-4.4 in a new PR and assign it to you.

In response to this:

/cherrypick release-4.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-merge-robot openshift-merge-robot merged commit 173b86c into openshift:master Mar 6, 2020
@openshift-ci-robot
Copy link

@retroflexer: All pull requests linked via external trackers have merged. Bugzilla bug 1810469 has been moved to the MODIFIED state.

In response to this:

Bug 1810469: The disaster recovery scripts need simplification

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-cherrypick-robot

@hexfusion: #220 failed to apply on top of branch "release-4.4":

.git/rebase-apply/patch:287: trailing whitespace.
# ./etcd-snapshot-restore.sh $path-to-backup 
.git/rebase-apply/patch:1575: trailing whitespace.
# ./etcd-snapshot-restore.sh $path-to-backup 
warning: 2 lines add whitespace errors.
Using index info to reconstruct a base tree...
M	bindata/etcd/openshift-recovery-tools
A	pkg/etcdenvvar/envvarcontroller.go
A	pkg/etcdenvvar/etcd_env.go
M	pkg/operator/etcd_assets/bindata.go
M	pkg/operator/scriptcontroller/scriptcontroller.go
M	pkg/operator/starter.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/operator/targetconfigcontroller/etcd_env.go
Auto-merging pkg/operator/starter.go
CONFLICT (content): Merge conflict in pkg/operator/starter.go
Auto-merging pkg/operator/scriptcontroller/scriptcontroller.go
Auto-merging pkg/operator/etcd_assets/bindata.go
CONFLICT (content): Merge conflict in pkg/operator/etcd_assets/bindata.go
CONFLICT (modify/delete): pkg/etcdenvvar/envvarcontroller.go deleted in HEAD and modified in Simplify the disaster recovery scripts. Version Simplify the disaster recovery scripts of pkg/etcdenvvar/envvarcontroller.go left in tree.
CONFLICT (modify/delete): bindata/etcd/openshift-recovery-tools deleted in Simplify the disaster recovery scripts and modified in HEAD. Version HEAD of bindata/etcd/openshift-recovery-tools left in tree.
Removing bindata/etcd/etcd-restore-backup.sh
error: Failed to merge in the changes.
Patch failed at 0001 Simplify the disaster recovery scripts

In response to this:

/cherrypick release-4.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants