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

Implement etcd-backup-restore on OSS of Alicloud #108

Merged
merged 1 commit into from
Feb 16, 2019

Conversation

minchaow
Copy link
Contributor

@minchaow minchaow commented Feb 1, 2019

What this PR does / why we need it:
Implement function of backing up and restoring etcd on OSS of Alicloud

Special notes for your reviewer:

  1. When running "make verify", there was one failure testing case as follow:

• Failure [2.036 seconds]
Defrag Defragmentation [It] should defragment and reduce size of DB within time
/Workspace/go/src/github.com/gardener/etcd-backup-restore/pkg/etcdutil/defrag_test.go:53

Expected
: 258048
to be <
: 258048

/Workspace/go/src/github.com/gardener/etcd-backup-restore/pkg/etcdutil/defrag_test.go:69

Full Stack Trace
/Workspace/go/src/github.com/gardener/etcd-backup-restore/vendor/github.com/onsi/gomega/internal/assertion/assertion.go:75 +0x305
github.com/gardener/etcd-backup-restore/vendor/github.com/onsi/gomega/internal/assertion.(*Assertion).Should(0xc000938400, 0x1801ea0, 0xc0006fa570, 0x0, 0x0, 0x0, 0x1)
/Workspace/go/src/github.com/gardener/etcd-backup-restore/vendor/github.com/onsi/gomega/internal/assertion/assertion.go:28 +0x11f
github.com/gardener/etcd-backup-restore/pkg/etcdutil.glob..func1.1.2()
/Workspace/go/src/github.com/gardener/etcd-backup-restore/pkg/etcdutil/defrag_test.go:69 +0xc72
github.com/gardener/etcd-backup-restore/vendor/github.com/onsi/ginkgo/internal/leafnodes.(*runner).runSync(0xc0002f0060, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/Workspace/go/src/github.com/gardener/etcd-backup-restore/pkg/etcdutil/etcdutil_suite_test.go:42 +0xf7
testing.tRunner(0xc0001f4500, 0x164df60)
/usr/local/go/src/testing/testing.go:827 +0x163
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:878 +0x65a


However, when I ran on the latest master branch without my change, the same error was still happened. So it is confused me if it is my code causes this error.

  1. The implement needs 3rd part SDK, so I appended the dependency into [[constraint]] in the Gopkg.toml. When running "make revendor", not only aliyun SDK was added, but also some other dependencies were updated, which cause one problem as follow when to run "make verify":

panic: codecgen version mismatch: current: 8, need 10. Re-generate file: /Workspace/go/src/github.com/gardener/etcd-backup-restore/vendor/github.com/coreos/etcd/client/keys.generated.go

goroutine 1 [running]:
github.com/gardener/etcd-backup-restore/vendor/github.com/coreos/etcd/client.init.0()
/Workspace/go/src/github.com/gardener/etcd-backup-restore/vendor/github.com/coreos/etcd/client/keys.generated.go:45 +0x144

Ginkgo ran 1 suite in 4.835755187s
Test Suite Failed
Makefile:61: recipe for target 'test' failed
make: *** [test] Error 1

The same error was also happened when running on the latest master branch.

Release note:

Add new cloud provider OSS (Alibaba Object Storage Service) support for etcd-backup-restore

@swapnilgm
Copy link
Contributor

@minchaow Thank you for the PR. We will review it soon.

Regarding test cases:
All tests for master and recent PR are passing in CI/CD pipeline and locally on my machine as well. So there shouldn't be any issue.

Anyways, looking at

Defrag Defragmentation [It] should defragment and reduce size of DB within time
/Workspace/go/src/github.com/gardener/etcd-backup-restore/pkg/etcdutil/defrag_test.go:53``

It looks like DB defragmentation ran on already defragmented etcd. By any chance, any other process calling defragmentation on etcd? I'm not able to reproduce it on master.
Just for safer side, try to run the test in docker container. You can use something like below:

docker run --rm -it \
    -v ${PWD}:/master-version \
   -e GOPATH="/go" \
   -w /master-version golang bash -c "make verify"

The implement needs 3rd part SDK, so I appended the dependency into [[constraint]] in the Gopkg.toml. When running "make revendor", not only aliyun SDK was added, but also some other dependencies were updated, which cause one problem as follow when to run "make verify":

This issue is similar to etcd-io/etcd#8715 . Might have been triggered due to later release of go-codec library 1.1.2.
Till upstream fixes this, do the following.
Please add following line to Gopkg.toml at the end and run make revendor again. Make sure that Gopkg.lock reflects the codec version in use as 1.1.1.

[[override]]
name = "github.com/ugorji/go"
revision = "b4c50a2b199d93b13dc15e78929cfb23bfdf21ab"

@swapnilgm swapnilgm added kind/enhancement Enhancement, improvement, extension needs/changes Needs (more) changes needs/review Needs review component/etcd-backup-restore ETCD Backup & Restore exp/intermediate Issue that requires some project experience area/backup Backup related needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Feb 1, 2019
Copy link
Contributor

@swapnilgm swapnilgm left a comment

Choose a reason for hiding this comment

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

Just skimmed thought it, will review it again. As suggested in previous comment please do the revendoring. Also, add the license details for SDK in https://github.com/gardener/etcd-backup-restore/blob/master/LICENSE.md#subcomponents.

pkg/snapstore/oss_snapstore.go Outdated Show resolved Hide resolved
pkg/snapstore/oss_snapstore_test.go Outdated Show resolved Hide resolved
@minchaow
Copy link
Contributor Author

minchaow commented Feb 1, 2019

@minchaow Thank you for the PR. We will review it soon.

Regarding test cases:
All tests for master and recent PR are passing in CI/CD pipeline and locally on my machine as well. So there shouldn't be any issue.

Anyways, looking at

Defrag Defragmentation [It] should defragment and reduce size of DB within time
/Workspace/go/src/github.com/gardener/etcd-backup-restore/pkg/etcdutil/defrag_test.go:53``

It looks like DB defragmentation ran on already defragmented etcd. By any chance, any other process calling defragmentation on etcd? I'm not able to reproduce it on master.
Just for safer side, try to run the test in docker container. You can use something like below:

docker run --rm -it \
    -v ${PWD}:/master-version \
   -e GOPATH="/go" \
   -w /master-version golang bash -c "make verify"

The implement needs 3rd part SDK, so I appended the dependency into [[constraint]] in the Gopkg.toml. When running "make revendor", not only aliyun SDK was added, but also some other dependencies were updated, which cause one problem as follow when to run "make verify":

This issue is similar to etcd-io/etcd#8715 . Might have been triggered due to later release of go-codec library 1.1.2.
Till upstream fixes this, do the following.
Please add following line to Gopkg.toml at the end and run make revendor again. Make sure that Gopkg.lock reflects the codec version in use as 1.1.1.

[[override]]
name = "github.com/ugorji/go"
revision = "b4c50a2b199d93b13dc15e78929cfb23bfdf21ab"

@swapnilgm Thank you very much. I will modify my code asap and run the UT cases again according to your suggestion.

Best regards!

@minchaow
Copy link
Contributor Author

@swapnilgm , thanks for your suggestions very much. UT has passed when running inside the container, and the workaround for my second issue is workable as well.
Also, I have changed my code according to your review comments and added license information.

@minchaow
Copy link
Contributor Author

@swapnilgm, this PR is important for enabling gardener on alicloud, so could you please help review the code, the sooner the better, many thanks for you help! :)

