Commit Graph

899 Commits

Author SHA1 Message Date
neogopher
400c8f71cf docs: Correct the log message for pv controller to make it more accurately descriptive 2022-10-30 23:17:55 +05:30
Roman Bednar
42422a1d16 add a metric for retroactive sc errors 2022-10-25 15:09:16 +02:00
danishprakash
f10f4d372c
pv_controller: update tests for multiple storageclasses
Signed-off-by: danishprakash <grafitykoncept@gmail.com>
2022-10-19 09:33:44 +05:30
Kubernetes Prow Robot
deb6712358
Merge pull request #113137 from RomanBednar/restart-sync-unbound
restart claim sync when PVC is updated
2022-10-18 07:33:19 -07:00
Roman Bednar
f5693a4008 restart claim sync when PVC is updated
We should not rely on syncUnboundClaim() to do nothing after it updates
PVC with a default storage class until next re-sync but instead restart
the sync explicitly to make sure we hit isDelayBindingMode() and
findBestMatchForClaim() immediately right after the PVC update.
2022-10-17 14:05:39 +02:00
Han Kang
2bbd445f50 remove rate limiter metric as it is not in use
Change-Id: I91157653e3860eeecc3f572aee88da6ffc65faed
2022-10-13 13:07:11 -07:00
Humble Chirammal
4bafd53a02 Correct typos in pkg/controller/volume
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2022-09-16 16:50:20 +05:30
Kubernetes Prow Robot
69136c0c81
Merge pull request #111894 from wongma7/pvcnpd
Fix PVC nil pointer dereference during migration-enabled volume expand
2022-08-23 20:08:37 -07:00
Kubernetes Prow Robot
9451747366
Merge pull request #111690 from piroux/pv-controller-tests-structs-with-names
Pv controller tests structs with names
2022-08-23 17:17:26 -07:00
Kubernetes Prow Robot
3ac0e24940
Merge pull request #111205 from 249043822/br-volumeattach
Fix problem in updating VolumeAttached in node status
2022-08-23 16:05:09 -07:00
Matthew Wong
a322a708f3 Fix PVC nil pointer dereference during migration-enabled volume expand 2022-08-17 11:32:22 -07:00
Omer Tuchfeld
eb317ecd40 Fix capture loop vars in parallel or ginkgo tests
Fixes instances of #98213 (to ultimately complete #98213 linting is
required).

This commit fixes a few instances of a common mistake done when writing
parallel subtests or Ginkgo tests (basically any test in which the test
closure is dynamically created in a loop and the loop doesn't wait for
the test closure to complete).

I'm developing a very specific linter that detects this king of mistake
and these are the only violations of it it found in this repo (it's not
airtight so there may be more).

In the case of Ginkgo tests, without this fix, only the last entry in
the loop iteratee is actually tested. In the case of Parallel tests I
think it's the same problem but maybe a bit different, iiuc it depends
on the execution speed.

Waiting for the CI to confirm the tests are still passing, even after
this fix - since it's likely it's the first time those test cases are
executed - they may be buggy or testing code that is buggy.

Another instance of this is in `test/e2e/storage/csi_mock_volume.go` and
is still failing so it has been left out of this commit and will be
addressed in a separate one
2022-08-15 16:28:50 +02:00
piroux
34b54e7646 Add struct keys in PV controller tests
Signed-off-by: piroux <pierre.roux01@gmail.com>
2022-08-04 17:01:36 +02:00
Jan Safranek
cdb3ead5a9 Add SupportsSELinuxContextMount
Add a new call to VolumePlugin interface and change all its
implementations.

Kubelet's VolumeManager will be interested whether a volume supports
mounting with -o conext=XYZ or not to hanle SetUp() / MountDevice()
accordingly.
2022-08-04 10:51:28 +02:00
Kubernetes Prow Robot
4b6134b6dc
Merge pull request #111090 from kinvolk/rata/userns-support-2022
Add support for user namespaces phase 1 (KEP 127)
2022-08-03 13:05:47 -07:00
Rodrigo Campos
d07c2688fe kubelet: add GetHostIDsForPod()
In future commits we will need this to set the user/group of supported
volumes of KEP 127 - Phase 1.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2022-08-03 19:53:22 +02:00
Kubernetes Prow Robot
90f9a52db6
Merge pull request #111467 from RomanBednar/retro-sc-assignment
Allow retroactive storage class assigment to PVCs
2022-08-02 15:05:57 -07:00
Kubernetes Prow Robot
369a465fae
Merge pull request #111301 from mattcary/migration-feature
Upgrade CSIMigrationGCE feature gate to GA
2022-08-02 13:58:57 -07:00
Roman Bednar
2f533cd572 add tests for pv controller 2022-08-02 20:52:04 +02:00
Roman Bednar
a0a5aa3680 allow retroactive storage class assignment in pv controller 2022-08-02 20:52:04 +02:00
Matthew Cary
e5d387c5d6 Upgrade CSIMigrationGCE feature gate to GA
Change-Id: I620bc4913765c0d6562eb1008216a72e8b0a2970
2022-08-02 09:14:27 -07:00
ZhangKe10140699
186ddce07b Fix problem in updating VolumeAttached in node status 2022-08-02 19:01:57 +08:00
Matthew Wong
777f43062c Remove unit tests that set & test CSIMigrationAWS false since it's now locked to true 2022-07-29 13:52:06 -07:00
Davanum Srinivas
a9593d634c
Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
Kubernetes Prow Robot
9cf4f15884
Merge pull request #110633 from wojtek-t/fix_leaking_goroutines_10
Fix leaking goroutines in multiple integration tests
2022-07-18 21:56:05 -07:00
Wojciech Tyczyński
13e4f2b554 Clean shutdown of volume integration tests 2022-07-14 11:25:57 +02:00
Abirdcfly
00b9ead02c cleanup: remove duplicate import
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-07-14 11:25:19 +08:00
Jan Safranek
3b94ac228a Don't force detach volume from healthy nodes
6 minute force-deatch timeout should be used only for nodes that are not
healthy. 

In case a CSI driver is being upgraded or it's simply slow, NodeUnstage
can take more than 6 minutes. In that case, Pod is already deleted from the
API server and thus A/D controller will force-detach a mounted volume,
possibly corrupting the volume and breaking CSI - a CSI driver expects
NodeUnstage to succeed before Kubernetes can call ControllerUnpublish.
2022-06-24 12:51:41 +02:00
Jiawei Wang
760365d5c9 CSIMigration feature gate to GA 2022-06-06 21:19:19 +00:00
Deepak Kinni
a7b1fcba40 Add or Remove PV deletion protection finalizer considering the recalimPolicy
Signed-off-by: Deepak Kinni <dkinni@vmware.com>
2022-04-07 00:48:35 +05:30
Hemant Kumar
a99466ca86 check existing size before querying new size from api-server 2022-03-28 11:32:49 -04:00
Hemant Kumar
ed217f4140 rename SetVolumeSize to InitializeVolumeSize 2022-03-28 11:32:49 -04:00
Hemant Kumar
7a43406138 Do not update PVC if it already has updated size 2022-03-28 11:32:49 -04:00
Hemant Kumar
e4f62d6c41 Modify code to use new interface functions 2022-03-28 11:32:49 -04:00
Ashutosh Kumar
c00975370a
Handle Non-graceful Node Shutdown (#108486)
Signed-off-by: Ashutosh Kumar <sonasingh46@gmail.com>

Co-authored-by: Ashutosh Kumar <sonasingh46@gmail.com>

Co-authored-by: xing-yang <xingyang105@gmail.com>
2022-03-26 09:23:21 -07:00
Deepak Kinni
836ace46a0 Default enable flag for beta feature HonorPVReclaimPolicy
Signed-off-by: Deepak Kinni <dkinni@vmware.com>
2022-03-26 06:48:28 +05:30
Konstantin Misyutin
438d224f0e Cleanup k8s.io/component-helpers/storage/volume package
Signed-off-by: Konstantin Misyutin <konstantin.misyutin@huawei.com>
2022-03-16 15:43:09 +08:00
Konstantin Misyutin
4ba98a8610 cleanup: remove unnecessary import aliases 2022-03-16 15:43:09 +08:00
Konstantin Misyutin
1d7cefe9c4 Move volume helpers to "k8s.io/component-helpers/storage/volume".
This patch aims to simplify decoupling "pkg/scheduler/framework/plugins"
from internal "k8s.io/kubernetes" packages. More described in
issue #89930 and PR #102953.

Some helpers from "k8s.io/kubernetes/pkg/controller/volume/persistentvolume"
package moved to "k8s.io/component-helpers/storage/volume" package:

- IsDelayBindingMode
- GetBindVolumeToClaim
- IsVolumeBoundToClaim
- FindMatchingVolume
- CheckVolumeModeMismatches
- CheckAccessModes
- GetVolumeNodeAffinity

Also "CheckNodeAffinity" from "k8s.io/kubernetes/pkg/volume/util"
package moved to "k8s.io/component-helpers/storage/volume" package
to prevent diamond dependency conflict.

Signed-off-by: Konstantin Misyutin <konstantin.misyutin@huawei.com>
2022-03-16 15:43:09 +08:00
Deepak Kinni
d37f14d0ae Support for in-tree PV Deletion protection finalizer
Signed-off-by: Deepak Kinni <dkinni@vmware.com>
2022-03-10 21:37:43 -08:00
Kubernetes Prow Robot
66daef4aa7
Merge pull request #108167 from jfremy/fix-107973
Fix nodes volumesAttached status not being updated
2022-03-01 12:49:54 -08:00
Kubernetes Prow Robot
06e107081e
Merge pull request #104732 from mengjiao-liu/remove-flag-experimental-check-node-capabilities-before-mount
kubelet: Remove the deprecated flag `--experimental-check-node-capabilities-before-mount`
2022-02-24 07:56:30 -08:00
Jean-Francois Remy
e83184568d Add unit tests
- actual_state_of_world_test.go: test the new method GetVolumesToReportAttachedForNode
  for an existing node and a non-existing node
- node_status_updater_test.go: test UpdateNodeStatuses and UpdateNodeStatuses in nominal
  case with 2 nodes getting one volume each. Test UpdateNodeStatuses with the first call
  to node.patch failing but the following one succeeding
- add comment in node_status_updater.go
- fix log line in reconciler.go
- rename variable in actual_state_of_world.go
2022-02-22 12:21:58 -08:00
Jean-Francois Remy
f1717baaaa Fix nodes volumesAttached status not updated
The UpdateNodeStatuses code stops too early in case there is
an error when calling updateNodeStatus. It will return immediately
which means any remaining node won't have its update status put back
to true.

Looking at the call sites for UpdateNodeStatuses, it appears this is
not the only issue. If the lister call fails with anything but a Not Found
error, it's silently ignored which is wrong in the detach path.
Also the reconciler detach path calls UpdateNodeStatuses but the real intent
is to only update the node currently processed in the loop and not proceed
with the detach call if there is an error updating that specifi node volumesAttached
property. With the current implementation, it will not proceed if there is
an error updating another node (which is not completely bad but not ideal) and
worse it will proceed if there is a lister error on that node which means the
node volumesAttached property won't have been updated.

To fix those issues, introduce the following changes:
- [node_status_updater] introduce UpdateNodeStatusForNode which does what
  UpdateNodeStatuses does but only for the provided node
- [node_status_updater] if the node lister call fails for anything but a Not
  Found error, we will return an error, not ignore it
- [node_status_updater] if the update of a node volumesAttached properties fails
  we continue processing the other nodes
- [actual_state_of_world] introduce GetVolumesToReportAttachedForNode which
  does what GetVolumesToReportAttached but for the node whose name is provided
  it returns a bool which indicates if the node in question needs an update as
  well as the volumesAttached list. It is used by UpdateNodeStatusForNode
- [actual_state_of_world] use write lock in updateNodeStatusUpdateNeeded, we're
  modifying the map content
- [reconciler] use UpdateNodeStatusForNode in the detach loop
2022-02-22 12:20:53 -08:00
yujunwang
8f96600907 perf:logic-optimiz-for-DetermineVolumeAction 2022-01-22 23:45:29 +08:00
Kubernetes Prow Robot
184daed0db
Merge pull request #107559 from liggitt/invalid-selectors
Handle invalid selectors properly
2022-01-19 14:49:31 -08:00
Jordan Liggitt
c0af728f43 Handle invalid selectors properly 2022-01-14 12:11:02 -05:00
Wojciech Tyczyński
551790729f Remove selflink references in different testing-related files 2022-01-14 12:58:05 +01:00
Patrick Ohly
9eaa2dc554 avoid klog Info calls without verbosity
In the following code pattern, the log message will get logged with v=0 in JSON
output although conceptually it has a higher verbosity:

   if klog.V(5).Enabled() {
       klog.Info("hello world")
   }

Having the actual verbosity in the JSON output is relevant, for example for
filtering out only the important info messages. The solution is to use
klog.V(5).Info or something similar.

Whether the outer if is necessary at all depends on how complex the parameters
are. The return value of klog.V can be captured in a variable and be used
multiple times to avoid the overhead for that function call and to avoid
repeating the verbosity level.
2022-01-12 07:48:36 +01:00
Mengjiao Liu
beda4cafb6 kubelet: Remove the deprecated flag --experimental-check-node-capabilities-before-mount 2022-01-06 11:47:11 +08:00