Commit Graph

460 Commits (d6b3dcf5ab8e05a7f17245d77aa71ac0fd954282)

Author SHA1 Message Date
Kubernetes Submit Queue 027d0fcfdf
Merge pull request #67062 from cofyc/fix66287
Automatic merge from submit-queue (batch tested with PRs 67062, 67169, 67539, 67504, 66876). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Double check PVC if not found in syncVolume

**What this PR does / why we need it**:

Double check PVC if not found in syncVolume.
    
If PV is bound by external PV binder (e.g. kube-scheduler), it's possible on heavy load that corresponding PVC is not synced to controller local cache yet.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #66287

**Special notes for your reviewer**:

**Release note**:

```release-note
Double check PVC if not found in syncVolume to prevent reclaiming PV wrongly.
```
2018-08-17 11:58:06 -07:00
Yecheng Fu 493502d0ae Double check PVC if not found in syncVolume.
If PV is bound by external PV binder (e.g. kube-scheduler), it's
possible on heavy load that corresponding PVC is not synced to
controller local cache yet.
2018-08-16 10:33:28 +08:00
Kubernetes Submit Queue 4414ae3d75
Merge pull request #66666 from bertinatto/metrics_ad_controller
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add more metrics for A/D Controller:

**What this PR does / why we need it**:

