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

Add flocker volume plugin #14328

Merged
merged 1 commit into from
Oct 2, 2015
Merged

Add flocker volume plugin #14328

merged 1 commit into from
Oct 2, 2015

Conversation

agonzalezro
Copy link
Contributor

Flocker [1] is an open-source container data volume manager for
Dockerized applications.

This PR adds a volume plugin for Flocker.
The plugin interfaces the Flocker Control Service REST API [2] to
request volume creation and attachment.

Each kubelet host should run Flocker agents (Container Agent and Dataset
Agent).

The kubelet will also require environment variables that contain the
host and port of the Flocker Control Service. (see Flocker architecture
[3] for more).

  • FLOCKER_CONTROL_SERVICE_HOST
  • FLOCKER_CONTROL_SERVICE_PORT

The contribution introduces a new 'flocker' volume type to the API with
fields:

  • datasetName: which indicates the name of the dataset in Flocker
    added to metadata;
  • size: a human-readable number that indicates the maximum size of the
    requested dataset.

Full documentation (including getting started guides) and e2e tests to
follow.

As the plugin is code complete, we're hoping to make version 1.1.

[1] https://clusterhq.com/flocker/introduction/
[2] https://docs.clusterhq.com/en/1.3.1/reference/api.html
[3] https://docs.clusterhq.com/en/1.3.1/concepts/architecture.html

@k8s-bot
Copy link

k8s-bot commented Sep 22, 2015

Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist")

If this message is too spammy, please complain to ixdy.

@timothysc
Copy link
Member

cc @rootfs @markturansky - just FYI | review.

@agonzalezro agonzalezro force-pushed the flocker branch 2 times, most recently from 173fbc2 to c231341 Compare September 22, 2015 01:23
@k8s-github-robot k8s-github-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 22, 2015
@k8s-github-robot
Copy link

Labelling this PR as size/XXL

}

func (p flockerPlugin) CanSupport(spec *volume.Spec) bool {
return (spec.PersistentVolume != nil && spec.PersistentVolume.Spec.Flocker != nil) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

You can just return spec.Volume != nil && spec.Volume.Flocker != nil

This plugin is not a Persistent Volume, so you can ignore that part of the CanSupport check.

Copy link
Contributor

Choose a reason for hiding this comment

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

nm :) I overlooked Flocker in the PVVolumeSource struct. Your check above is correct.

@thockin
Copy link
Member

thockin commented Sep 22, 2015

You guys are cutting this close...

@@ -306,6 +309,8 @@ type PersistentVolumeSource struct {
CephFS *CephFSVolumeSource `json:"cephfs,omitempty"`
// FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.
FC *FCVolumeSource `json:"fc,omitempty"`
// Flocker represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage
Copy link
Member

Choose a reason for hiding this comment

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

Please also document that this depends on the flocker control plane being running.

@thockin
Copy link
Member

thockin commented Sep 22, 2015

I took a quick look, nothing major jumped out. I'll leave it to Mark and Saad to pick the details.

What this is missing most is a good doc explaining how to use it, including the bits about env variables in the first comment.

// otherwise it return the default value provided.
//
// Note: it should be GetEnv but I tried to keep the os.Getenv standard.
func GetenvOrFallback(key, defaultValue string) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

getenvOrFallback?

@rootfs
Copy link
Contributor

rootfs commented Sep 22, 2015

@agonzalezro Is flocker volume dependent on any docker release? Does it support rkt? Can you provide a working Pod and running environment in a doc?

return &builder, nil
}

