The test relied on a 100ms sleep to ensure that controller was done. If that
race was lost, one goroutine was intentionally prevented from completing by
locking a mutex permanently. A TODO was left about detecting that.
Adding goroutine leak checking in
https://github.com/kubernetes/kubernetes/pull/126387 revealed that this race
indeed sometimes is lost because the goroutine
leaked (https://github.com/kubernetes/kubernetes/issues/129400).
Waiting for controller shutdown instead of relying on timing should fix this.
* accept GINKGO_FLAGS for test-e2e-node.sh
* Update Makefile to document LABEL_FILTER
* --label-filter part of ginkgoflags
* Update Makefile
* if label-filter then avoid skip and focus defaults
* LABEL_FILTER can be empty
* Update build/root/Makefile
Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
* skip defaults only if label-filter not set
Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
* focus and label_fiter can live together
Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
* skip and label_filter can live together
Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
---------
Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
CreateOrRetain is supposed to operate on an object name which isn't
necessarily the given object's name (for use in migrations), this
restores that feature.
Replace all uses of deprecated functions with their generic variants.
Providing the context externally isn't useful right now, drop it from
the new functions and use context.Background() where needed.
Signed-off-by: Stephen Kitt <skitt@redhat.com>
This uses generics to generalise the various CreateOrUpdate,
CreateOrRetain etc. functions. Where appropriate, the context is added
as an initial argument to the new functions.
ConfigMapMutator isn't used anywhere else, so it's dropped in favour
of the private objectMutator added in this commit.
Signed-off-by: Stephen Kitt <skitt@redhat.com>
The context is used for cancellation and to support contextual logging.
In most cases, alternative *WithContext APIs get added, except for
NewIntegerResourceVersionMutationCache where code searches indicate that the
API is not used downstream.
An API break around SharedInformer couldn't be avoided because the
alternative (keeping the interface unchanged and adding a second one with
the new method) would have been worse. controller-runtime needs to be updated
because it implements that interface in a test package. Downstream consumers of
controller-runtime will work unless they use those test package.
Converting Kubernetes to use the other new alternatives will follow. In the
meantime, usage of the new alternatives cannot be enforced via logcheck
yet (see https://github.com/kubernetes/kubernetes/issues/126379 for the
process).
Passing context through and checking it for cancellation is tricky for event
handlers. A better approach is to map the context cancellation to the normal
removal of an event handler via a helper goroutine. Thanks to the new
HandleErrorWithLogr and HandleCrashWithLogr, remembering the logger is
sufficient for handling problems at runtime.