Commit Graph

52 Commits (dbcf41333443e7a4f5953e18cb0539845e83d253)

Author SHA1 Message Date
Justin Santa Barbara 54195d590f Use strongly-typed types.NodeName for a node name
We had another bug where we confused the hostname with the NodeName.

To avoid this happening again, and to make the code more
self-documenting, we use types.NodeName (a typedef alias for string)
whenever we are referring to the Node.Name.

A tedious but mechanical commit therefore, to change all uses of the
node name to use types.NodeName

Also clean up some of the (many) places where the NodeName is referred
to as a hostname (not true on AWS), or an instanceID (not true on GCE),
etc.
2016-09-27 10:47:31 -04:00
Jan Safranek a24e6a90bd Add new error 2016-09-15 09:39:30 +02:00
Johannes Scheuermann 07b81abb6c Fix typos in volume.go 2016-07-11 12:32:32 +02:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
saadali e716ddc771 Controller wait for attach and exponential backoff
Modify attach/detach controller to keep track of volumes to report
attached in Node VolumeToAttach status.

Modify kubelet volume manager to wait for volume to show up in Node
VolumeToAttach status.

Implement exponential backoff for errors in volume manager and attach
detach controller
2016-06-20 18:19:55 -07:00
saadali d72f88bf3a Modify Attach method to return device path 2016-06-19 23:54:02 -07:00
saadali 542f2dc708 Introduce new kubelet volume manager
This commit adds a new volume manager in kubelet that synchronizes
volume mount/unmount (and attach/detach, if attach/detach controller
is not enabled).

This eliminates the race conditions between the pod creation loop
and the orphaned volumes loops. It also removes the unmount/detach
from the `syncPod()` path so volume clean up never blocks the
`syncPod` loop.
2016-06-15 09:34:08 -07:00
Paul Morie 029b97d5a1 Wrap comments in pkg/volume 2016-06-03 16:16:57 -04:00
k8s-merge-robot 9c9bdb2494 Merge pull request #25502 from swagiaal/attach-interface-pvc
Automatic merge from submit-queue

Add support for PersistentVolumeClaim in Attacher/Detacher interface

The attach detach interface does not support volumes which are referenced through PVCs. This PR adds that support
2016-05-21 06:25:34 -07:00
k8s-merge-robot c63ac4e664 Merge pull request #24331 from jsafrane/devel/refactor-binder
Automatic merge from submit-queue

Refactor persistent volume controller

Here is complete persistent controller as designed in https://github.com/pmorie/pv-haxxz/blob/master/controller.go

It's feature complete and compatible with current binder/recycler/provisioner. No new features, it *should* be much more stable and predictable.

Testing
--
The unit test framework is quite complicated, still it was necessary to reach reasonable coverage (78% in `persistentvolume_controller.go`). The untested part are error cases, which are quite hard to test in reasonable way - sure, I can inject a VersionConflictError on any object update and check the error bubbles up to appropriate places, but the real test would be to run `syncClaim`/`syncVolume` again and check it recovers appropriately from the error in the next periodic sync. That's the hard part.

Organization
---
The PR starts with `rm -rf kubernetes/pkg/controller/persistentvolume`. I find it easier to read when I see only the new controller without old pieces scattered around.
[`types.go` from the old controller is reused to speed up matching a bit, the code looks solid and has 95% unit test coverage].

I tried to split the PR into smaller patches, let me know what you think.

~~TODO~~
--

* ~~Missing: provisioning, recycling~~.
* ~~Fix integration tests~~
* ~~Fix e2e tests~~

@kubernetes/sig-storage