func (p *flockerPlugin) NewCleaner(datasetName string, podUID types.UID) (volume.Cleaner, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

you don't want to delete the volume?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea of Flocker is that you can move it between pods. I don't see at this stage any need for removing volume. Flocker agent will mount/dismount it when needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

But when the volume is moved between pods and between hosts, don't you want to clean up the orphaned directory on the old host?

Choose a reason for hiding this comment

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

Not in this case, no. If and when the same dataset is requested elsewhere (by datasetName in the volume spec), the Flocker agent will umount/detach and reattach/mount the volume. If a volume is not required, at this stage it is a manual operation to destroy it. Hope that helps explain.

Copy link
Member

Choose a reason for hiding this comment

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

This makes me wonder if there is any utility in using Flocker as a PV, since the semantics seem intrinsic to how the Flocker agent handles volumes.

@agonzalezro
Copy link
Contributor Author

@rootfs Flocker is not docker/rkt dependent. We are working in documentation for it. cc: @mattbates

DatasetName string `json:"datasetName"`

// Optional: the size of the volume in human readable format.
Size string `json:"size"`
Copy link
Member

Choose a reason for hiding this comment

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

Please use resource.Quantity as this type. (Find other usages elsewhere in this file.)

Meta: it seems odd to specify a size here. Other volumes (including persistent volumes) don't specify a size. Why is this volume different?

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right that the volume itself does not require this information.

It's irrelevant to a Volume and size is already an attribute of PV.Spec.

Copy link
Member

Choose a reason for hiding this comment

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

+1

@k8s-bot
Copy link

k8s-bot commented Sep 30, 2015

Unit, integration and GCE e2e build/test failed for commit ca8a0b7563bb3531e8b800c3832ea40f3ea62372.

@agonzalezro
Copy link
Contributor Author

Hi, what's the problem with Jenkins? Everything looks ok in my end.

@saad-ali
Copy link
Member

15:15:27 Verifying ./hack/../hack/verify-generated-docs.sh
15:15:28 +++ [0930 15:15:28] Building go targets for linux/amd64:
15:15:28     cmd/gendocs
15:15:28     cmd/genman
15:15:28     cmd/genbashcomp
15:15:28     cmd/mungedocs
15:15:38 +++ [0930 15:15:38] Placing binaries
15:16:04 Some md files are missing ga-beacon analytics link:
15:16:04 /jenkins-master-data/jobs/kubernetes-pull-build-test-e2e-gce/workspace@3/_gopath/src/github.com/jstemmer/go-junit-report/README.md
15:16:04 /jenkins-master-data/jobs/kubernetes-pull-build-test-e2e-gce/workspace@3/_gopath/src/github.com/tools/godep/Readme.md
15:16:04 /jenkins-master-data/jobs/kubernetes-pull-build-test-e2e-gce/workspace@3/_gopath/src/github.com/tools/godep/Changelog.md
15:16:04 Generated docs are out of date. Please run hack/update-generated-docs.sh
15:16:04 !!! Error in ./hack/../hack/verify-generated-docs.sh:28
15:16:04   '"${KUBE_ROOT}/hack/after-build/verify-generated-docs.sh" "$@"' exited with status 1
15:16:04 Call stack:
15:16:04   1: ./hack/../hack/verify-generated-docs.sh:28 main(...)
15:16:04 Exiting with status 1
15:16:04 FAILED
15:16:04 Verifying ./hack/../hack/verify-generated-swagger-docs.sh
15:16:07 +++ [0930 15:16:07] Building go targets for linux/amd64:
15:16:07     cmd/genswaggertypedocs
15:16:08 +++ [0930 15:16:08] Placing binaries
15:16:10 Generating swagger type docs for unversioned
15:16:12 Generating swagger type docs for v1
15:16:13 Generating swagger type docs for experimental/v1alpha1
15:16:20 +++ [0930 15:16:20] Building go targets for linux/amd64:
15:16:20     cmd/kube-apiserver
15:17:30 +++ [0930 15:17:30] Placing binaries
15:17:31 
15:17:31 etcd appears to already be running on this machine (8723 etcd.test
15:17:31 8992 etcd.test
15:17:31 9020 etcd.test
15:17:31 9056 etcd.test) (or its a zombie and you need to kill its parent).
15:17:31 
15:17:31 
15:17:31 retry after you resolve this etcd error.
15:17:31 
15:17:31 +++ [0930 15:17:31] Clean up complete
15:17:31 !!! Error in /jenkins-master-data/jobs/kubernetes-pull-build-test-e2e-gce/workspace@3/hack/update-swagger-spec.sh:31
15:17:31   '"${KUBE_ROOT}/hack/after-build/update-swagger-spec.sh" "$@"' exited with status 1
15:17:31 Call stack:
15:17:31   1: /jenkins-master-data/jobs/kubernetes-pull-build-test-e2e-gce/workspace@3/hack/update-swagger-spec.sh:31 main(...)
15:17:31 Exiting with status 1
15:17:31 !!! Error in /jenkins-master-data/jobs/kubernetes-pull-build-test-e2e-gce/workspace@3/hack/update-generated-swagger-docs.sh:68
15:17:31   '"${KUBE_ROOT}/hack/update-swagger-spec.sh"' exited with status 1
15:17:31 Call stack:
15:17:31   1: /jenkins-master-data/jobs/kubernetes-pull-build-test-e2e-gce/workspace@3/hack/update-generated-swagger-docs.sh:68 main(...)
15:17:31 Exiting with status 1
15:17:31 !!! Error in /jenkins-master-data/jobs/kubernetes-pull-build-test-e2e-gce/workspace@3/hack/after-build/verify-generated-swagger-docs.sh:46
15:17:31   '"${KUBE_ROOT}/hack/update-generated-swagger-docs.sh"' exited with status 1
15:17:31 Call stack:
15:17:31   1: /jenkins-master-data/jobs/kubernetes-pull-build-test-e2e-gce/workspace@3/hack/after-build/verify-generated-swagger-docs.sh:46 main(...)
15:17:31 Exiting with status 1
15:17:31 !!! Error in ./hack/../hack/verify-generated-swagger-docs.sh:28
15:17:31   '"${KUBE_ROOT}/hack/after-build/verify-generated-swagger-docs.sh" "$@"' exited with status 1
15:17:31 Call stack:
15:17:31   1: ./hack/../hack/verify-generated-swagger-docs.sh:28 main(...)
15:17:31 Exiting with status 1
15:17:31 FAILED

@googlebot
Copy link

CLAs look good, thanks!

@agonzalezro
Copy link
Contributor Author

@saad-ali I've repushed. But TBH I doubt that anything I have changed could cause the error that you pasted. Let's wait for the checks, but it should be ok! (I hope so :) Thanks!

Flocker [1] is an open-source container data volume manager for
Dockerized applications.

This PR adds a volume plugin for Flocker.
The plugin interfaces the Flocker Control Service REST API [2] to
attachment attach the volume to the pod.

Each kubelet host should run Flocker agents (Container Agent and Dataset
Agent).

The kubelet will also require environment variables that contain the
host and port of the Flocker Control Service. (see Flocker architecture
[3] for more).

- `FLOCKER_CONTROL_SERVICE_HOST`
- `FLOCKER_CONTROL_SERVICE_PORT`

The contribution introduces a new 'flocker' volume type to the API with
fields:

- `datasetName`: which indicates the name of the dataset in Flocker
  added to metadata;
- `size`: a human-readable number that indicates the maximum size of the
  requested dataset.

Full documentation can be found docs/user-guide/volumes.md and examples
can be found at the examples/ folder

[1] https://clusterhq.com/flocker/introduction/
[2] https://docs.clusterhq.com/en/1.3.1/reference/api.html
[3] https://docs.clusterhq.com/en/1.3.1/concepts/architecture.html
@saad-ali
Copy link
Member

saad-ali commented Oct 1, 2015

Make sure to re-run hack/update-generated-docs.sh

@agonzalezro
Copy link
Contributor Author

@saad-ali I've run that & hack/update-all.sh just to be sure and nothing have changed

@k8s-bot
Copy link

k8s-bot commented Oct 1, 2015

Unit, integration and GCE e2e test build/test passed for commit 5d8fd6db1f74d3f826c4ff4fca4fce98b8671b06.

@k8s-bot
Copy link

k8s-bot commented Oct 1, 2015

Unit, integration and GCE e2e test build/test passed for commit fa39c2b.

@k8s-github-robot
Copy link

The author of this PR is not in the whitelist for merge, can one of the admins add the 'ok-to-merge' label?

@k8s-github-robot
Copy link

LGTM was before last commit, removing LGTM

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 2, 2015
@agonzalezro
Copy link
Contributor Author

Hello @saad-ali, just wondering if you need something else from me to add the LGTM label again.

@saad-ali saad-ali added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 2, 2015
@saad-ali
Copy link
Member

saad-ali commented Oct 2, 2015

LGTM re-added.
We'll let the mergebot pick this up.

@thockin
Copy link
Member

thockin commented Oct 2, 2015

Manually merging

thockin added a commit that referenced this pull request Oct 2, 2015
@thockin thockin merged commit 6260759 into kubernetes:master Oct 2, 2015
@agonzalezro agonzalezro deleted the flocker branch October 3, 2015 01:07
a-robinson added a commit that referenced this pull request Oct 5, 2015
…28-upstream-release-1.1

Automated cherry pick of #14328 upstream release 1.1
shyamjvs pushed a commit to shyamjvs/kubernetes that referenced this pull request Dec 1, 2016
…ck-of-#14328-upstream-release-1.1

Automated cherry pick of kubernetes#14328 upstream release 1.1
shouhong pushed a commit to shouhong/kubernetes that referenced this pull request Feb 14, 2017
…ck-of-#14328-upstream-release-1.1

Automated cherry pick of kubernetes#14328 upstream release 1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.