Commit Graph

584 Commits (3971553298616fee6e477b84474d64b7360d7f3a)

Author SHA1 Message Date
Ivan Shvedunov df1e925143 Fix wrapped volume race
This fixes race conditions in configmap, secret, downwardapi & git_repo
volume plugins.
wrappedVolumeSpec vars used by volume mounters and unmounters contained
a pointer to api.Volume structs which were being patched by
NewWrapperMounter/NewWrapperUnmounter, causing race condition during
volume mounts.
2016-07-27 12:24:46 +03:00
Matt T. Proud 4e0a1858f9 pkg/util/goroutinemap: apply idiomatic Go cleanups
Package goroutinemap can be structurally simplified to be more
idiomatic, concise, and free of error potential.  No structural changes
are made.

It is unconventional declare `sync.Mutex` directly as a pointerized
field in a parent structure.  The `sync.Mutex` operates on pointer
receivers of itself; and by relying on that, the types that contain
those fields can be safely constructed using
https://golang.org/ref/spec#The_zero_value.

The duration constants are already of type `time.Duration`, so
re-declaring that is redundant.
2016-07-26 07:00:26 +02:00
Matt T. Proud 5c6292c074 pkg/various: plug leaky time.New{Timer,Ticker}s
According to the documentation for Go package time, `time.Ticker` and
`time.Timer` are uncollectable by garbage collector finalizers.  They
leak until otherwise stopped.  This commit ensures that all remaining
instances are stopped upon departure from their relative scopes.
2016-07-26 06:20:31 +02:00
Anish Bhatt 531a961a96 Check iscsi iface file for transport name 2016-07-25 18:15:25 -07:00
k8s-merge-robot 4694a6dd71 Merge pull request #24797 from screeley44/vols_debug_mkfs
Automatic merge from submit-queue

add enhanced volume and mount logging for block devices

Fixes #24568 

Adding better logging and debugging for block device volumes and the shared SafeFormatAndMount (aws, gce, flex, rbd, cinder, etc...)
2016-07-21 17:12:33 -07:00
Scott Creeley 11d1289afa Add volume and mount logging 2016-07-21 09:10:00 -04:00
saadali 88d495026d Allow mounts to run in parallel for non-attachable
Allow mount volume operations to run in parallel for non-attachable
volume plugins.

Allow unmount volume operations to run in parallel for all volume
plugins.
2016-07-19 21:54:26 -07:00
Cindy Wang e13c678e3b Make volume unmount more robust using exclusive mount w/ O_EXCL 2016-07-18 16:20:08 -07:00
Matt T. Proud dbba1347c3 volume/flocker: plug time.Ticker resource leak
This commit ensures that `flockerMounter.updateDatasetPrimary` does not leak
running `time.Ticker` instances.  Upon termination of the consuming
routine, we stop the tickers.
2016-07-18 17:38:12 +02:00
k8s-merge-robot fa174bcdaf Merge pull request #29042 from dims/fixup-imports
Automatic merge from submit-queue

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-18 07:23:38 -07:00
k8s-merge-robot d168bbe3b8 Merge pull request #28767 from johscheuer/fix-volume-typos
Automatic merge from submit-queue

Fix typos in volume.go

Fixed some minor typos in the docs of `volume.go`.
2016-07-18 00:36:00 -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
xiangpengzhao b2ab356ca5 Delete duplicated code. 2016-07-15 03:04:24 -04:00
joe2far 5ead89b5bb Fixed several typos 2016-07-13 15:06:24 +01:00
Johannes Scheuermann 07b81abb6c Fix typos in volume.go 2016-07-11 12:32:32 +02:00
Michael Rubin 8028e953b6 Revert "Mount r/w GCE PD disks with -o discard" 2016-07-07 16:47:35 -07:00
k8s-merge-robot 939b98481e Merge pull request #28448 from thockin/gce-pd-discard
Automatic merge from submit-queue

Mount r/w GCE PD disks with -o discard

As per https://cloud.google.com/compute/docs/disks/add-persistent-disk#formatting.

Fixes #23258
2016-07-07 11:01:43 -07:00
k8s-merge-robot 0c696dc95b Merge pull request #27848 from liubin/fix-typos
Automatic merge from submit-queue

fix some typos

Just a minor typos fix.


