Commit Graph

151 Commits (cd25bbee468fe00c2bc6ea7eefc7de7e6846e526)

Author SHA1 Message Date
Paul Morie 4722cb299b Remove GetRootContext from VolumeHost 2016-11-03 12:21:19 -04:00
Justin Santa Barbara 3cdbfc98af AWS: strong-typing for k8s vs aws volume ids
We are more liberal in what we accept as a volume id in k8s, and indeed
we ourselves generate names that look like `aws://<zone>/<id>` for
dynamic volumes.

This volume id (hereafter a KubernetesVolumeID) cannot directly be
compared to an AWS volume ID (hereafter an awsVolumeID).

We introduce types for each, to prevent accidental comparison or
confusion.

Issue #35746
2016-11-02 09:42:55 -04:00
Kiall Mac Innes ccb8d53a39 Remove unused WaitForDetach from Detacher interface and plugins
This has been unused since 542f2dc7, and relies on deviceName, which
can no longer be relied upon (see issue #33128).

This needs to be removed now, as part of #33128, as the code can't be
updated to attempt device detection and fallback through to the Cinder
provided deviceName, as detection "fails" when the device is gone, and
if cinder has reported a deviceName that another volume has used in
relaity, then this will block forever (or until the other, unreleated,
volume has been detached)
2016-11-02 11:59:13 +01:00
Jing Xu abbde43374 Add sync state loop in master's volume reconciler
At master volume reconciler, the information about which volumes are
attached to nodes is cached in actual state of world. However, this
information might be out of date in case that node is terminated (volume
is detached automatically). In this situation, reconciler assume volume
is still attached and will not issue attach operation when node comes
back. Pods created on those nodes will fail to mount.

This PR adds the logic to periodically sync up the truth for attached volumes kept in the actual state cache. If the volume is no longer attached to the node, the actual state will be updated to reflect the truth. In turn, reconciler will take actions if needed.

To avoid issuing many concurrent operations on cloud provider, this PR
tries to add batch operation to check whether a list of volumes are
attached to the node instead of one request per volume.

More details are explained in PR #33760
2016-10-28 09:24:53 -07:00
Mike Danese 3b6a067afc autogenerated 2016-10-21 17:32:32 -07:00
Jan Safranek 101602ab11 Pass whole PVC to provisioner plugin
Gluster provisioner is interested in pvc.Namespace and I don't want to add
at as a new field in VolumeOptions - it would contain almost whole PVC.

Let's pass direct reference to PVC instead and let the provisioner to pick
information it is interested in.
2016-10-12 12:22:01 +02:00
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 9903b389b3 Update cloud providers 2016-09-15 10:33:57 +02:00
markturansky 9a2645aa5e add encryption to aws provisioner and cloud provider 2016-08-18 15:42:44 -04:00
Jan Safranek 4b97db202c AWS changes for new provisioning model 2016-08-18 10:36:49 +02:00
saadali e73c516366 Prevent device unmount from deleting dir on err
Prevent device unmount from deleting dir unless volume is successfully
unmounted first.
2016-08-15 16:58:31 -07:00
Jing Xu f19a1148db This change supports robust kubelet volume cleanup
Currently kubelet volume management works on the concept of desired
and actual world of states. The volume manager periodically compares the
two worlds and perform volume mount/unmount and/or attach/detach
operations. When kubelet restarts, the cache of those two worlds are
gone. Although desired world can be recovered through apiserver, actual
world can not be recovered which may cause some volumes cannot be cleaned
up if their information is deleted by apiserver. This change adds the
reconstruction of the actual world by reading the pod directories from
disk. The reconstructed volume information is added to both desired
world and actual world if it cannot be found in either world. The rest
logic would be as same as before, desired world populator may clean up
the volume entry if it is no longer in apiserver, and then volume
manager should invoke unmount to clean it up.
2016-08-15 11:29:15 -07:00
Scott Creeley 11d1289afa Add volume and mount logging 2016-07-21 09:10:00 -04:00
Cindy Wang e13c678e3b Make volume unmount more robust using exclusive mount w/ O_EXCL 2016-07-18 16:20:08 -07:00
Davanum Srinivas 2b0ed014b7 Use Go canonical import paths
Add canonical imports only in existing doc.go files.
https://golang.org/doc/go1.4#canonicalimports

Fixes #29014
2016-07-16 13:48:21 -04:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Rudi Chiarito 8db551f674 golint fixes for aws cloudprovider 2016-06-24 17:06:38 -04:00
k8s-merge-robot 07471cf90f Merge pull request #27553 from justinsb/pvc_zone_spreading_2
Automatic merge from submit-queue

AWS/GCE: Spread PetSet volume creation across zones, create GCE volumes in non-master zones

Long term we plan on integrating this into the scheduler, but in the
short term we use the volume name to place it onto a zone.
    
We hash the volume name so we don't bias to the first few zones.
    
If the volume name "looks like" a PetSet volume name (ending with
-<number>) then we use the number as an offset.  In that case we hash
the base name.
2016-06-22 01:22:16 -07:00
Jan Safranek ba63590e04 Add AWS volume plugin attach tests. 2016-06-21 14:27:37 +02: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
Justin Santa Barbara e711cbf912 GCE/AWS: Spread PetSet volume creation across zones
Long term we plan on integrating this into the scheduler, but in the
short term we use the volume name to place it onto a zone.

We hash the volume name so we don't bias to the first few zones.

If the volume name "looks like" a PetSet volume name (ending with
-<number>) then we use the number as an offset.  In that case we hash
the base name.

Fixes #27256
2016-06-17 23:27:31 -04: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
saadali 9b6a505f8a Rename UniqueDeviceName to UniqueVolumeName
Rename UniqueDeviceName to UniqueVolumeName and move helper functions
from attacherdetacher to volumehelper package.
Introduce UniquePodName alias
2016-06-15 09:32:12 -07:00
Huamin Chen d1e0a13924 support AWS and Cinder attacher
Signed-off-by: Huamin Chen <hchen@redhat.com>
2016-06-08 12:56:24 +00:00
Vishnu Kannan baa8ac4d6b Add metrics support for a few network based volumes.
Signed-off-by: Vishnu Kannan <vishnuk@google.com>
2016-05-23 09:33:12 -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
Clayton Coleman fdb110c859
Fix the rest of the code 2016-04-29 17:12:10 -04:00
saadali e7b14e721a Ensure volume GetCloudProvider code uses cloud config 2016-04-04 10:59:13 -07:00
k8s-merge-robot 2205a30348 Merge pull request #23368 from saad-ali/renameBuilderCleaner
Auto commit by PR queue bot
2016-03-26 13:01:25 -07:00
goltermann 32d569d6c7 Fixing all the "composite literal uses unkeyed fields" Vet errors. 2016-03-25 15:25:09 -07:00
saadali 79012f6d53 Rename volume.Builder to Mounter and volume.Cleaner to Unmounter 2016-03-25 11:29:58 -07:00
Tim Hockin 23fe2a3584 add maintainers for each volume driver 2016-03-22 22:19:53 -07:00
Jan Safranek f270cb1b9b Allow 39 atached EBS devices.
AWS has soft support limit for 40 attached EBS devices. Assuming there is just
one root device, use the rest for persistent volumes.

The devices will have name /dev/xvdba - /dev/xvdcm, leaving /dev/sda - /dev/sdz
to the system.

Also, add better error handling and propagate error
"Too many EBS volumes attached to node XYZ" to a pod.
2016-03-15 17:28:59 +01:00
k8s-merge-robot 45064e19d1 Merge pull request #22793 from justinsb/fix_22792
Auto commit by PR queue bot
2016-03-11 20:37:25 -08:00
Justin Santa Barbara 16730aba96 AWS: Tag created EBS volumes with our cluster tag
Fix #22792
2016-03-10 08:13:50 -05:00
Justin Santa Barbara c771bf43c4 Ubernetes Lite: apply auto-labels to dynamically provisioned volumes
Fix #22532
2016-03-09 15:17:45 -05:00
Tim St. Clair 246b389275 Move test-only volume files to test-only volume package 2016-02-29 14:44:28 -08:00
Fabio Yeon 658f7ef397 Merge pull request #21738 from jsafrane/devel/fix-admission
Hot-fix admission of volumes that are being provisioned.
2016-02-26 16:05:04 -08:00
Dogan Narinc and Yoseph Samuel aa65fe8903 Fix EBS when hostname is not the node name
Similar to #11543, the local hostname is not guaranteed to be the node
name, as the AWS cloud provider looks up node name using
`private-dns-name`. This value can be different such as when using a
private hosted zone.

The previous code uses GetHostName(), which fails in this case. Instead,
pass in an empty string so the aws cloud provider will use the cached
self instance to find the instance id.

Authors: @balooo, @dogan-sky, @jsravn
2016-02-25 16:45:44 +00:00
Jan Safranek a304e3478d Hot-fix admission of volumes that are being provisioned.
This is a first-aid bandage to let admission controller ignore persistent
volumes that are being provisioned right now and thus may not exist in
external cloud infrastructure yet.
2016-02-23 09:46:40 +01:00
Chao Xu ad46715f51 generate fake client for release_1_2 2016-02-17 16:10:02 -08:00
Jan Safranek 1d0b1c227b Add PV.Name into names of generated GCE/AWS/OSP volumes.
Volume names have now format <cluster-name>-dynamic-<pv-name>.

pv-name is guaranteed to be unique in Kubernetes cluster, adding
<cluster-name> ensures we don't conflict with any running cluster
in the cloud project (kube-controller-manager --cluster-name=XXX).

'kubernetes' is the default cluster name.
2016-02-12 09:46:59 +01:00
Justin Santa Barbara 12d407da19 AWS EBS: Remove copied-and-pasted udevadm code
This is in GCE to deal with a GCE specific issue; there's no reason to
believe we need the same logic on AWS.
2016-02-03 20:56:17 +00:00
Justin Santa Barbara d10e3debc7 AWS EBS: HandleCrash moved to util/runtime 2016-02-03 20:43:14 +00:00
Justin Santa Barbara 089951e7b4 Fix typo in comment: succefully -> successfully 2016-02-03 20:43:14 +00:00
Justin Santa Barbara 6c87a4be7c AWS: Handle deleting volume that no longer exists
The tests in particular double-delete volumes, so we need to handle this
graciously.
2016-02-03 20:43:14 +00:00
Justin Santa Barbara 1ae1db6027 AWS: Update copy-paste of GCE PD code to latest version
We are (sadly) using a copy-and-paste of the GCE PD code for AWS EBS.
This code hasn't been updated in a while, and it seems that the GCE code
has some code to make volume mounting more robust that we should copy.
2016-02-03 20:43:14 +00:00
Chao Xu c72d234bbf replacing handwritten client in several controllers 2016-01-31 15:42:02 -08:00
Fabio Yeon 7205a160ac Remove all instances of "/tmp" from unit tests and replace with a common
tmp directory creator. Exception is documented.
2016-01-27 16:11:22 -08:00
k8s-merge-robot 3f5e417999 Merge pull request #19502 from swagiaal/internalize-ownership
Auto commit by PR queue bot
2016-01-26 23:06:39 -08:00
Clayton Coleman 33085c0cf2 Update tests to handle codec changes 2016-01-22 13:27:26 -05:00
harry 7405c7899b Add strings pkg to hold strings utils
Replace funtions with strings pkg

Fix all references and rename the pkg
2016-01-15 12:37:50 +08:00
Sami Wagiaalla 7767698459 Remove SupportsOwnershipManagement volume attribute 2016-01-13 10:37:10 -05:00
Sami Wagiaalla 4ac151321a Call SetVolumeOwnership from volume plugins 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
Chakravarthy Nelluri fa76de79e5 Add support for flex volume. Flex volume adds support for thirdparty(vendor)
volumes and custom mounts.
2015-12-23 14:11:38 -08:00
Jan Safranek 6ff5286df9 Implement Creater and Deleter interfaces for AWS EBS.
Also mark the created EBS volumes with tags, so the admin knows
who/what created the volumes.
2015-12-15 10:22:49 +01: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
Sami Wagiaalla 66c905d63e Distinguish normal mount from format and mount in SafeFormatAndMount 2015-12-02 11:16:00 -05: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
Steve Milner 8da2d4002f Fixes remaining imports per #15319 2015-10-20 07:13:13 -04:00
k8s-merge-robot c4779fbc4f Merge pull request #15475 from jijun2/fix-cni_test
Auto commit by PR queue bot
2015-10-20 01:30:24 -07:00
jijun2 bf6e8cbff7 test: using ioutil.TempDir in unit tests per #15176
update

update mode

delete /tmp

update

use ioutil.TempDir instead of static tmp dir

use ioutil.TempDir instead of static tmp dir
2015-10-16 09:21:46 +08:00
eulerzgy 8b174f7f33 adjust package name for pkg/cloudprovider 2015-10-10 16:44:54 +08:00
Filip Grzadkowski 7fe34f2050 Introduce nsenter writer for volume plugins 2015-09-17 16:40:29 +02:00
Kel Cecil 6687075300 Correct AWS EBS comment 2015-09-16 14:04:36 -04:00
k8s-merge-robot dc1561fbca Merge pull request #13784 from BugRoger/aws_ebs_picks_up_kubelet_cloud_provider
Auto commit by PR queue bot
2015-09-14 22:25:16 -07:00
Chao Xu 64bf839e9f refactor tests to use testapi rather than latest directly 2015-09-11 17:32:23 -07:00
Chao Xu dd6c121d7f massive changes 2015-09-11 17:31:47 -07:00
Michael Schmidt fcda3556cd pass cloudProvider from Kubelet to volume plugins 2015-09-10 10:28:48 +02:00
markturansky 0e7f73ad67 expand volume.Spec to include full Volume and PV 2015-09-03 08:57:32 -04:00
deads2k 7e180c258d update testclient for delegating reaction chain 2015-09-01 12:58:35 -04:00
Sami Wagiaalla ab0258f259 Support formatting and mounting GCE PD without 'safe_format_and_mount'
The GCE PD plugin uses safe_format_and_mount found on standard GCE images:

https://github.com/GoogleCloudPlatform/compute-image-packages/blob/master/google-startup-scripts/usr/share/google/safe_format_and_mount

On custom images where this is not available pods fail to format and
mount GCE PDs. This patch uses linux utilities in a similar way to the
safe_format_and_mount script to format and mount the GCE PD and AWS EBC
devices. That is first attempt a mount. If mount fails try to use file to
investigate the device. If 'file' fails to get any information about
the device and simply returns "data" then assume the device is not
formatted and format it and attempt to mount it again.

Signed-off-by: Sami Wagiaalla <swagiaal@redhat.com>
2015-08-26 11:53:40 -04:00
Saad Ali b05cab0bc5 Merge pull request #6945 from eparis/IsMountPoint
Rename IsMountPoint to IsLikelyNotMountPoint
2015-08-19 12:47:51 -07:00
Kris Rousey ae6c64d9bb Moving everyone to unversioned client 2015-08-18 10:23:03 -07:00
Eric Paris f125ad88ce Rename IsMountPoint to IsLikelyNotMountPoint
IsLikelyNotMountPoint determines if a directory is not a mountpoint.
It is fast but not necessarily ALWAYS correct. If the path is in fact
a bind mount from one part of a mount to another it will not be detected.
mkdir /tmp/a /tmp/b; mount --bin /tmp/a /tmp/b; IsLikelyNotMountPoint("/tmp/b")
will return true. When in fact /tmp/b is a mount point. So this patch
renames the function and switches it from a positive to a negative (I
could think of a good positive name). This should make future users of
this function aware that it isn't quite perfect, but probably good
enough.
2015-08-14 18:45:43 -04:00
Bryan Stenson 9541414742 create cloudprovider "providers" package
move all providers into new package
    update all references to old package path
2015-08-11 22:36:51 -07:00
Mike Danese 17defc7383 run gofmt on everything we touched 2015-08-05 17:52:56 -07:00
Mike Danese 8e33cbfa28 rewrite go imports 2015-08-05 17:30:03 -07:00
jiangyaoguo 8eeda24652 new builder and cleaner type for aws-ebs 2015-07-30 10:23:38 +08:00
markturansky 63ccfa2beb Added unit tests for each PV using IsReadOnly 2015-07-29 14:38:40 -04:00
markturansky fae6759490 IsReadOnly bool on builder 2015-07-29 14:35:37 -04:00
markturansky 124bb22f92 Honor ReadOnly flag from persistent-volume plugin 2015-07-29 14:34:15 -04:00
markturansky e380242b16 Changed pdManager to ebsManager 2015-07-27 13:52:04 -04:00
markturansky 98ec116f3f Improved internal naming from 'pd' to 'ebs' to match the volume 2015-07-27 13:52:04 -04:00
Justin Santa Barbara 9839253233 Add logging to volume tear-down to help understand mount behaviour 2015-05-29 20:11:13 -04:00
Tim Hockin 0bbba1c3d1 Merge pull request #8732 from markturansky/missing_pv_support
Fixed CanSupport func across all volumes (for PV)
2015-05-27 08:45:47 -07:00
Paul Morie 38c96725c0 Add doc.go files for all volume plugins 2015-05-23 16:59:12 -04:00
markturansky 3ad583cf2d Fixed spotty CanSupport for PV and added more unit tests for same 2015-05-23 09:59:05 -04:00
Tim Hockin f66ca25d9f Rename AccessMode to PersistentVolumeAccessMode 2015-05-18 17:21:30 -07:00
Paul Morie cd359ffa73 Refactor volume interfaces to receive pod instead of ObjectReference 2015-05-10 20:12:57 -04:00
Paul Morie b538642464 Inject mounter into volume plugins 2015-05-04 11:28:57 -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
Deyuan Deng 6897095e56 Change mount.Interface.Mount to exec('mount'), instead of syscall 2015-04-29 10:46:32 -04:00
markturansky e1481fb9c2 Refactored Volume plugins to use InternalVolume instead of API types 2015-04-14 14:25:01 -04:00
Paul Morie c98e89fca0 Set rootcontext of emptyDir tmpfs mounts correctly 2015-04-13 12:50:36 -04:00
Justin Santa Barbara 7626914344 Rename aws_pd.go -> aws_ebs.go, aws_pd_test.go -> aws_ebs_test.go 2015-04-10 13:25:44 -07:00