Commit Graph

490 Commits (5ab082dc149031f39a24b6283c16c62486b90e32)

Author SHA1 Message Date
k8s-merge-robot 5760acf603 Merge pull request #29596 from matttproud/fix/time-leaks/remainder
Automatic merge from submit-queue

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.

Similar efforts were incrementally done in #29439 and #29114.

```release-note
* pkg/various: plugged various time.Ticker and time.Timer leaks.
```
2016-07-29 14:06:47 -07:00
k8s-merge-robot 15c0c2c901 Merge pull request #29532 from anish/iscsi_iface
Automatic merge from submit-queue

Check iscsi iface file for transport name

When checking for tcp vs hardware transports, check actual iscsi iface file to see if we are using tcp as a transport, rather than relying on just the transport name of 'default'.

This fixes the open-iscsi software iscsi initiator for non-default interfaces.
fixes #27131
2016-07-28 19:42:09 -07:00
k8s-merge-robot 62e7c57acc Merge pull request #29598 from matttproud/refactor/simplify/goroutinemap
Automatic merge from submit-queue

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 semantic.

The duration constants are already of type `time.Duration`, so
re-declaring that is redundant.

/CC: @saad-ali
2016-07-28 04:44:26 -07:00
k8s-merge-robot 1ae9b73cd3 Merge pull request #29673 from pmorie/mount-collision
Automatic merge from submit-queue

Fix mount collision timeout issue

Short- or medium-term workaround for #29555.  The root issue being fixed here is that the recent attach/detach work in the kubelet uses a unique volume name as a key that tracks the work that has to be done for each volume in a pod to attach/mount/umount/detach.  However, the non-attachable volume plugins do not report unique names for themselves, which causes collisions when a single secret or configmap is mounted multiple times in a pod.

This is still a WIP -- I need to add a couple E2E tests that ensure that tests break in the future if there is a regression -- but posting for early review.

cc @kubernetes/sig-storage 

Ultimately, I would like to refine this a bit further.  A couple things I would like to change:

1.  `GetUniqueVolumeName` should be a property ONLY of attachable volumes
2.  I would like to see the kubelet apparatus for attach/mount/umount/detach handle non-attachable volumes specifically to avoid things like the `WaitForControllerAttach` call that has to be done for those volume types now
2016-07-27 21:06:47 -07:00
k8s-merge-robot 75c93b4063 Merge pull request #29439 from matttproud/cleanups_volumeflocker
Automatic merge from submit-queue

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.

```release-note
* flockerMounter.updateDatasetPrimary no longer leaks running time.Ticker instances.
  Upon termination of the consuming routine, we stop the tickers.
```
2016-07-27 17:18:34 -07:00
Paul Morie c884297990 Fix collisions issues / timeouts for mounts
For non-attachable volumes, do not call GetVolumeName on the plugin and instead
generate a unique name based on the identity of the pod and the name of the volume
within the pod.
2016-07-27 17:53:50 -04:00
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