Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

spec: add PVSource to PodPolicy #1373

Merged
merged 1 commit into from
Sep 8, 2017

Conversation

sgotti
Copy link
Member

@sgotti sgotti commented Aug 29, 2017

As requested by @hongchaodeng here (#1349 (comment)) I opened this PR to discuss only spec changes to add pv support for etcd data.

I wanted to propose to directly use StorageClass in the spec instead of the --pv-provisioner option but I noticed this has been already accepted during my vacations in #1361. So I used it, moving it from spec/backup.go to spec/cluster.go and added PVSource also to PodPolicy.

This patch adds the initial spec changes (without implementation) to
support storing etcd data inside a persistent volume.

The PVSource type used by the backups policy is now shared between
backups and pod policies.

Since this only a spec change the required spec validation isn't part of this patch.

@@ -66,26 +66,15 @@ func (bp *BackupPolicy) Validate() error {
}

type StorageSource struct {
// PV represents a Persistent Volume resource, operator will claim the
// required size before creating the etcd cluster for backup purpose.
Copy link
Member

Choose a reason for hiding this comment

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

for backup purpose .

This is not true after we have PV support for etcd pod.

Copy link
Member Author

Choose a reason for hiding this comment

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

That comment is for StorageSource that is a backupPolicy only option.

Copy link
Member

Choose a reason for hiding this comment

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

ok

@@ -66,26 +66,15 @@ func (bp *BackupPolicy) Validate() error {
}

type StorageSource struct {
// PV represents a Persistent Volume resource, operator will claim the
// required size before creating the etcd cluster for backup purpose.
// If the snapshot size is larger than the size specified, backup fails.
Copy link
Member

Choose a reason for hiding this comment

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

backup fails -> operator would kill the cluster and report failure condition in status.

I guess the right direction is that we would change our ClusterStatus to be more k8s native and add a failure condition, reason for such.

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 just copied and moved the corrent comment from PVSource to StorageSource. Are you asking for some changes in it in this patch?

Copy link
Member

Choose a reason for hiding this comment

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

yes.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah.. Please change it to

operator would kill the cluster and report failure condition in status.

Copy link
Member Author

Choose a reason for hiding this comment

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

@hongchaodeng thanks, updated. It wasn't clear to me if you just wanted to update the comment (I wasn't aware of this behaviour) or you were talking about a future change and how it was related to this patch.

@hongchaodeng
Copy link
Member

hongchaodeng commented Aug 29, 2017

Update: design doc is done in #1374


@sgotti Thanks for doing the work!!!

I'm sorry to forget earlier and mention this late. But we need a design doc for this feature. I want to mention explicitly that it is not meant to obstruct you :)

Basically, we follow k8s upstream process to have design written down: https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-chunking.md

We have much simpler design docs in this repo:
https://github.com/coreos/etcd-operator/blob/master/doc/design/reconciliation.md

We also do design process in multiple internal projects. So it's both open source process and our standard.

What's in the design doc?

Please at least answer these two questions in design docs:

  • How to create and manage (persistent) volumes?
  • How to correlate volumes to etcd pods?

You can assume:

  • No corruption/failure will happen on PV now. Basically to avoid tolerations. We would need to extend the design docs or create another for the problem.

@@ -112,6 +123,10 @@ type ClusterSpec struct {

// etcd cluster TLS configuration
TLS *TLSPolicy `json:"TLS,omitempty"`

// PV represents a Persistent Volume resource.
// If defined new pods will use a persistent volume to store etcd data.
Copy link
Collaborator

Choose a reason for hiding this comment

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

// If defined pods will use a persistent volume to store etcd data.
// When pod/node fails, the replacement pod will try to reuse the existing PV.
// When scale up, ...
// When scale down,

Basically, we probably need to describe the pv claime/cleanup policy a little bit here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Adding a TODO here. this is not supported as it is. We are not very strict about versioning here since etcd operator is not stable yet.

Copy link
Member Author

@sgotti sgotti Aug 30, 2017

Choose a reason for hiding this comment

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

Basically, we probably need to describe the pv claime/cleanup policy a little bit here.

Ok. Perhaps lets wait when the proposal (that talks about these logics) is accepted?

Adding a TODO here. this is not supported as it is. We are not very strict about versioning here since etcd operator is not stable yet.

That's probably the problem on splitting spec and implementation changes. Are you asking to a TODO here and removing in the implementation PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yea. just a simple TODO in the comment. and remove it in the implementation.

@xiang90
Copy link
Collaborator

xiang90 commented Aug 30, 2017

@hongchaodeng @sgotti

I am fine with merging the spec as it is. But, yes, we need to have a design doc along with the implementation. it is easier for other people to understand how things work, and help to debug issues.

@sgotti
Copy link
Member Author

sgotti commented Aug 30, 2017

@hongchaodeng @xiang90 Created the design doc: #1374. While writing it I noticed it was difficult to just put the first part in it because you won't see the final goal and what gains persistent volumes will bring with only that part. So I preferred putting down both parts and all the related notes.

@sgotti sgotti force-pushed the spec_add_pvsource_to_podpolicy branch from 0697663 to e7dd544 Compare September 8, 2017 07:13
@sgotti
Copy link
Member Author

sgotti commented Sep 8, 2017

Updated adding an "unimplemented" TODO. About #1373 (comment) It's unclear to me what comment changes should I do.

@hongchaodeng
Copy link
Member

lgtm after nit

This patch adds the initial spec changes (without implementation) to
support storing etcd data inside a persistent volume.

The PVSource type used by the backups policy is now shared between
backups and pod policies.
@sgotti sgotti force-pushed the spec_add_pvsource_to_podpolicy branch from e7dd544 to 3d69cd3 Compare September 8, 2017 17:43
// PV represents a Persistent Volume resource.
// If defined new pods will use a persistent volume to store etcd data.
// TODO(sgotti) unimplemented
PV *PVSource `json:"pv,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sgotti

one thing to note here, the backup pod also need to respect (or explicitly ignore this) this in the future. right now, it saves intermediate snapshot data onto its container fs.

@xiang90
Copy link
Collaborator

xiang90 commented Sep 8, 2017

lgtm

@hongchaodeng hongchaodeng merged commit d2f4406 into coreos:master Sep 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants