Replaced the Manager interface with a simple struct. There was no need for the
interface.
Replaced the global instance of the DRA plugins store with a fresh instanced
owned by the manager. This makes unit testing a bit easier (no need to restore
state, would enable parallelizing long-running tests).
Simplified the plugin.PluginsStore type to just "plugin.Store" because it
stuttered. The Plugin type is kept because having one struct named after its
package is one common exception from the "don't stutter" guideline.
For the sake of clarify, the package gets imported as "draplugin" (=
<parent dir>/<package>).
Removed unused NewManager "node" parameter and replaced direct construction of
cache and manager with calls to NewManager because that is how the manager
should get constructed (less code, too).
Fixed incorrect description of Manager: the plugin store is the entity which
manages drivers, not the manager. The manager is focused on the DRA logic
around ResourceClaims.
This moves the enabled/disabled test into the common test/integration/dra which
simplifies the code a bit and amortizes the cost of starting the apiserver
because several different tests can use the same instance, running in parallel.
While at it, setting the status via SSA also gets tested.
If preparing for a pod failed because the driver was not registered, it failed
after already having added the pod and claim to the claim info cache. The
effect was that deletion of the pod was blocked until the driver got
installed. Other errors had a similar effect. Now as many errors as possible
are checked in a read-only loop before proceeding to changing the claim info
cache.
The error message that was surfaced for the problem was not very readable:
Failed to prepare dynamic resources: failed to get gRPC client for driver dra-1411.k8s.io: plugin name dra-1411.k8s.io not found in the list of registered DRA plugins
To address this, error messages and wrapping get updated according to these
guidelines:
// Most errors returned by the manager show up in the context of a pod.
// They try to adher to the following convention:
// - Don't include the pod.
// - Use terms that are familiar to users.
// - Don't include the namespace, it can be inferred from the context.
// - Avoid repeated "failed to ...: failed to ..." when wrapping errors.
// - Avoid wrapping when it does not provide relevant additional information to keep the user-visible error short.
In controller-runtime it is generally not expected to do any sort of
scheme registration if unstructured.Unstructured is used. To make this
work in the fakeclient, the fakeclient will register unstructured to
scheme if the scheme doesn't recognize the GVK.
This currently doesn't work with the `ManagedFieldsObjectTracker` as it
never reloads the scheme. This change makes it reload the scheme in an
inefficient but simple manner, which should be good enough for unit
tests.
* Move the autoscaling e2e tests to be ran in parallel to have coverage for concurrent hpa processing
* Move the autoscaling e2e tests to be ran in parallel to have coverage for concurrent hpa processing
* Update autoscaling_utils.go
The package is unmaintained, and kubelet doesn't appear to rely on the
functionality it provides on top of Golang errors (stack traces).
Signed-off-by: Stephen Kitt <skitt@redhat.com>
This can happen when a test is run in a cluster where a required feature gate
is turned off. Letting the test continue then fails less clearly. For example,
a test for partitionable devices runs with ResourceSlices which don't have
the additional fields for partitionable devices.