Signed-off-by: bin liu <liubin0329@gmail.com>
2016-07-06 23:36:49 -07:00
Angus Salkeld d7150bfaea Add spec.Name() to the configmap GetVolumeName()
This is to base the name on the volume not just on the
source configMap. If you have 2 volumes that both have the same
configMap as a source, the volume is see as being in the attached
state (it's state is looked up based on GetVolumeName()).

See bug #28502
2016-07-06 16:39:43 +02:00
Tim Hockin 8efefab9a3 Mount r/w GCE PD disks with -o discard
As per
https://cloud.google.com/compute/docs/disks/add-persistent-disk#formatting.
2016-07-03 21:30:18 -07:00
bin liu 426fdc431a Merge branch 'master' into fix-typos 2016-07-04 11:20:47 +08:00
saadali 0dd17fff22 Reorganize volume controllers and manager 2016-07-01 18:50:25 -07:00
Christian Simon 65180ea25a Fix problems with container restarts and flocker
* Removes meta dir, which prevents to detection of the correct mount
  path

* Fixes #22436
2016-06-30 05:49:15 +00:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
k8s-merge-robot 7f3da674f7 Merge pull request #26680 from olegshaldybin/fake-clientset-registry
Automatic merge from submit-queue

Track object modifications in fake clientset

Fake clientset is used by unit tests extensively but it has some
shortcomings:

- no filtering on namespace and name: tests that want to test objects in
  multiple namespaces end up getting all objects from this clientset,
  as it doesn't perform any filtering based on name and namespace;

- updates and deletes don't modify the clientset state, so some tests
  can get unexpected results if they modify/delete objects using the
  clientset;

- it's possible to insert multiple objects with the same
  kind/name/namespace, this leads to confusing behavior, as retrieval is
  based on the insertion order, but anchors on the last added object as
  long as no more objects are added.

This change changes core.ObjectRetriever implementation to track object
adds, updates and deletes.

Some unit tests were depending on the previous (and somewhat incorrect)
behavior. These are fixed in the following few commits.
2016-06-29 06:04:33 -07:00
saadali e06b32b1ef Mark VolumeInUse before checking if it is Attached
Ensure that kublet marks VolumeInUse before checking if it is Attached.
Also ensures that the attach/detach controller always fetches a fresh
copy of the node object before detach (instead ofKubelet relying on node
informer cache).
2016-06-28 14:05:59 -07:00
Oleg Shaldybin 3b15d5be19 Use correct namespace in unit tests that use fake clientset
Fake clientset no longer needs to be prepopulated with records: keeping
them in leads to the name conflict on creates. Also, since fake
clientset now respects namespaces, we need to correctly populate them.
2016-06-28 11:26:34 -07:00
Rudi Chiarito 8db551f674 golint fixes for aws cloudprovider 2016-06-24 17:06:38 -04:00
k8s-merge-robot 3a29aa7941 Merge pull request #27496 from hpcloud/hpe/vsphere-scsidriver
Automatic merge from submit-queue

Adding SCSI controller type filter for vSphere disk attach

Hot plug of disks to a SCSI controller of type lsilogic doesn't work as expected. When a device is detached from the controller, it fails to remove the device from the /dev path which makes the subsequent attaches to the node to fail. With scsi controller types lsilogic-sas or paravirtual this seems to work well. This patch filters the existing controller for these types, and if it doesn't find one, it creates a new controller for disk attach.

This PR is dependent on https://github.com/kubernetes/kubernetes/pull/26658 (1st commit) also targeting this for 1.3
2016-06-23 08:09:43 -07:00
saadali dfe8e606c1 Fix device path used by volume WaitForAttach 2016-06-22 12:56:58 -07:00
bin liu fd27cd47f7 fix some typos
Signed-off-by: bin liu <liubin0329@gmail.com>
2016-06-22 18:14:26 +08: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
k8s-merge-robot d3a7daf449 Merge pull request #27353 from jsafrane/cinder-attach-test
Automatic merge from submit-queue

Add Cinder volume plugin attach tests.

@kubernetes/sig-storage
2016-06-22 00:15:17 -07:00
Justin Santa Barbara dd94997619 Add comments & misc review fixes
Lots of comments describing the heuristics, how it fits together and the
limitations.

In particular, we can't guarantee correct volume placement if the set of
zones is changing between allocating volumes.
2016-06-21 15:22:16 -04:00
Jan Safranek ba63590e04 Add AWS volume plugin attach tests. 2016-06-21 14:27:37 +02:00
Jan Safranek 6356d85db5 Add Cinder volume plugin attach tests. 2016-06-21 13:12:47 +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
Abitha Palaniappan 4a5ade213c Adding scsi controller type filter while attaching disks
Hot attach of disk to a scsi controller will work only if the
controller type is lsilogic-sas or paravirtual.This patch filters
the existing controller for these types, if it doesn't find one it
creates a new scsi controller.
2016-06-20 09:54:55 -07:00
saadali d72f88bf3a Modify Attach method to return device path 2016-06-19 23:54:02 -07:00
k8s-merge-robot 4fcbc0ada7 Merge pull request #26658 from hpcloud/hpe/vsphere-vol-bugfixes
Automatic merge from submit-queue

Fixing vSphere Volume plugin bugs

This PR fixes #26646 and targeted for 1.3
2016-06-19 21:06:13 -07:00
k8s-merge-robot 7e88b0ef0e Merge pull request #26781 from aveshagarwal/master-dapi-volume-annotations-labels-issue
Automatic merge from submit-queue

Remove an empty line being output when exposing annotations and labels via downward api volume

The issue is that formatMap function (for annotations and labels) in pkg/fieldpath/fieldpath.go appends a "\n" after each key value pair which is correct for all pairs except the last pair because then a complete string is returned with a "\n" in the end. It is inconsistent with other strings (metadata.name, namespace and resources) being returned as they dont have "\n" in the end. These returned strings are processed by sortLines function in pkg/volume/downwardapi/downwardapi.go and the function finally appends "\n" to each  string, but incorrectly outputs an empty line if there is an already "\n" in the end with the  input string. To illustrate:

The sortLines works as follows: lets say the input string is : "a\nb\nc\n". 

1. It splits them as "a", "b", "c", ""  (note empty string in the end). 
2. it sort them:  "", "a", b", "c"  
3. And then it appends "\n" again to each string:  "\n",  "a\n" ,"b\n", "c\n"

So we can see that it is erroneously creating an empty string in the beginning when the input string to sortLines has "\n" in the end.  As I said above, it is not an issue with metadata.name, namespace and resources as their input strings are without \n" in the end.

So now, the output in the downward api volume, (using the example in http://kubernetes.io/docs/user-guide/downward-api/):

```
# cat /etc/annotations

 zone="us-est-coast"
 cluster="test-cluster1"
 rack="rack-22"
```

After this patch, the output will be correct and without the erroneous empty line in the beginning.
I could think other ways to solve this but I found the way in this patch with minimal code changes.

@kubernetes/rh-cluster-infra
2016-06-18 09:19:21 -07:00
Justin Santa Barbara 9c2566572d GCE Multizone: Allow volumes to be created in non-master zone
We had a long-lasting bug which prevented creation of volumes in
non-master zones, because the cloudprovider in the volume label
admission controller is not initialized with the multizone setting
(issue #27656).

This implements a simple workaround: if the volume is created with the
failure-domain zone label, we look for the volume in that zone.  This is
more efficient, avoids introducing a new semantic, and allows users (and
the dynamic provisioner) to create volumes in non-master zones.

Fixes #27657
2016-06-17 23:27:41 -04: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 cfab5362d4 Remove spam log messages from gce pd
Fixes https://github.com/kubernetes/kubernetes/pull/27410
2016-06-15 09:34:08 -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
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
k8s-merge-robot abfe894385 Merge pull request #27301 from bprashanth/ps_dbg
Automatic merge from submit-queue

petset and volume debug messages

To help with https://github.com/kubernetes/kubernetes/issues/27299 https://github.com/kubernetes/kubernetes/issues/27058

simple enough that either reviewer can approve I guess.
2016-06-14 12:34:43 -07:00
Wojciech Tyczynski 5d702a32c1 Fix race in informer 2016-06-14 16:40:12 +02:00
Abitha Palaniappan 6a8cec1c5c Fix vSphere Volume plugin bugs
- replaces probeVolume with scsiHostRescan to scan hot attached disks
 - fixes substring match of UUID returned from AttachDisk
 - changes DetachDisk to take volumePath argument instead of diskID
 - fixes delayed failure at mount rather than attach disk
 - removes cloning of virtual disk in AttachDisk
2016-06-13 17:20:55 -07:00
Prashanth Balasubramanian 4e2f97a80e Add some logging around ro flag in GCE volume plugin 2016-06-13 13:55:49 -07:00
k8s-merge-robot 4793372a85 Merge pull request #25888 from rootfs/attacher-aws-cinder
Automatic merge from submit-queue

implement EBS and Cinder attacher/detacher 

follow up with #21709

@kubernetes/sig-storage
2016-06-10 05:39:22 -07:00
k8s-merge-robot c9c4ada309 Merge pull request #26615 from jsafrane/gce-attach-tests
Automatic merge from submit-queue

GCE attach tests

Add basic tests for GCE attacher.

Looking at the code, it would deserve some refactoring as suggested in #25888, so mounting is not tested at all.
2016-06-09 06:00:56 -07:00
k8s-merge-robot 29c5d6c721 Merge pull request #26848 from pmorie/wrap-volumes
Automatic merge from submit-queue

Wrap more comments in pkg/volume

Wrap some more comments in `pkg/volume`
2016-06-09 01:15:52 -07:00
Avesh Agarwal 3c865e45a0 Remove an empty line being output when exposing annotations and
labels via downward api volume
2016-06-08 09:22:10 -04: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
Jan Safranek 5cd5ae8d82 Add GCE attacher unit tests. 2016-06-08 13:53:04 +02:00
Huamin Chen 4b4048a084 correction on rbd volume object and defaults
Signed-off-by: Huamin Chen <hchen@redhat.com>
2016-06-06 17:27:47 +00:00
Paul Morie 6415c2d288 Wrap more comments in pkg/volume 2016-06-04 14:14:00 -04:00
k8s-merge-robot 14f2763724 Merge pull request #26777 from jsafrane/fix-attach-errors
Automatic merge from submit-queue

Fix GCE attacher/detacher to ignore return value of failed calls.

The plugin should ignore any return value if err is set. Found when writing unit tests in #26615 - my dummy `DiskIsAttached` returned `false, errors.New('fake error')` and the volume was **not** detached although the log message `"Error checking if PD (%q) is already attached to current node (%q). Will continue and try detach anyway."` suggested otherwise 

@saad-ali, PTAL
@kubernetes/sig-storage
2016-06-03 22:34:56 -07:00
Paul Morie 029b97d5a1 Wrap comments in pkg/volume 2016-06-03 16:16:57 -04:00
Jan Safranek eb5a68319e Fix GCE attacher/detacher to ignore return value of failed calls.
The plugin should ignore any return value if err is set.
2016-06-03 14:16:17 +02:00
Saad Ali 9dbe943491 Attach/Detach Controller Kubelet Changes
This PR contains Kubelet changes to enable attach/detach controller control.
* It introduces a new "enable-controller-attach-detach" kubelet flag to
  enable control by controller. Default enabled.
* It removes all references "SafeToDetach" annoation from controller.
* It adds the new VolumesInUse field to the Node Status API object.
* It modifies the controller to use VolumesInUse instead of SafeToDetach
  annotation to gate detachment.
* There is a bug in node-problem-detector that causes VolumesInUse to
  get reset every 30 seconds. Issue https://github.com/kubernetes/node-problem-detector/issues/9
  opened to fix that.
2016-06-02 16:47:11 -07:00
k8s-merge-robot 0b7f8e5b74 Merge pull request #24808 from screeley44/gluster_errors
Automatic merge from submit-queue

read gluster log to surface glusterfs plugin errors properly in describe events

glusterfs.go does not properly expose errors as all mount errors go to a log file, I propose we read the log file to expose the errors without asking the users to 'go look at this log'

This PR does the following:
1.  adds a gluster option for log-level=ERROR to remove all noise from log file
2.  change log file name and path based on PV + Pod name - so specific per PV and Pod
3.  create a utility to read the last two lines of the log file when failure occurs

old behavior:
```
  13s	13s	1	{kubelet 127.0.0.1}		Warning	FailedMount	Unable to mount volumes for pod "bb-gluster-pod2_default(34b18c6b-070d-11e6-8e95-52540092b5fb)": glusterfs: mount failed: Mount failed: exit status 1
Mounting arguments: 192.168.234.147:myVol2 /var/lib/kubelet/pods/34b18c6b-070d-11e6-8e95-52540092b5fb/volumes/kubernetes.io~glusterfs/pv-gluster glusterfs [log-file=/var/lib/kubelet/plugins/kubernetes.io/glusterfs/pv-gluster/glusterfs.log]
Output: Mount failed. Please check the log file for more details.
```

improved behavior: (updated after suggestions from community)
```
  34m		34m		1	{kubelet 127.0.0.1}			Warning		FailedMount	Unable to mount volumes for pod "bb-multi-pod1_default(e7d7f790-0d4b-11e6-a275-52540092b5fb)": glusterfs: mount failed: Mount failed: exit status 1
Mounting arguments: 192.168.123.222:myVol2 /var/lib/kubelet/pods/e7d7f790-0d4b-11e6-a275-52540092b5fb/volumes/kubernetes.io~glusterfs/pv-gluster2 glusterfs [log-level=ERROR log-file=/var/lib/kubelet/plugins/kubernetes.io/glusterfs/pv-gluster2/bb-multi-pod1-glusterfs.log]
Output: Mount failed. Please check the log file for more details.

 the following error information was pulled from the log to help resolve this issue: 
[2016-04-28 14:21:29.109697] E [socket.c:2332:socket_connect_finish] 0-glusterfs: connection to 192.168.123.222:24007 failed (Connection timed out)
[2016-04-28 14:21:29.109767] E [glusterfsd-mgmt.c:1819:mgmt_rpc_notify] 0-glusterfsd-mgmt: failed to connect with remote-host: 192.168.123.222 (Transport endpoint is not connected)

```

also this PR is alternate approach to :  #24624
2016-06-02 13:42:54 -07:00
Scott Creeley a36cd3d55b read gluster log to surface glusterfs plugin errors properly 2016-06-02 09:09:14 -04:00
k8s-merge-robot 7030dca4c8 Merge pull request #25989 from jingxu97/bug-tmpdir
Automatic merge from submit-queue

use MkTmpDir instead of ioutil.TempDir in testing

fixes #20243
2016-05-29 06:32:36 -07:00
saadali 3c345abafd Fix DATA RACE in unit tests: reconciler_test.go 2016-05-27 01:19:25 -07:00
Alex Mohr 0a6178959f Merge pull request #25852 from vishh/network-volumes
Add metrics support for a GCE PD, EC2 EBS & Azure File volumes
2016-05-26 15:47:33 -07:00
k8s-merge-robot bda0dc88aa Merge pull request #25457 from saad-ali/expectedStateOfWorldDataStructure
Automatic merge from submit-queue

Attach Detach Controller Business Logic

This PR adds the meat of the attach/detach controller proposed in #20262.

The PR splits the in-memory cache into a desired and actual state of the world.
2016-05-26 00:41:54 -07:00
saadali 92500a20d7 Attach detach controller business logic added
Split controller cache into actual and desired state of world.
Controller will only operate on volumes scheduled to nodes that
have the "volumes.kubernetes.io/controller-managed-attach" annotation.
2016-05-24 23:01:16 -07:00
Avesh Agarwal 1931931494 Downward API implementation for resources limits and requests 2016-05-24 12:22:35 -04: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
k8s-merge-robot 8b0e9c5739 Merge pull request #24947 from hpcloud/hpe/vsphere-volume
Automatic merge from submit-queue

vSphere Volume Plugin Implementation

This PR implements vSphere Volume plugin support in Kubernetes (ref. issue #23932).
2016-05-22 20:40:14 -07:00
Sami Wagiaalla 4858d0ab6f Detangle Attach/Detach from GCE PD 2016-05-22 08:28:29 -04:00
Abitha Palaniappan 95c009dbdb Adding vSphere Volume support for vSphere Cloud Provider 2016-05-21 11:00:14 -07: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 eb733cbf45 Merge pull request #25285 from ingvagabund/extend-secrets-volumes-with-path-control
Automatic merge from submit-queue

Extend secrets volumes with path control

As per [1] this PR extends secrets mapped into volume with:

* key-to-path mapping the same way as is for configmap. E.g.

```
{
 "apiVersion": "v1",
 "kind": "Pod",
  "metadata": {
    "name": "mypod",
    "namespace": "default"
  },
  "spec": {
    "containers": [{
      "name": "mypod",
      "image": "redis",
      "volumeMounts": [{
        "name": "foo",
        "mountPath": "/etc/foo",
        "readOnly": true
      }]
    }],
    "volumes": [{
      "name": "foo",
      "secret": {
        "secretName": "mysecret",
        "items": [{
          "key": "username",
          "path": "my-username"
        }]
      }
    }]
  }
}
```

Here the ``spec.volumes[0].secret.items`` added changing original target ``/etc/foo/username`` to ``/etc/foo/my-username``.

* secondly, refactoring ``pkg/volumes/secrets/secrets.go`` volume plugin to use ``AtomicWritter`` to project a secret into file.

[1] https://github.com/kubernetes/kubernetes/blob/master/docs/design/configmap.md#changes-to-secret
2016-05-21 03:55:13 -07:00
k8s-merge-robot 62a8394eb4 Merge pull request #25263 from jsafrane/devel/adopt-recycle-pod
Automatic merge from submit-queue

volume recycler: Don't start a new recycler pod if one already exists.

Recycling is a long duration process and when the recycler controller is restarted in the meantime, it should not start a new recycler pod if there is one already running.

This means that the recycler pod must have deterministic name based on name of the recycled PV, we then get name conflicts when creating the pod.

Two things need to be changed:

- recycler controller and recycler plugins must pass the PV.Name to place, where the pod is created. This is most of the patch and it should be pretty straightforward.

- create recycler pod with deterministic name and check "already exists" error.

When at it, remove useless 'resourceVersion' argument and make log messages starting with lowercase.

There is an unit test to check the behavior + there is an e2e test that checks that regular recycling is not broken (it does not try to run two recycler pods in parallel as the recycler is single-threaded now).
2016-05-21 02:28:26 -07:00
Jing Xu ffac5d73f6 use MkTmpDir instead of ioutil.TempDir in testing 2016-05-20 14:06:08 -07:00
Clayton Coleman 5e4308f91d
Update use of Quantity in other classes 2016-05-19 08:41:43 -04:00
Jan Safranek 0ee9160f88 volume recycler: Don't start a new recycler pod if one already exists.
Recycling is a long duration process and when the recycler controller is
restarted in the meantime, it should not start a new recycler pod if there is
one already running.

This means that the recycler pod must have deterministic name based on name
of the recycled PV, we then get name conflicts when creating the pod.

Two things need to be changed:
- recycler controller and recycler plugins must pass the PV.Name to place,
  where the pod is created.

- create recycler pod with deterministic name and check "already exists" error.

When at it, remove useless 'resourceVersion' argument and make log messages
starting with lowercase.
2016-05-19 12:58:25 +02: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 Chaloupka ebe56f5ff9 Extend the current secrets mounting to volume implementation with key to path mapping.
The key to path mapping allows pod to specify different name (thus location) of each secret.
At the same time refactor the volume plugin to use AtomicWritter to project secrets to files in a volume.

Update e2e Secrets test, the secret file permission has changed from 0444 to 0644
Remove TestPluginIdempotent as the AtomicWritter is responsible for secret creation
2016-05-18 16:12:31 +02:00
Jan Safranek 75b0e2ad63 provisioning: Refactor volume plugins.
NewPersistentVolumeTemplate() and Provision() are merged into one call.
2016-05-18 10:06:51 +02:00
Tim Hockin 66d0d87829 Make IsValidLabelValue return error strings 2016-05-17 21:36:10 -07:00
k8s-merge-robot 4ac32179bf Merge pull request #24798 from thockin/validation_pt8-1
Automatic merge from submit-queue

Make IsQualifiedName return error strings

Part of the larger validation PR, broken out for easier review and merge.

@lavalamp FYI, but I know you're swamped, too.
2016-05-14 22:14:17 -07:00
k8s-merge-robot 6fe3498ef9 Merge pull request #24625 from pmorie/dapi-volume-atomic
Automatic merge from submit-queue

Refactor downward API volume to use AtomicWriter

Make the downward API plugin use `AtomicWriter` instead.

@thockin @saad-ali @sdminonne

<!-- 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/24625)
<!-- Reviewable:end -->
2016-05-14 11:22:42 -07:00
k8s-merge-robot 4591aa0f3b Merge pull request #25306 from pmorie/configmap-medium
Automatic merge from submit-queue

Use local disk for ConfigMap volume instead of tmpfs

So that ConfigMap volumes are counted against pod's storage quota.

@kubernetes/sig-node 
cc @derekwaynecarr @vishh
2016-05-13 05:07:01 -07: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
Saad Ali 4b564c95d7 Merge pull request #25325 from swagiaal/attacher-interface-update
Update Attacher/Detacher interfaces.
2016-05-11 11:36:19 -07:00
Paul Morie 3567b1f9c4 Use local disk for ConfigMap volume instead of tmpfs
So that ConfigMap volumes are counted against pod's storage quota.
2016-05-10 22:27:40 -04:00
Tim Hockin 72955770f3 Make IsQualifiedName return error strings 2016-05-10 11:23:23 -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
Tim Hockin 527cb50583 Demand at least go1.6 2016-05-08 20:30:37 -07:00
k8s-merge-robot d4b1b6776a Merge pull request #24557 from swagiaal/attacher-interface
Automatic merge from submit-queue

 Abstract node side functionality of attachable plugins

- Create PhysicalAttacher interface to abstract MountDevice and
  WaitForAttach.
- Create PhysicalDetacher interface to abstract WaitForDetach and
  UnmountDevice.
- Expand unit tests to check that Attach, Detach, WaitForAttach,
  WaitForDetach, MountDevice, and UnmountDevice get call where
  appropriet.

Physical{Attacher,Detacher} are working titles suggestions welcome. Some other thoughts:
- NodeSideAttacher or NodeAttacher.
- AttachWatcher
- Call this Attacher and call the Current Attacher CloudAttacher.
- DeviceMounter (although there are way too many things called Mounter right now :/)

This is to address: https://github.com/kubernetes/kubernetes/pull/21709#issuecomment-192035382

@saad-ali
2016-05-08 14:04:44 -07:00
k8s-merge-robot 62ef6c9a34 Merge pull request #20490 from swagiaal/auto-supplemental-group-kubelet
Automatic merge from submit-queue

Automatically Add Supplemental Groups from Volumes to Pods

This adds support for a "GID" annotation that one can add to their PVs. When this annotation is seen the kubelet automatically adds the given GID to the list of supplemental groups for the pod to which the PV is attached. This allows admins to create volumes and suggest a GID to use to access the volume. This is needed for volumes which do not support ownership management such as NFS.

@markturansky PTAL
2016-05-08 08:08:01 -07:00
Sami Wagiaalla d1aacfc059 Move getCloudProvider retries to getCloudProvider() 2016-05-04 16:43:38 -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
Paul Morie 272066321c Refactor downward API volume to use AtomicWriter 2016-05-02 09:40:16 -04:00
Clayton Coleman fdb110c859
Fix the rest of the code 2016-04-29 17:12:10 -04:00
Sami Wagiaalla e1e7da2712 Add GIDs specified in a PV's annotations to pod's supplemental groups 2016-04-29 16:44:56 -04:00
k8s-merge-robot 06160b6abe Merge pull request #22023 from mkulke/rackspace-improvements
Automatic merge from submit-queue

Rackspace improvements (OpenStack Cinder)

This adds PV support via Cinder on Rackspace clusters. Rackspace Cloud Block Storage is pretty much vanilla OpenStack Cinder, so there is no need for a separate Volume Plugin. Instead I refactored the Cinder/OpenStack interaction a bit (by introducing a CinderProvider Interface and moving the device path detection logic to the OpenStack part).

Right now this is limited to `AttachDisk` and `DetachDisk`. Creation and deletion of Block Storage is not in scope of this PR.

Also the `ExternalID` and `InstanceID` cloud provider methods have been implemented for Rackspace.
2016-04-21 16:38:13 -07:00
k8s-merge-robot e3dab39df0 Merge pull request #21304 from tobad357/iscsi-mpio-support
Automatic merge from submit-queue

Add mpio support for iscsi

This allows the iscsi volume to check if a iscsi device belongs to a mpio device
If it does belong to the device then we make sure we mount the mpio device instead of
the raw device. 
The code is based on the current FibreChannel volume support for mpio

example
/dev/disk/by-path/iqn-example.com.2999 -> /dev/sde
Then we check
/sys/block/[dm-X]/slaves/xx
until we find the [dm-X] containing /dev/sde and mount it

Additional work that can be done in future
1. Add multiple portal support to iscsi
2. Move the FibreChannel volume provider to use the code that has been extracted
2016-04-21 15:40:50 -07:00
kulke ba4d74f3c7 Added Block Storage support to Rackspace provider, improved Node discovery. 2016-04-21 10:31:37 +02:00
k8s-merge-robot 537a739b3b Merge pull request #22995 from swagiaal/fix-gitrepo-ownership
Automatic merge from submit-queue

Set ownership to fsGroup in gitrepo

Set ownership to fsGroup in the gitrepo volume plugin

@pmorie
2016-04-20 03:49:37 -07:00
tobad357 1811ded396 This is an update that allows the iscsi volume to check if a iscsi device belongs to a mpio device
If it does belong to the device then we make sure we mount the mpio device instead of
the raw device.

Heuristics
Login into /dev/disk/by-path/iqn-example.com.2999 -> /dev/sde
Check if sde existsin in /sys/block/[dm-X]/slaves/xx
If it does mount /dev/[dm-x] which will look like /dev/mapper/mpiodevicename in mount

examples/iscsi has more details
2016-04-20 09:42:11 +08:00
Chakravarthy Nelluri f53bc4ebe0 Flexvolume: Add support for multiple secrets 2016-04-15 02:40:38 -07:00
k8s-merge-robot acf9492cb1 Merge pull request #23660 from goltermann/vetclean
Automatic merge from submit-queue

Additional go vet fixes

Mostly:
- pass lock by value
- bad syntax for struct tag value
- example functions not formatted properly
2016-04-12 06:22:16 -07:00
Saad Ali d7b069fbcc Merge pull request #23793 from pmorie/configmap-nonroot
Make ConfigMap volume readable as non-root
2016-04-06 15:11:25 -07:00
goltermann 696423e044 Vet fixes, mostly pass lock by value errors. 2016-04-06 11:27:40 -07:00
Paul Morie e838ff2893 Make ConfigMap volume readable as non-root 2016-04-05 12:20:52 -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
Vishnu kannan 9e5ddcb822 Do not track resource usage for host path volumes. They can contain loops.
Signed-off-by: Vishnu kannan <vishnuk@google.com>
2016-03-24 12:05:08 -07:00
k8s-merge-robot f3fbd64927 Merge pull request #23334 from thockin/volume-maintainers
Auto commit by PR queue bot
2016-03-24 00:17:19 -07:00
k8s-merge-robot 76369c42be Merge pull request #22939 from resouer/util-sub-dir
Auto commit by PR queue bot
2016-03-23 03:34:33 -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
Sami Wagiaalla 33a416e98f Set ownership to fsGroup in gitrepo 2016-03-15 12:20:48 -04: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
harry 5b359213b1 Refactor env into sub pkg
Refactor env into sub pkg
2016-03-11 13:52:45 +08:00
k8s-merge-robot 65605023d5 Merge pull request #22602 from justinsb/multizone_label_dynamic_pvs
Auto commit by PR queue bot
2016-03-10 21:19:05 -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
Yang Meng a5189d8bd1 update mountpath of volume after migration 2016-03-07 18:00:06 +08:00
k8s-merge-robot 791c694c21 Merge pull request #22132 from pmorie/remove-atomic-sentinel
Auto commit by PR queue bot
2016-03-05 12:06:16 -08:00
k8s-merge-robot 3c5b57b217 Merge pull request #21805 from childsb/CanSupport_fix
Auto commit by PR queue bot
2016-03-05 10:09:35 -08:00
k8s-merge-robot b198c820cd Merge pull request #22402 from erictune/psp-simplify
Auto commit by PR queue bot
2016-03-05 07:55:19 -08:00
Eric Tune 4d090bfb09 Rename PodSecurityPolicy fields
In podSecurityPolicy:
1. Rename .seLinuxContext to .seLinux
2. Rename .seLinux.type to .seLinux.rule
3. Rename .runAsUser.type to .runAsUser.rule
4. Rename .seLinux.SELinuxOptions

1,2,3 as suggested by thockin in #22159.
I added 3 for consistency with 2.
2016-03-03 11:49:48 -08:00
k8s-merge-robot ad69472a48 Merge pull request #21583 from sjenning/rm-unused-func
Auto commit by PR queue bot
2016-03-03 03:48:15 -08:00
k8s-merge-robot d81d823ca5 Merge pull request #22393 from eparis/blunderbuss
Auto commit by PR queue bot
2016-03-02 18:51:56 -08:00
Eric Paris 5e5a823294 Move blunderbuss assignees into tree 2016-03-02 20:46:32 -05:00
Tim St. Clair 246b389275 Move test-only volume files to test-only volume package 2016-02-29 14:44:28 -08:00
Paul Morie 26471d5723 Remove sentinel file from atomic writer 2016-02-27 16:09:06 -05:00
k8s-merge-robot 18130824b2 Merge pull request #21758 from childsb/1308588
Auto commit by PR queue bot
2016-02-26 22:33:20 -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
childsb 8d4aa5d387 Run through gofmt -s 2016-02-25 13:00:12 -06: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
childsb 7fed6f9f47 Remove host command sniffing from CanSupport(..) 2016-02-23 17:13:14 -06:00
childsb 61f6c3bc13 Remove the check for a gluster specific binary in 'canSupport'. Causes problems in containerized kube. 2016-02-23 09:40:35 -06: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
k8s-merge-robot 11cdc919f5 Merge pull request #21364 from pwittrock/macdu
Auto commit by PR queue bot
2016-02-22 10:09:03 -08:00
Seth Jennings c3e707ea0f remove unused function 2016-02-19 15:19:15 -06:00
Paul Morie f8d58ac708 Make flake in configMap update e2e easier to debug 2016-02-19 15:01:20 -05:00
k8s-merge-robot eb45154996 Merge pull request #21348 from caesarxuchao/generate-fake-for-1-2
Auto commit by PR queue bot
2016-02-18 23:02:05 -08:00
Chao Xu ad46715f51 generate fake client for release_1_2 2016-02-17 16:10:02 -08:00
laushinka 7ef585be22 Spelling fixes inspired by github.com/client9/misspell 2016-02-18 06:58:05 +07:00
Phillip Wittrock 1e5175594d Fix volume secret_test.go on darwin by not checking volume usage metrics 2016-02-17 12:56:37 -08:00