Commit Graph

10712 Commits

Author SHA1 Message Date
Claudiu Belu
11f1d24165 unit tests: Fixes kubelet util unit tests for Windows
The unit tests are currently failing due to missing imports. This commit
addresses this issue.

Additionally, TestIsUnixDomainSocket expects an error to be raised by
IsUnixDomainSocket if the file does not exist, but on Windows we do not
raise such error.

This issue is addressed by Stat-ing the file, and checking
if the file exists or not. We're also handling the case in which the given
filePath is a named pipe, returning false immediately, instead of trying to
dial it as a Unix domain socket.
2023-05-10 11:25:49 +00:00
Kubernetes Prow Robot
65c13c5c21
Merge pull request #117836 from ruquanzhao/addPodUID
Passing podUID in AddReference and DeleteReference
2023-05-10 00:18:59 -07:00
RuquanZhao
9150e6b55a s/of referencedFrom/from referenceFrom/
Signed-off-by: Ruquan Zhao <ruquan.zhao@arm.com>
2023-05-10 10:22:52 +08:00
RuquanZhao
308ab380d7 Add unit testcases of refMap.
Signed-off-by: Ruquan Zhao <ruquan.zhao@arm.com>
2023-05-09 18:05:43 +08:00
RuquanZhao
ccb4ca8954 record podUID in refMap in watchBasedManager
Signed-off-by: Ruquan Zhao <ruquan.zhao@arm.com>
2023-05-08 15:32:10 +08:00
Kubernetes Prow Robot
2a327f8e96
Merge pull request #117538 from TommyStarK/fix-flaky-test/TestGeneratePodSandboxConfig
kubelet/kuberuntime: Fix flaky test 'TestGeneratePodSandboxConfig'
2023-05-06 07:23:34 -07:00
Kubernetes Prow Robot
98d2dc9557
Merge pull request #117523 from sourcelliu/event
Fix potential mutex usage bug
2023-05-06 07:23:27 -07:00
RuquanZhao
936265e870 Add podUID in AddReference and DeleteReference
Signed-off-by: Ruquan Zhao <ruquan.zhao@arm.com>
2023-05-06 13:58:14 +08:00
Kubernetes Prow Robot
af92da5cb7
Merge pull request #117717 from saschagrunert/invalid-signature-error
Add support for CRI `ErrSignatureValidationFailed`
2023-05-05 10:39:25 -07:00
Sascha Grunert
63b69dd50c
Add support for CRI ErrSignatureValidationFailed
This allows container runtimes to propagate an image signature
verification error through the CRI and display that to the end user
during image pull. There is no other behavioral difference compared to a
regular image pull failure.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2023-05-04 08:34:11 +02:00
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
TommyStarK
73d9a9cfa0 kubelet/kuberuntime: Fix flaky test 'TestGeneratePodSandboxConfig'
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
2023-04-25 17:29:25 +02:00
mantuliu
17db22d055 Fix potential mutex usage bug
Signed-off-by: mantuliu <240951888@qq.com>
2023-04-21 23:50:33 +08: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