This PR adds a few metrics described in the [Metrics Spec](https://docs.google.com/document/d/1Fh0T60T_y888LsRwC51CQHO75b2IZ3A34ZQS71s_F0g/edit#heading=h.ys6pjpbasqdu):

* Number of Volumes in ActualStateOfWorld and DesiredStateOfWorld
* Number of times A/D Controller performs force detach

**Release note**:

```release-note
NONE
```
2018-08-15 09:42:06 -07:00
Kubernetes Submit Queue c5e74d128d
Merge pull request #66884 from NickrenREN/attacher-detacher-refactor
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Attacher/Detacher refactor for local storage

Proposal link: https://github.com/kubernetes/community/pull/2438

**What this PR does / why we need it**:

Attacher/Detacher refactor for the plugins which just need to mount device, but do not need to attach, such as local storage plugin.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

```release-note
Attacher/Detacher refactor for local storage
```

/sig storage
/kind feature
2018-08-15 07:03:48 -07:00
Fabio Bertinatto 4ce2058ef6 Add more metrics for A/D Controller:
* Number of Volumes in ActualStateofWorld and DesiredStateofWorld
* Numer of times A/D Controller performs force detach
2018-08-15 10:01:57 +02:00
Kubernetes Submit Queue d655c9a873
Merge pull request #66923 from jarrpa/pvc-protect-until-pod-delete
Automatic merge from submit-queue (batch tested with PRs 66491, 66587, 66856, 66657, 66923). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

PVC Protection: Wait for Pod delete

Currently, the PVC protection controller will remove its finalizer when
all Pods using a PVC reach at least a Terminating state. However,
certain volumes cannot be guaranteed to be umounted until a Pod is
deleted. Only Pods not in the current pods list can be considered
deleted, so we're removing the exception to not check Terminating Pods.

```release-note
NONE
```

Resolves: #65552

Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
2018-08-14 17:55:17 -07:00
Kubernetes Submit Queue cd786bda64
Merge pull request #66863 from cofyc/fix64549
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

attachdetach controller: attach volumes immediately when Pod's PVCs are bound

**What this PR does / why we need it**:

Let attachdetach controller to attach volumes immediately when Pod's PVCs are bound.

Current attachdetach controller calls `util.ProcessPodVolume` to add pod volumes into `desiredStateOfWorld` on these events:

- podAdd event
- podUpdate event
- podDelete event
- periodical `desiredStateOfWorldPopulator.findAndAddActivePod`

But if a pod is created with PVCs not bound, no volumes will be added into `desiredStateOfWorld` [because PVCs not bound](https://github.com/kubernetes/kubernetes/blob/v1.12.0-alpha.0/pkg/controller/volume/attachdetach/util/util.go#L99). When pv controller binds PVCs successfully, attachdetach controller will not add pod volumes immediately because it does not watch on PVC events.

It will wait until a pod update event is triggered (normally will not happen because no new status will be reported by kubelet) or `desiredStateOfWorldPopulator.findAndAddActivePod` is called (maybe 0~3 minutes later, see [timer configs](https://github.com/kubernetes/kubernetes/blob/v1.12.0-alpha.0/pkg/controller/volume/attachdetach/attach_detach_controller.go)).

In bad case, pod start time will be very long (~3 minutes + ~2 minutes (kubelet max exponential backoff)), for example: https://github.com/kubernetes/kubernetes/issues/64549#issuecomment-409440546.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #64549

**Special notes for your reviewer**:

**Release note**:

```release-note
attachdetach controller attaches volumes immediately when Pod's PVCs are bound
```
2018-08-14 13:46:35 -07:00
NickrenREN 81e360d20f update volume plugins accordingly 2018-08-14 11:12:54 +08:00
Jose A. Rivera 13462bf341 PVC Protection: Wait for Pod delete
Currently, the PVC protection controller will remove its finalizer when
all Pods using a PVC reach at least a Terminating state. However,
certain volumes cannot be guaranteed to be umounted until a Pod is
deleted. Only Pods not in the current pods list can be considered
deleted, so we're removing the exception to not check Terminating Pods.

Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
2018-08-13 13:57:36 -05:00
Yecheng Fu 5fafae11d8 attachdetach controller: attach volumes immediately when Pod's PVCs are bound
- Use queue to process PVCs on add/update events
- Index pods by PVC key then we don't need to iterate to find pods
2018-08-14 01:03:13 +08:00
Kubernetes Submit Queue f4d8220df5
Merge pull request #65616 from cofyc/fix56163
Automatic merge from submit-queue (batch tested with PRs 65570, 65616). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Retry scheduling on StorageClass events

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #56163

**Special notes for your reviewer**:

I have taken over #60006.
It's hard to test in e2e, because we cannot know reschedule of pod is triggered by which event (periodically service/node events will move pods to active queue too). ~~I'll add integration tests for this functionality after [this PR](https://github.com/kubernetes/kubernetes/pull/65296) get merged.~~ (already added)

**Release note**:

```release-note
NONE
```
2018-07-31 19:18:00 -07:00
Ardalan Kangarlou ee747b8649 Changed admission controller to allow volume expansion for all volume plugins
There are two motivations for this change:
(1) CSI plugins are soon going to support volume expansion. For such
plugins, admission controller doesn't know whether the plugins are
capabale of supporting volume expansion or not.
(2) Currently, admission controller rejects PVC updates for in-tree plugins
that don't support volume expansion (e.g., NFS, iSCSI). This change allows
external controllers to expand volumes similar to how external provisioners
operate.
2018-07-27 03:06:48 -04:00
Yecheng Fu 8f0373792f Retry scheduling on various events. 2018-07-20 09:54:34 +08:00
Fabio Bertinatto a15cc29442 Add extra metrics for PV Controller
Specifically:

* Total provision time
* Total PV deletion time
* Number of times PV provisioning failed
* Number of times PV deletion failed
2018-07-19 15:36:37 +02:00
Fabio Bertinatto 97e63985dc Return error in provisionClaimOperation 2018-07-19 15:27:40 +02:00
Jonathan Pentecost b4cab1be0e persistentvolume: fix spelling of storageClasseName
Fixed spelling of error in 'pv_controller', was 'storageClasseName', is
now 'storageClassName'.
2018-07-17 14:34:51 +01:00
Kubernetes Submit Queue 0972ce1acc
Merge pull request #65649 from rsc/fix-printf
Automatic merge from submit-queue (batch tested with PRs 66076, 65792, 65649). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

kubernetes: fix printf format errors

These are all flagged by Go 1.11's
more accurate printf checking in go vet,
which runs as part of go test.

```release-note
NONE
```
2018-07-11 14:09:08 -07:00
Russ Cox 2bd91dda64 kubernetes: fix printf format errors
These are all flagged by Go 1.11's
more accurate printf checking in go vet,
which runs as part of go test.

Lubomir I. Ivanov <neolit123@gmail.com>
applied ammend for:
  pkg/cloudprovider/provivers/vsphere/nodemanager.go
2018-07-11 00:10:15 +03:00
Tim Allclair b1012b2543
Remove unused io util writer & volume host GetWriter() 2018-07-09 14:09:48 -07:00
Matthew Wong ddba1b5811 Remove crappy fmt.Println 2018-07-06 12:54:34 -04:00
Kubernetes Submit Queue 8d73473ce8
Merge pull request #65774 from lichuqiang/add_reviewer
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add lichuqiang as reviewer of persistentvolume controller (for volume scheduling)

Now that I've been working on the storage topology-aware feature for quite a time. Really hope that I can help do some review.

```release-note
NONE
```

/assign @msau42
2018-07-03 11:31:12 -07:00
lichuqiang 67380c63aa Add lichuqiang as reviewer of persistentvolume controller (for volume scheduling) 2018-07-04 00:35:54 +08:00
Hemant Kumar 8d46912e7f Add metrics for attachable volumes in use 2018-06-28 11:50:51 -04:00
Jeff Grafton 23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
Michal Fojtik 97f546d249
volume: decrease memory allocations for debugging messages 2018-06-11 13:52:38 +02:00
Kubernetes Submit Queue c615098a96
Merge pull request #63193 from lichuqiang/provision_0425
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Volume topology aware dynamic provisioning: work based on new API

**What this PR does / why we need it**:

The PR has been split to 3 parts:

Part1: https://github.com/kubernetes/kubernetes/pull/63232 for basic scheduler and PV controller plumbing
Part2: https://github.com/kubernetes/kubernetes/pull/63233 for API change

and the PR itself includes work based on the API change:

- Dynamic provisioning allowed topologies scheduler work
- Update provisioning interface to be aware of selected node and topology

**Which issue(s) this PR fixes** 
Feature: https://github.com/kubernetes/features/issues/561
Design: https://github.com/kubernetes/community/issues/2168

**Special notes for your reviewer**:
/sig storage
/sig scheduling
/assign @msau42 @jsafrane @saad-ali @bsalamat

@kubernetes/sig-storage-pr-reviews
@kubernetes/sig-scheduling-pr-reviews

**Release note**:

```release-note
Volume topology aware dynamic provisioning
```
2018-06-05 15:31:58 -07:00
lichuqiang bccc8fe979 Provision interface change 2018-06-05 16:35:16 +08:00
lichuqiang dffbd75f86 Dynamic provisioning allowed topologies scheduler work 2018-06-05 16:10:12 +08:00
Mike Danese 91feb345aa implement service account token projection 2018-06-04 17:22:08 -07:00
lichuqiang 446f36559e pv_controller change for provisioning 2018-05-24 17:12:38 +08:00
lichuqiang 95b530366a Add dynamic provisioning process 2018-05-24 17:12:38 +08:00
lichuqiang 91d403f384 cache update for dynamic provisioning 2018-05-24 17:12:12 +08:00
Kubernetes Submit Queue 680e00a656
Merge pull request #63692 from msau42/debug-scheduler
Automatic merge from submit-queue (batch tested with PRs 60012, 63692, 63977, 63960, 64008). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Only override objects from informer when version has increased.

**What this PR does / why we need it**:
We don't want an informer resync to override assumed volumes if the version has not increased.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #63467

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-18 23:35:17 -07:00
Michelle Au 2142737276 Only override objects from informer when version has increased.
Add more logging and tests to volume scheduler.
2018-05-17 16:46:20 -07:00
Kubernetes Submit Queue 0ae403d727
Merge pull request #57536 from linyouchong/linyouchong-20171222
Automatic merge from submit-queue (batch tested with PRs 57536, 63812). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

fix spelling error in comment
2018-05-14 19:44:07 -07:00
Kubernetes Submit Queue 7eb88f11d2
Merge pull request #59727 from wgliang/master.time
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

should use time.Since instead of time.Now().Sub

**What this PR does / why we need it**:
should use time.Since instead of time.Now().Sub

**Special notes for your reviewer**:
2018-05-10 20:29:40 -07:00
linyouchong c2661854b5
Update pvc_protection_controller.go 2018-04-27 14:17:11 +08:00
linyouchong 16141a1fbf
Merge branch 'master' into linyouchong-20171222 2018-04-27 14:15:53 +08:00
Kubernetes Submit Queue afa68cc287
Merge pull request #62886 from msau42/fix-localssd-fsgroup
Automatic merge from submit-queue (batch tested with PRs 62780, 62886). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Only count local mounts that are from other pods

**What this PR does / why we need it**:
In GCE, we mount the same local SSD in two different paths (for backwards compatability).  This makes the fsGroup conflict check fail because it thinks the 2nd mount is from another pod.  For the fsgroup check, we only want to detect if other pods are mounting the same volume, so this PR filters the mount list to only those mounts under "/var/lib/kubelet".

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #62867

**Release note**:

```release-note
NONE
```
2018-04-20 20:06:13 -07:00
Pavel Pospisil d3ddf7eb8b Always Start pvc-protection-controller and pv-protection-controller
After K8s 1.10 is upgraded to K8s 1.11 finalizer [kubernetes.io/pvc-protection] is added to PVCs
because StorageObjectInUseProtection feature will be GA in K8s 1.11.
However, when K8s 1.11 is downgraded to K8s 1.10 and the StorageObjectInUseProtection feature is disabled
the finalizers remain in the PVCs and as pvc-protection-controller is not started in K8s 1.10 finalizers
are not removed automatically from deleted PVCs and that's why deleted PVC are not removed from the system
but remain in Terminating phase.
The same applies to pv-protection-controller and [kubernetes.io/pvc-protection] finalizer in PVs.

That's why pvc-protection-controller is always started because the pvc-protection-controller removes finalizers
from PVCs automatically when a PVC is not in active use by a pod.
Also the pv-protection-controller is always started to remove finalizers from PVs automatically when a PV is not
Bound to a PVC.

Related issue: https://github.com/kubernetes/kubernetes/issues/60764
2018-04-20 19:54:50 +02:00
Michelle Au 6cf8a6606c Only count mounts that are from other pods 2018-04-19 15:40:51 -07:00
Kubernetes Submit Queue efadf7b9e7
Merge pull request #61877 from mikedanese/depeid
Automatic merge from submit-queue (batch tested with PRs 62481, 62643, 61877, 62515). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

remove deprecated ExternalID

This field has been deprecated since 1.1. After we remove it we can remove "self delete" from the node's permission set.

@kubernetes/api-reviewers 
@kubernetes/sig-auth-pr-reviews 

fixes https://github.com/kubernetes/kubernetes/issues/61966
part of https://github.com/kubernetes/community/pull/911

```release-note
Kubelets will no longer set `externalID` in their node spec.
```
2018-04-18 17:53:16 -07:00
Kubernetes Submit Queue b758341a04
Merge pull request #62646 from cofyc/reporteventtoapiserver
Automatic merge from submit-queue (batch tested with PRs 62694, 62569, 62646, 61633, 62433). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Report events to apiserver in local volume plugin.

**What this PR does / why we need it**:

See https://github.com/kubernetes/kubernetes/pull/62102#discussion_r179238429.

Report events to apiserver in local volume plugin.

- Add VolumeHost.GetEventRecorder() method
- Add related e2e tests

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #62248

**Special notes for your reviewer**:

Example output of `kubectl describe pods`:

```
Events:
  Type     Reason                 Age   From                Message
  ----     ------                 ----  ----                -------
  Normal   Scheduled              7s    default-scheduler   Successfully assigned e2e-tests-persistent-local-volumes-test-x4h5x/security-context-670da435-4174-11e8-9098-000c29bb0377 to 127.0.0.1
  Warning  AlreadyMountedVolume   7s    kubelet, 127.0.0.1  The requested fsGroup is 4321, but the volume local-pvfbb76 has GID 1234. The volume may not be shareable.
  Normal   SuccessfulMountVolume  7s    kubelet, 127.0.0.1  MountVolume.SetUp succeeded for volume "default-token-996xr"
  Normal   SuccessfulMountVolume  7s    kubelet, 127.0.0.1  MountVolume.SetUp succeeded for volume "local-pvfbb76"
  Normal   Pulled                 6s    kubelet, 127.0.0.1  Container image "k8s.gcr.io/busybox:1.24" already present on machine
  Normal   Created                6s    kubelet, 127.0.0.1  Created container
  Normal   Started                6s    kubelet, 127.0.0.1  Started container
```

**Release note**:

```release-note
NONE
```
2018-04-18 14:44:17 -07:00
Mike Danese f427531179 boring 2018-04-18 09:55:57 -07:00
Yecheng Fu 55ef18ad42 Report events to apiserver in local volume plugin.
- Add VolumeHost.GetEventRecorder() method
- Add related e2e tests
2018-04-18 11:19:36 +08:00
Kubernetes Submit Queue 8de8ca7bc8
Merge pull request #59947 from mkimuram/issue/59942
Automatic merge from submit-queue (batch tested with PRs 62448, 59317, 59947, 62418, 62352). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add binding error message for volumeMode:Block unsupported case

**What this PR does / why we need it**:
This PR adds a binding error message for volumeMode:Block
unsupported case.
With this message, users can understand why PV is not bound to
PVC on dynamic provisioning.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes: #59942

**Special notes for your reviewer**:
/cc @mtanino 
/sig storage

**Release note**:

```release-note
NONE
```
2018-04-17 16:31:21 -07:00
mkimuram 0ee71f0cc2 Add binding error message for volumeMode:Block unsupported case
This commit adds a binding error message for volumeMode:Block
unsupported case.
With this message, users can understand why PV is not bound to
PVC on both dynamic provisioning and manually creating volume.

This patch works as follows:

- In syncVolume, before adding the claim to claimQueue, check if
  there is a volumeMode mismatch, and if there is, record the
  event for both pv and pvc and skip adding to the queue.

fixes: #59942
2018-04-16 15:22:35 -04:00
Kubernetes Submit Queue 4d8e5d5d7e
Merge pull request #62483 from msau42/owners
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add msau42 to approvers for volume scheduling

**What this PR does / why we need it**:
Add me as an approver for the volume scheduling code

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-13 06:10:20 -07:00
Kubernetes Submit Queue 39e9d1b483
Merge pull request #62324 from WanLinghao/unused_function_clean
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

unused function clean

**What this PR does / why we need it**:
clean unused function in file 
pkg/controller/volume/persistentvolume/scheduler_binder_test.go

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-12 12:39:58 -07:00
Michelle Au 3b038bfebc Add msau42 to approvers for volume scheduling 2018-04-12 11:09:28 -07:00