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

Modify 'restore-from-backup.sh' to work in multinode etcd cluster. #56692

Merged
merged 1 commit into from Dec 7, 2017

Conversation

mborsz
Copy link
Member

@mborsz mborsz commented Dec 1, 2017

What this PR does / why we need it:
This PR modifies cluster/restore-from-backup.sh to work in multinode etcd cluster.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 1, 2017
@@ -101,7 +104,7 @@ wait_for_cluster_healthy() {
# Wait until etcd and apiserver pods are down.
wait_for_etcd_and_apiserver_down() {
for i in $(seq 120); do
etcd=$(docker ps | grep etcd | grep -v etcd-empty-dir | grep -v etcd-monitor | wc -l)
etcd=$(docker ps | grep -e etcd-server-gke -e etcd-server-events-gke | wc -l)
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like it's making the script gke specific. If it only works on GKE, why have it in the k/k repository?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah. Initially this script was supposed to be generic, but over time it appeared some GKE/GCE-specific things may be needed. But when I'm looking into it now, maybe that's the only one.

Maybe add a TODO to make it work for all platforms.

Copy link
Member Author

Choose a reason for hiding this comment

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

The reason for the change is that it doesn't work in GKE right now: there is a plenty of containers with etcd in name (not only etcd-empty-dir, etcd-monitor) and this waits forever.

Will try to solve this issue in some other way.

@wojtek-t wojtek-t assigned wojtek-t and unassigned mikedanese Dec 7, 2017
if [ "$?" -ne "0" ]; then
echo "Docker container didn't started correctly"
exit 1
fi
echo "Prepare container exit code: $(docker wait ${image})"
Copy link
Member

Choose a reason for hiding this comment

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

Why do you remove this one?

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed '-d' from docker run so that stdout/stderr goes directly to console. It's a way easier to see if it worked and debug if it failed.

So 'docker wait' is not longer needed (if command fails, the if above will catch it)

@mborsz
Copy link
Member Author

mborsz commented Dec 7, 2017

PTAL

@@ -101,7 +104,7 @@ wait_for_cluster_healthy() {
# Wait until etcd and apiserver pods are down.
wait_for_etcd_and_apiserver_down() {
for i in $(seq 120); do
etcd=$(docker ps | grep etcd | grep -v etcd-empty-dir | grep -v etcd-monitor | wc -l)
etcd=$(docker ps | grep -e etcd-server -e etcd-server-events | wc -l)
Copy link
Member

Choose a reason for hiding this comment

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

Is the "-e etcd-server-events" needed?

I think that "-e etcd-server" already matches "etcd-server-events", right?

@roberthbailey - this naming is consistent with what is in cluster/saltbase/salt/manifest, so I don't think it's GKE/GKE-specific now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm.. Good point -- in fact etcd-server-events is not needed.

@wojtek-t
Copy link
Member

wojtek-t commented Dec 7, 2017

/lgtm
/approve no-issue

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 7, 2017
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mborsz, wojtek-t

Associated issue requirement bypassed by: wojtek-t

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 7, 2017
@wojtek-t wojtek-t added status/approved-for-milestone priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. and removed priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. status/approved-for-milestone labels Dec 7, 2017
@wojtek-t wojtek-t added this to the v1.9 milestone Dec 7, 2017
@wojtek-t wojtek-t added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. status/approved-for-milestone labels Dec 7, 2017
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

[MILESTONENOTIFIER] Milestone Pull Request Labels Incomplete

@mborsz @roberthbailey @wojtek-t

Action required: This pull request requires label changes.

kind: Must specify exactly one of kind/bug, kind/cleanup or kind/feature.
sig owner: Must specify at least one label prefixed with sig/.

Help

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 1fcbbd3 into kubernetes:master Dec 7, 2017
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. milestone/incomplete-labels priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants