Commit Graph

10700 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
d86b74b017 Merge pull request #116575 from claudiubelu/fixes-kuberuntime-unittests
unit tests: Fixes kuberuntime unittests for Windows
2023-05-03 13:48:42 -07:00
Kubernetes Prow Robot
59caf65fff Merge pull request #117136 from claudiubelu/unittest-kubelet-server-journal-boot
unittests: Fixes server journal unit test on Windows
2023-05-03 12:02:20 -07:00
Claudiu Belu
561548e86c unit tests: Fixes kuberuntime unittests for Windows
InPlace Pod Vertical Scaling has been introduced as a feature recently,
and with it new unit tests. The feature does not have Windows support
yet, thus, the unit tests fail on Windows.

Fixes unit test which checks Linux-specific fields on Windows.
2023-05-02 20:25:42 +00:00
Kubernetes Prow Robot
2e78e07ee5 Merge pull request #117716 from thockin/validation_test_whitespace
Clean up brace whitespace in **/validation_test.go
2023-05-02 10:02:25 -07:00
Kubernetes Prow Robot
a2e2df61a1 Merge pull request #117198 from charles-chenzz/deprecated_function
replace ioutil with os, update doc in kubelet
2023-05-02 08:18:14 -07:00
Tim Hockin
d55b67b349 Clean up brace whitespace in **/validation_test.go
This was making my eyes bleed as I read over code.

I used the following in vim.  I made them up on the fly, but they seemed
to pass manual inspection.

:g/},\n\s*{$/s//}, {/
:w
:g/{$\n\s*{$/s//{{/
:w
:g/^\(\s*\)},\n\1},$/s//}},/
:w
:g/^\(\s*\)},$\n\1}$/s//}}/
:w
2023-05-02 00:48:42 -07:00
Kubernetes Prow Robot
19830bf51b Merge pull request #117627 from skitt/intstr-fromint32-cloud-node
kubelet: use new intstr functions
2023-05-01 23:42:22 -07:00
Kubernetes Prow Robot
544bd825f9 Merge pull request #117394 from sourcelliu/allowli
Remove unnecessary if judgments
2023-05-01 22:34:30 -07:00
Kubernetes Prow Robot
f5fff0f2bc Merge pull request #117105 from yoongon/feature/assert-order
Swap assert.Equal parameters oders to follow convention
2023-05-01 22:34:22 -07:00
Kubernetes Prow Robot
9121e82e64 Merge pull request #117050 from charles-chenzz/remove_seccomp
remove seccomp profile path on security context
2023-05-01 22:34:11 -07:00
Kubernetes Prow Robot
72afd8558e Merge pull request #117612 from saschagrunert/image-pull-errors
Fix image pull error type `ErrRegistryUnavailable`
2023-05-01 21:30:19 -07:00
Kubernetes Prow Robot
1241ddc567 Merge pull request #116376 from swatisehgal/device-mgr-recovery-wip
node: device-mgr: Handle recovery flow by checking if healthy devices exist- attempt 2
2023-05-01 21:30:11 -07:00
Mark Rossetti
ab9c8eb1e8 Removing WindowsHostProcessContainers feature-gate
Signed-off-by: Mark Rossetti <marosset@microsoft.com>
2023-05-01 13:30:38 -07:00
Stephen Kitt
0ee9f1b7a7 kubelet: replace intstr.FromInt with intstr.FromInt32
This touches cases where FromInt() is used on numeric constants, or
values which are already int32s, or int variables which are defined
close by and can be changed to int32s with little impact.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2023-05-01 09:17:35 +02:00
Swati Sehgal
dc1a592632 node: device-mgr: Handle recovery by checking if healthy devices exist
In case of node reboot/kubelet restart, the flow of events involves
obtaining the state from the checkpoint file followed by setting
the `healthDevices`/`unhealthyDevices` to its zero value. This is
done to allow the device plugin to re-register itself so that
capacity can be updated appropriately.

During the allocation phase, we need to check if the resources requested
by the pod have been registered AND healthy devices are present on
the node to be allocated.

Also we need to move this check above `needed==0` where needed is
required - devices allocated to the container (which is obtained from
the checkpoint file) because even in cases where no additional devices
have to be allocated (as they were pre-allocated), we still need to
make sure he devices that were previously allocated are healthy.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2023-04-28 14:41:30 +01:00
charles-chenzz
c96188a38b remove seccomp profile path 2023-04-26 20:08:06 +08:00
Sascha Grunert
4cdfe600e0 Fix image pull error type ErrRegistryUnavailable
The current error comparison `imagePullResult.err ==
ErrRegistryUnavailable` will never work with any remote runtime, because
we produce gRPC errors which wrap a code and a description, like:

```
rpc error: code = Unknown desc = This is the error description
```

To be able to check custom error types from `pkg/kubelet/images/types.go`,
we now strip the code if the status is unknown on image pull.

Beside that, we use a string comparison to check against
`ErrRegistryUnavailable.Error()`, because validating them via the
`errors` package is not yet supported by grpc-go:
https://github.com/grpc/grpc-go/issues/3616

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2023-04-26 11:02:47 +02:00
Kubernetes Prow Robot
7fe63a9b1a Merge pull request #116902 from sourcelliu/cast
Remove unnecessary int type conversion
2023-04-20 19:15:10 -07:00
Kubernetes Prow Robot
9d34ca5b66 Merge pull request #117276 from pacoxu/image-pull-event
kubelet: truncate the precision at a millisecond for image pull event message
2023-04-20 17:45:10 -07:00
Kubernetes Prow Robot
53cccbe4f9 Merge pull request #117019 from bobbypage/gh_116925
kubelet: Mark new terminal pods as non-finished in pod worker
2023-04-17 15:10:58 -07:00
Todd Neal
453f81d1ca kubelet: pass context to VolumeManager.WaitFor*
This allows us to return with a timeout error as soon as the
context is canceled.  Previously in cases where the mount will
never succeed pods can get stuck deleting for 2 minutes.

In the Sync*Pod methods that call VolumeManager.WaitFor*, we
must filter out wait.Interrupted errors from being logged as
they are part of control flow, not runtime problems. Any
early interruption should result in exiting the Sync*Pod method
as quickly as possible without logging intermediate errors.
2023-04-17 11:53:28 -05:00
mantuliu
ee99ca25ee Remove unnecessary if judgments 2023-04-16 23:55:31 +08:00
mantuliu
3b7c14e8cf Remove unnecessary int type conversion 2023-04-14 16:41:44 +08:00
Dan Winship
2bb35e08f4 Clarify kubelet/kube-proxy iptables rule skew constraints 2023-04-13 14:05:58 -04:00
Paco Xu
c042837a76 truncate the precision at a millisecond for image pull event message 2023-04-13 15:56:16 +08:00
charles-chenzz
db5d74935e optimize evict sandbox logic 2023-04-13 09:02:46 +08:00
charles-chenzz
ccf7ddacfc replace ioutil with os, update doc 2023-04-13 09:02:46 +08:00
Tim Hockin
bc302fa414 Replace uses of ObjectReflectDiff with cmp.Diff
ObjectReflectDiff is already a shim over cmp.Diff, so no actual output
or behavior changes
2023-04-12 08:48:03 -07:00
Tim Hockin
29c0b73d64 Replace uses of diff.ObjectDiff with cmp.Diff
ObjectDiff is already a shim over cmp.Diff, so no actual output or
behavior changes
2023-04-12 08:46:12 -07:00
Tim Hockin
dd7af241c1 Replace diff.ObjectDiff with cmp.Equal
More obvious and cheaper, and ObjectDiff is already written in terms of
cmp.
2023-04-12 08:45:32 -07:00
Kubernetes Prow Robot
2f1db33dd5 Merge pull request #116482 from smarterclayton/no_mutate
kubelet: Do not mutate pods in the pod manager
2023-04-12 02:22:32 -07:00
Kubernetes Prow Robot
74ad7c397d Merge pull request #116723 from SergeyKanzhelev/ExperimentalHostUserNamespaceDefaulting
deprecate ExperimentalHostUserNamespaceDefaulting
2023-04-11 21:16:57 -07:00
Kubernetes Prow Robot
006ad0576e Merge pull request #116560 from bart0sh/PR107-DRA-get-rid-of-extra-loops
DRA: get rid of unneeded loops over pod containers
2023-04-11 21:16:50 -07:00
Kubernetes Prow Robot
ce56fd7c8b Merge pull request #117152 from samuelkarp/godoc-typo
cpumanager: fix typo in godoc
2023-04-11 20:22:14 -07:00
Kubernetes Prow Robot
e7426a00c3 Merge pull request #117020 from cji/cji-seccomplocalhost
Fix seccomp localhost error handling
2023-04-11 19:18:15 -07:00
Kubernetes Prow Robot
036807ae35 Merge pull request #116995 from smarterclayton/pending_update
kubelet: Ensure pods that have not started track a pendingUpdate
2023-04-11 19:17:37 -07:00
Kubernetes Prow Robot
f46626364f Merge pull request #116833 from mpatlasov/fix-memleak-in-kubelet-volumemanager
Fix memory leak in kubelet volume_manager populator processedPods
2023-04-11 18:19:58 -07:00
Kubernetes Prow Robot
dcf3792310 Merge pull request #116730 from danwinship/network-owners
sig-network OWNERS fixups
2023-04-11 18:19:44 -07:00
Kubernetes Prow Robot
d48c883372 Merge pull request #116690 from smarterclayton/handle_twice
kubelet: HandlePodCleanups takes an extra sync to restart pods
2023-04-11 18:19:23 -07:00
Kubernetes Prow Robot
4893c66a48 Merge pull request #116134 from cvvz/fix-111933
fix: After a Node is down and take some time to get back to up again, the mount point of the evicted Pods cannot be cleaned up successfully.
2023-04-11 15:35:41 -07:00
Kubernetes Prow Robot
779abe6ebe Merge pull request #115399 from 3u13r/feat/documentTLS13Exception
Add note about TLS 1.3 cipher suites
2023-04-11 15:35:27 -07:00
Kubernetes Prow Robot
0c969ad660 Merge pull request #115133 from ffromani/podresources-windows
node: create podresources endpoint also on windows
2023-04-11 15:35:19 -07:00
Kubernetes Prow Robot
d0fc9d16ce Merge pull request #114800 from haoruan/feature-8976-spew-sprintf-refactor
Capture spew.Sprintf() with all our favorite config into a util func
2023-04-11 15:34:57 -07:00
David Porter
d04d7ffa6e kubelet: Mark new terminal pods as non-finished in pod worker
The pod worker may recieve a new pod which is marked as terminal in
the runtime cache. This can occur if a pod is marked as terminal and the
kubelet is restarted.