<!-- Reviewable:start -->
---
This change is [<img src="http://reviewable.k8s.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](http://reviewable.k8s.io/reviews/kubernetes/kubernetes/24331)
<!-- Reviewable:end -->

Fixes #15632
2016-05-19 03:06:46 -07:00
Jan Safranek 75b0e2ad63 provisioning: Refactor volume plugins.
NewPersistentVolumeTemplate() and Provision() are merged into one call.
2016-05-18 10:06:51 +02:00
Sami Wagiaalla 56ccd98db8 Add support for PersistentVolumeClaim in Attacher/Detacher interface
- Dereference PVCs in kubelet.
- Add getPersistentVolumebySpec to kubelet.
- Call getPersistentVolumebySpec from mount External volumes
- Add applyPVAnnotations to kubelet.
- Delete persistent_claim plugin.
2016-05-12 17:46:39 -04:00
saadali bce708c22f Modify Detach method to take disk name 2016-05-12 12:19:24 -07:00
Sami Wagiaalla 5258392e6a Update Attacher/Detacher interfaces.
- Expand arguments for Attach/Detach interfaces
- Run waitForDetach asynchronously
2016-05-09 17:18:08 -04:00
Sami Wagiaalla 71e7dba845 Abstract node side functionality of attachable plugins
- Expand Attacher/Detacher interfaces to break up work more
  explicitly.
- Add arguments to all functions to avoid having implementers store
  the data needed for operations.
- Expand unit tests to check that Attach, Detach, WaitForAttach,
  WaitForDetach, MountDevice, and UnmountDevice get call where
  appropriet.
2016-05-04 10:18:39 -04:00
saadali 79012f6d53 Rename volume.Builder to Mounter and volume.Cleaner to Unmounter 2016-03-25 11:29:58 -07:00
markturansky a242a3d5fe Added Attacher/Detacher interfaces and support to kubelet 2016-02-07 16:55:58 -05:00
Paul Morie 180bed7b5c Fix a couple typos 2016-02-02 15:39:33 -05:00
Chao Xu c72d234bbf replacing handwritten client in several controllers 2016-01-31 15:42:02 -08:00
Sami Wagiaalla 7767698459 Remove SupportsOwnershipManagement volume attribute 2016-01-13 10:37:10 -05:00
Sami Wagiaalla f650648aae Add fsGroup to SetUp and SetUpAt 2016-01-13 10:37:10 -05:00
Sami Wagiaalla e33e4ae055 Move manageVolumeOwnership to pkg/volume/volume.go 2016-01-13 10:36:59 -05:00
markturansky 4fc1bf1f23 Added PersistentVolumeController 2015-12-11 10:33:30 -05:00
Phillip Wittrock c67ce887f2 Volume Metrics Interface and base implementation.
- Add volume.MetricsProvider function to Volume interface.
- Add volume.MetricsDu for providing metrics via executing "du".
- Add volulme.MetricsNil for unsupported Volumes.
2015-12-09 16:06:24 -08:00
Paul Morie 911757486d Refactor volume.Builder.IsReadOnly() to volume.Builder.GetAttributes() 2015-11-13 23:34:48 -05:00
Sami Wagiaalla 1d352a16b8 Support volume relabling for pods which specify an SELinux label 2015-10-28 09:26:58 -04:00
Paul Morie 3cd12f5e05 FSGroup implementation 2015-10-22 16:40:59 -04:00
markturansky 3bed0a2b5c Added volume.Creater interface and simple HostPath implementation 2015-09-18 13:14:56 -04:00
markturansky c2de9e9647 Added volume.Deleter interface and simple HostPath implementation 2015-09-17 12:08:58 -04:00
markturansky fae6759490 IsReadOnly bool on builder 2015-07-29 14:35:37 -04:00
markturansky cb547f4b5c RecyclableVolumePlugin interfaces 2015-06-04 15:40:52 -04:00
Eric Paris 6b3a6e6b98 Make copyright ownership statement generic
Instead of saying "Google Inc." (which is not always correct) say "The
Kubernetes Authors", which is generic.
2015-05-01 17:49:56 -04:00
Tim Hockin bfadae77e0 Promote volume plugins, prep for persistent vols
Move pkg/kubelet/volume/... to pkg/volume/...
Some renames to make the soon-to-come persistent volumes work clearer.
2015-03-20 13:49:40 -07:00
Tim Hockin 6cb275829f Implement volumes as plugins.
Break up the monolithic volumes code in kubelet into very small individual
modules with a well-defined interface.  Move them all into their own packages
and beef up testing along the way.
2015-01-20 11:45:45 -08:00
Brendan Burns 3da84e1844 Fix GCE-PD so that it works even if the PD is already attached. 2014-12-11 16:41:01 -08:00
Tim Hockin ea960711ff Clean up error logs.
Use %v for errors, tidy some messages, make error messages start lowe-case
(as per go guidelines).  Just accumulated nits.
2014-11-21 09:45:26 +08:00
Brendan Burns b59e49fa13 Add support for git volumes. 2014-10-27 16:35:52 -07:00
Danny Jones 4ec25f3b81 Adds support for attaching GCEPersitentDisks
Adds GCEPersistentDisk volume struct
Adds gce-utils to attach disk to kubelet's VM.
Updates config to give compute-rw to every minion.
Adds GCEPersistentDisk to API
Adds ability to mount attached disks
Generalizes PD and adds tests.
PD now uses an pluggable API interface.
Unit Tests more cleanly separates TearDown and SetUp
Modify boilerplate hook to omit build tags
Adds Mounter interface; mount is now built by OS
TearDown() for PD now detaches disk on final refcount
Un-generalized PD; GCE calls moved to cloudprovider

Address comments.
2014-10-08 20:03:59 -07:00
Eric Tune 9c0769422d Directory renamed to Dir to match json property 2014-10-01 13:35:21 -07:00
Vojtech Vitek (V-Teq) 59f58cd043 Unify Godoc formatting, fix various typos
Signed-off-by: Vojtech Vitek (V-Teq) <vvitek@redhat.com>
2014-09-02 13:41:03 +02:00
derekwaynecarr 39293eaf56 Enforce isDir, elliminates message in kubelet.log 2014-08-18 13:17:41 -04:00
Danny Jones 7c28e0849f Reorganization; Directory traversal less ugly
Directory traversal is no longer recursive and only goes as deep as it
needs to. Moved GetActiveVolumes to volume packages and added a simple
test.
2014-08-06 11:20:34 -07:00
Danny Jones 3f7f6cb2dc Modifies tests to use new volume objects. 2014-08-06 10:21:59 -07:00
Danny Jones 6191ffc0de Modifies directory walker to use a regex
Now a regex is used to determine active volume properties from
their directory paths.
2014-08-06 10:21:59 -07:00
Danny Jones 47bca30edc Splits volume interface into Builders and Cleaners
Different information is needed to perform setup versus teardown. It
makes sense to separate these two interfaces since when we call teardown
from the reconciliation loop, we cannot rely on having the
information provided by the api definition of the volume.
2014-08-06 10:21:59 -07:00
Danny Jones dfc9cb86f0 Initial reconciliation loop.
Determines the set of active volumes versus the set of valid volumes
defined by the manifests. If there is an active volume that is not
defined in any of the manifests, deletes and cleans up that volume.
2014-08-06 10:21:59 -07:00
Kelsey Hightower 7b59845843 volume: improve test coverage and minor refactoring
The volume package does not test enough use-cases.

Improve test coverage by adding additional tests and refactoring
current tests to use table testing.

This change introduces a new error var to make testing unsupported
volume type errors easier.

This change does not introduce any changes in behavior.
2014-07-27 14:11:19 -07:00
Danny Jones 1117da4a55 SetUp now returns an error.
SetUp returns an error, kubelet now skips pod if error occurs.
2014-07-24 13:53:44 -07:00
Danny Jones bfa4642055 Adds a flag to specify root working directory.
--root_dir specifies the directory kubelet will use for it's
procedures. Currently used for volume mounts.
2014-07-24 13:04:05 -07:00
Danny Jones bb2843498d API modified to use source; now supports EmptyDirectory
API is now modified to use a Source struct to handle multiple volumes.

Two volume types are supported now, HostDirectory and EmptyDirectory.
2014-07-17 15:25:50 -07:00