@swapnilgm
Copy link
Contributor

@minchaow Thanks for addressing the changes. I can understand the importance of the PR. We will review it soon.

@swapnilgm swapnilgm removed the needs/changes Needs (more) changes label Feb 12, 2019
@swapnilgm
Copy link
Contributor

@shreyas-s-rao Please review the PR.
@minchaow We don't have access to Alicloud, so we can just theoretically review the PR and can't test it with actual OSS. If required, Shreyas might get back to you over slack or mail to check the demo with actual deployment.

@swapnilgm
Copy link
Contributor

Sorry my bad. Just received the access to AliCloud.

@minchaow
Copy link
Contributor Author

Hi @shreyas-s-rao, code has changed according to suggestions, please help review again. Thanks a lot.

@shreyas-s-rao
Copy link
Collaborator

@minchaow After running make revendor, push the code along with all the new files that are added to the vendor directory, so that the OSS SDK gets added in-tree.

Copy link
Collaborator

@shreyas-s-rao shreyas-s-rao left a comment

Choose a reason for hiding this comment

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

@minchaow Thank you very much for the well-written PR! I have reviewed your PR, and have suggested a few changes in your code. Please address them. Other than those, there are few changes you will have to make in the documentation and code comments to include information about "OSS" as a new snapstore provider:

  • README.md: line 118
  • README.md: Under Cloud Provider Credentials, add a line about the env variable details for OSS
  • .github/ISSUE_TEMPLATE/bug_report.md: line 26
  • pkg/snapstore/types.go: line 23
  • chart/values.yaml: line 26