The kubelet needs to drive these pods through the termination state
machine. If upon restart, the kubelet receives a pod which is terminal
based on runtime cache, it indicates that pod finished
`SyncTerminatingPod`, but it did not complete `SyncTerminatedPod`. The
pod worker needs ensure that `SyncTerminatedPod` will run on these pods.
To accomplish this, set `finished=False`, on the pod sync status, to
drive the pod through the rest of the state machine.

This will ensure that status manager and other kubelet subcomponents
(e.g. volume manager), will be aware of this pod and properly cleanup
all of the resources of the pod after the kubelet is restarted.

While making change, also update the comments to provide a bit more
background around why the kubelet needs to read the runtime pod cache
for newly synced terminal pods.

Signed-off-by: David Porter <david@porter.me>
2023-04-11 01:39:05 -07:00
Samuel Karp
ea74a2d877 cpumanager: fix typo in godoc
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2023-04-06 16:48:24 -07:00
Claudiu Belu
7fa3d54ea5 unittests: Fixes server journal unit test on Windows
The Boot option for the node log query is not supported on Windows and
an error is returned if the option is set. Because of this, one of the
unit tests which sets the option fails, as it does not expect any errror.
2023-04-06 08:50:10 +00:00
Yoon Park
934516791c Swap assert.Equal parameters oders to follow convention 2023-04-05 22:01:40 +09:00
Craig Ingram
3d3686b9cf Return error for localhost seccomp type with no localhost profile defined 2023-04-04 14:53:46 +00:00
Clayton Coleman
ed48dcd2d7 kubelet: Ensure pods that have not started track a pendingUpdate
A pod that cannot be started yet (due to static pod fullname
exclusion when UIDs are reused) must be accounted for in the
pod worker since it is considered to have been admitted and will
eventually start.

Due to a bug we accidentally cleared pendingUpdate for pods that
cannot start yet which means we can't report the right metric to
users in kubelet_working_pods and in theory we might fail to start
the pod in the future (although we currently have not observed
that in tests that should catch such an error). Describe, implement,
and test the invariant that when startPodSync returns in every path
that either activeUpdate OR pendingUpdate is set on the status, but
never both, and is only nil when the pod can never start.

This bug was detected by a "programmer error" assertion we added
on metrics that were not being reported, suggesting that we should
be more aggressive on using log assertions and automating detection
in tests.
2023-03-29 15:29:59 -04:00
Hao Ruan
f638e2849f replaced spew.Sprintf with a util pretty print function 2023-03-27 09:24:22 +08:00