- Code generator: use len() != 0 for slice/map member extractors
instead of != nil, so empty slice/map are treated as "not set"
- Add slice and map members to union test types (both discriminated
and undiscriminated)
- Add test coverage for nil vs empty, ratcheting, and nil oldObj
with slice/map members
Co-authored-by: Tim Hockin <thockin@google.com>
- Use reflect.ValueOf(oldObj).IsZero() instead of IsNil() so union
validation works with non-nilable T (e.g. value types)
- Remove hasOldValue guard from inner loop conditionals; only check
at the final ratcheting skip point
- Add doc comments explaining T is "any" rather than "comparable"
because union members can be slices
- Add value-type subtests for Union and DiscriminatedUnion
Co-authored-by: Tim Hockin <thockin@google.com>
Test that declarative validation catches a DeviceAttribute with no
value fields set, which was the original bug scenario where union
ratcheting incorrectly skipped validation for new map entries.
Add tests for Union, DiscriminatedUnion, and ZeroOrOneOfUnion
validating that nil oldObj (new map entry or newly-set pointer
field during update) does not skip validation via ratcheting.
When oldObj is nil (e.g. new map entry added during update), union
ratcheting incorrectly treats nil old and empty new as unchanged
membership, skipping validation entirely. Fix by checking
reflect.ValueOf(oldObj).IsNil() and disabling ratcheting when
oldObj is nil, so the new value is fully validated.
This affects Union, DiscriminatedUnion, and ZeroOrOneOfUnion
(via unionValidate).
When a pod has a sidecar (initContainer with restartPolicy: Always) with
a startupProbe, and one or more regular containers crash after a kubelet
restart, the kubelet fails to restart the regular containers. RestartCount
stays at 0 indefinitely.
When ChangeContainerStatusOnKubeletRestart is disabled (default in v1.35),
the prober worker skips seeding probe results for containers that predate
the kubelet restart. For a sidecar with a startupProbe this means
startupManager.Get() returns found=false permanently. In
computeInitContainerActions, the sidecar Running case breaks out early at
the !found check, leaving podHasInitialized=false. computePodActions then
returns early at the !hasInitialized guard without restarting the crashed
regular containers.
Fix: when the gate is off and a restartable init container's startup probe
is being seeded for the first time after a kubelet restart, check the
container's Started field in the pod status. If Started=true, the sidecar
had already passed startup before the restart, so seed the startup manager
with Success. This allows computeInitContainerActions to detect pod
initialization via the sidecar Running path without altering readiness or
liveness probe seeding behaviour.
Add and update tests to cover the fix:
- worker unit tests for sidecar startup/readiness/liveness restart behaviour
- e2e node regression test for sidecar with startupProbe across kubelet restart
Fixes: https://github.com/kubernetes/kubernetes/issues/136910
If /var/lib/kubelet is MS_SHARED mountpoint, all the mountpoints
under /var/lib/kubelet will have duplicate one. When `kubeadm reset -f`
is executed, it will try to umount one path twice. However, they are in
the peer group. Once we umount one path, the duplicate one will be
umounted as well. So, in this case, we should ignore EINVAL error.
Signed-off-by: Wei Fu <fuweid89@gmail.com>
(cherry picked from commit 2634261c17)
Signed-off-by: Wei Fu <fuweid89@gmail.com>
The test uses an invalid image to induce a pull error. The previous image
name 'some-image-that-doesnt-exist' causes slow DNS/registry resolution
on some environments (especially metal), leading to 30s timeouts.
Using 'localhost/some-image-that-does-not-exist' makes the pull fail
instantly since there is no registry on localhost, avoiding flaky
timeouts.
we only use the rules in the master branch
since we don't need rules.yaml, we don't have two places to match, so we can drop the golang version entirely from this file
bump .go-version alone will be sufficient* on release branches after https://github.com/kubernetes/kubernetes/pull/136954
* ignoring e2e images like agnhost, which will require follow-up PRs ...
NewSimpleClientset was marked as deprecated when NewClientset was
introduced. This has caused some confusion:
- Not all packages have NewClientset (https://github.com/kubernetes/kubernetes/issues/135980).
- Tests that work with NewSimpleClientset fail when
switched to NewClientset (https://github.com/kubernetes/kubernetes/issues/136327)
because of missing CRD support (https://github.com/kubernetes/kubernetes/issues/126850).
It doesn't seem burdensome to keep NewSimpleClientset around forever. Some unit
tests may even prefer to use it when they don't need server-side apply (less
overhead). Therefore there is no need to deprecate it.
This avoids churn in the eco system because contributors no longer create PRs
"because the linter complains about the usage of a deprecated function".