Also, once you run make revendor, commit the changes along with the vendored files. It's fine if other files are added/modified in the vendor directory, as Godep has a method to resolve dependencies, and a few vendor files will get changed here and there. Not an issue.
Run make revendor in your normal dev env, so that github.com/gardener doesn't get added as a vendor package.

pkg/snapstore/oss_snapstore.go Show resolved Hide resolved
pkg/snapstore/oss_snapstore_test.go Show resolved Hide resolved
pkg/snapstore/oss_snapstore_test.go Outdated Show resolved Hide resolved
pkg/snapstore/snapstore_test.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@shreyas-s-rao shreyas-s-rao left a comment

Choose a reason for hiding this comment

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

@minchaow Just a few more suggestions for changes. Kindly address them. Thanks.

pkg/snapstore/oss_snapstore_test.go Show resolved Hide resolved
pkg/snapstore/oss_snapstore_test.go Show resolved Hide resolved
pkg/snapstore/oss_snapstore_test.go Show resolved Hide resolved
pkg/snapstore/oss_snapstore_test.go Show resolved Hide resolved
pkg/snapstore/oss_snapstore_test.go Show resolved Hide resolved
pkg/snapstore/oss_snapstore_test.go Show resolved Hide resolved
@shreyas-s-rao shreyas-s-rao added needs/rebase Needs git rebase needs/changes Needs (more) changes and removed needs/review Needs review labels Feb 15, 2019
@swapnilgm swapnilgm added this to the 0.5.0 milestone Feb 15, 2019
@minchaow
Copy link
Contributor Author

@swapnilgm, @shreyas-s-rao, comments addressed, and changes pushed. Please help review. Thanks.

Copy link
Collaborator

@shreyas-s-rao shreyas-s-rao left a comment

Choose a reason for hiding this comment

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

@minchaow Thank you for addressing my review comments and making the changes! I have just a couple of comments on the new code you added. Please address them. Thanks.

pkg/snapstore/oss_snapstore_test.go Outdated Show resolved Hide resolved
pkg/snapstore/oss_snapstore_test.go Outdated Show resolved Hide resolved
pkg/snapstore/oss_snapstore_test.go Outdated Show resolved Hide resolved
@minchaow minchaow force-pushed the alicloud branch 2 times, most recently from 863bad7 to d0dfa85 Compare February 15, 2019 15:22
@minchaow
Copy link
Contributor Author

@shreyas-s-rao, comments addressed, and the commit pushed.

Copy link
Collaborator

@shreyas-s-rao shreyas-s-rao left a comment

Choose a reason for hiding this comment

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

@minchaow Thanks for addressing my comments. I have just one last change. I caught it only now when running the tests multiple times, so I wasn't able to suggest this change in the previous reviews. Sorry for the trouble. 😅

pkg/snapstore/oss_snapstore_test.go Show resolved Hide resolved
@minchaow
Copy link
Contributor Author

@shreyas-s-rao, comments addressed. Thanks for your so careful review! 👍 😄

Copy link
Collaborator

@shreyas-s-rao shreyas-s-rao left a comment

Choose a reason for hiding this comment

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

@minchaow Thanks so much for addressing all the comments. LGTM! 👍🏼

@shreyas-s-rao shreyas-s-rao added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed needs/changes Needs (more) changes needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) needs/rebase Needs git rebase labels Feb 15, 2019
@gardener-robot-ci-1 gardener-robot-ci-1 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Feb 15, 2019
@shreyas-s-rao shreyas-s-rao added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Feb 15, 2019
@gardener-robot-ci-1 gardener-robot-ci-1 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Feb 16, 2019
@shreyas-s-rao shreyas-s-rao merged commit 030a6c9 into gardener:master Feb 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backup Backup related component/etcd-backup-restore ETCD Backup & Restore exp/intermediate Issue that requires some project experience kind/enhancement Enhancement, improvement, extension needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants