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 EtcdRestore #137

Closed
wants to merge 17 commits into from

Conversation

JamesLaverack
Copy link
Contributor

I just squash rebased this down to a single commit, rather than keep the incredibly messy history.

Using the latest (v0.18.0) of go-cloud causes an import issue with an
ambigious import. That version isn't required, so we use v0.17.0
instead.
@JamesLaverack JamesLaverack requested review from munnerz and removed request for adamhosier January 20, 2020 13:09
Copy link
Contributor

@wallrj wallrj left a comment

Choose a reason for hiding this comment

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

Thanks @JamesLaverack

That's a lot of new code and I probably haven't digested it all yet.
I spotted one or two typos and made a few suggestions, but I'd be happy for you to merge this and improve upon it in followup branches.

api/v1alpha1/bucketcredentials.go Outdated Show resolved Hide resolved
api/v1alpha1/etcdrestore_types.go Outdated Show resolved Hide resolved
// should use a URL scheme of the bucket provider. For example `s3://my-amazon-bucket` or
// `gs://my-google-cloud-bucket`.
// +kubebuilder:validation:MinLength=3
// +kubebuilder:validation:MaxLength=222
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this comes from https://cloud.google.com/storage/docs/naming. Maybe add that link 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.

It is, but on reflection I'm tempted to remove the validation as I can't assume this will hold true of all bucket systems that go-cloud supports.

api/v1alpha1/etcdrestore_types.go Outdated Show resolved Hide resolved
api/v1alpha1/etcdrestore_types.go Outdated Show resolved Hide resolved
controllers/etcdrestore_controller.go Show resolved Hide resolved
controllers/etcdrestore_controller.go Outdated Show resolved Hide resolved
controllers/etcdrestore_controller.go Outdated Show resolved Hide resolved
ObjectMeta: metav1.ObjectMeta{
Name: restorePodName(peer),
Namespace: restore.Namespace,
OwnerReferences: []metav1.OwnerReference{*metav1.NewControllerRef(&restore, etcdv1alpha1.GroupVersion.WithKind("EtcdRestore"))},
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using controller-runtime controllerutil.SetControllerReference instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we pull this out into a later issue? If we change how we set owner references it'd like to do it everywhere at once (e.g., the cluster controller creating EtcdPeers, the peer controller creating EtcdClusters).

Because SetControllerReference can return an error, I'd also have to change all of the functions that create these resources to return an error too and implemented the associated handling code.

controllers/etcdrestore_controller.go Outdated Show resolved Hide resolved
@JamesLaverack
Copy link
Contributor Author

Parking this for now, will re-open as part of #146

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants