Test_Run_OneVolumeDetachOnOutOfServiceTaintedNode and Test_Run_Positive_OneDesiredVolumeAttachThenDetachWithMountedVolume call testForceDetachMetric with a default of 1. However, depending how the functions are run the value of the ForceDetachMetricCounter may not be 1. This commit changes the testForceDetachMetric invocation in these two functions to fetch the value of ForceDetachMetricCounter at the start of the function and then use that in the call to testForceDetachMetric, similar to Test_Run_OneVolumeDetachOnUnhealthyNodeWithForceDetachOnUnmountDisabled.
- Increase the global level for broadcaster's logging to 3 so that users can ignore event messages by lowering the logging level. It reduces information noise.
- Making sure the context is properly injected into the broadcaster, this will allow the -v flag value to be used also in that broadcaster, rather than the above global value.
- test: use cancellation from ktesting
- golangci-hints: checked error return value
The informer is not initialized, so no assertion performed before. Fixed this now.
Then fixed the test failure by using NewAttachDetachController to initialize adc.
Volume that failed Detach() should not be marked as attached, CSI
external-attacher is probably still trying to detach it.
Mark it uncertain instead and wait for Detach() to succeed.
PVC and containers shared the same ResourceRequirements struct to define their
API. When resource claims were added, that struct got extended, which
accidentally also changed the PVC API. To avoid such a mistake from happening
again, PVC now uses its own VolumeResourceRequirements struct.
The `Claims` field gets removed because risk of breaking someone is low:
theoretically, YAML files which have a claims field for volumes now
get rejected when validating against the OpenAPI. Such files
have never made sense and should be fixed.
Code that uses the struct definitions needs to be updated.
The GetDefaultClass() was fixed in scope of this issue:
https://github.com/kubernetes/kubernetes/issues/110514
Before this change assignDefaultStorageClass() was ignoring errors from
this function since it could mean there are multiple defaults - assign
could safely continue and do nothing.
This is no longer true because we always choose one from multiple
defaults - any errors returned from GetDefaultClass() are real errors
and should not be ignored.
Since the feature is GA and locked to true, tests can no longer set it
to false. Cleaning up by removing all references to this feature gate
from tests.
Feature gate will be removed in v1.29.