Commit Graph

115203 Commits

Author SHA1 Message Date
Swati Sehgal
367e3d7c47 node: device-mgr: e2e: Update the e2e test to reproduce issue:109595
Breakdown of the steps implemented as part of this e2e test is as follows:
1. Create a file `registration` at path `/var/lib/kubelet/device-plugins/sample/`
2. Create sample device plugin with an environment variable with
   `REGISTER_CONTROL_FILE=/var/lib/kubelet/device-plugins/sample/registration` that
    waits for a client to delete the control file.
3. Trigger plugin registeration by deleting the abovementioned directory.
4. Create a test pod requesting devices exposed by the device plugin.
5. Stop kubelet.
6. Remove pods using CRI to ensure new pods are created after kubelet restart.
7. Restart kubelet.
8. Wait for the sample device plugin pod to be running. In this case,
   the registration is not triggered.
9. Ensure that resource capacity/allocatable exported by the device plugin is zero.
10. The test pod should fail with `UnexpectedAdmissionError`
11. Delete the test pod.
12. Delete the sample device plugin pod.
13. Remove `/var/lib/kubelet/device-plugins/sample/` and its content, the directory
    created to control registration

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2023-05-02 11:23:31 +01:00
Swati Sehgal
d241f58d8c node: device-mgr: e2e: Implement End to end test
This commit reuses e2e tests implmented as part of https://github.com/kubernetes/kubernetes/pull/110729.
The commit is borrowed from the aforementioned PR as is to preserve
authorship. Subsequent commit will update the end to end test to
simulate the problem this PR is trying to solve by reproducing
the issue: 109595.

Co-authored-by: Francesco Romani <fromani@redhat.com>
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2023-05-02 11:23:31 +01:00
Swati Sehgal
aac4c15e62 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-05-02 11:23:31 +01:00
Swati Sehgal
b157e1741f node: device-plugin: e2e: Add test case for kubelet restart
Capture explicitly a test case pertaining to kubelet restart
but with no pod restart and device plugin re-registration.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2023-05-02 11:23:12 +01:00
Swati Sehgal
5278e9c02c node: device-plugin: e2e: Provide sleep intervals via constants
Based on whether the test case requires pod restart or not, the sleep
interval needs to be updated and we define constants to represent the two
sleep intervals that can be used in the corresponding test cases.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
Co-authored-by: Francesco Romani <fromani@redhat.com>
2023-05-02 11:23:12 +01:00
Swati Sehgal
b3c58acde9 node: device-plugin: e2e: Update test description to make it explicit
Explicitly state that the test involves kubelet restart and device plugin
re-registration (no pod restart)

We remove the part of the code where we wait for the pod to restart as this
test case should no longer involve pod restart.

In addition to that, we use `waitForNodeReady` instead of `WaitForAllNodesSchedulable`
for ensuring that the node is ready for pods to be scheduled on it.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
Co-authored-by: Francesco Romani <fromani@redhat.com>
2023-05-02 11:23:12 +01:00
Swati Sehgal
0cd0fe70aa node: device-plugin: e2e: Isolate test to pod restart scenario
Rather than testing out for both pod restart and kubelet restart,
we change the tests to just handle pod restart scenario.

Clarify the test purpose and add extra check to tighten the test.

We would be adding additional tests to cover kubelet restart scenarios
in subsequent commits.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
Signed-off-by: Francesco Romani <fromani@redhat.com>
2023-05-02 11:23:11 +01:00
Swati Sehgal
ed8d4e1d6a node: device-plugin: e2e: Annotate device check with error message
With this change the error message are more helpful and easier
to troubleshoot in case of test failures.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2023-05-02 11:23:11 +01:00
Swati Sehgal
4899dc75dd node: device-plugins: e2e: s/devLen/expectedSampleDevsAmount
We rename to make the intent more explicit;
We make it global to be able to reuse the value all across the module
(e.g. to check the node readiness) later on.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
Co-authored-by: Francesco Romani <fromani@redhat.com>
2023-05-02 11:23:11 +01:00
Swati Sehgal
c81ec1ae5b node: device-plugins: e2e: Refactor parse log to return string and error
Rather than only returning a string forcing us to log failure with
`framework.Fail`, we return a string and error to handle error cases
more conventionally. This enables us to use the `parseLog` function
inside `Eventually` and `Consistently` blocks, or in general to delegate
the error processing and enable better composability.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
Co-authored-by: Francesco Romani <fromani@redhat.com>
2023-05-02 11:23:11 +01:00
Kubernetes Prow Robot
c766f936b7 Merge pull request #117637 from seans3/automated-cherry-pick-of-#117571-origin-release-1.27
Automated cherry pick of #117571: Refactors discovery content-type and helper functions
2023-04-27 01:22:15 -07:00
Kubernetes Prow Robot
6494bc6129 Merge pull request #117596 from jpbetz/automated-cherry-pick-of-#117593-origin-release-1.27
Automated cherry pick of #117593: Fix bug where CEL listOfString.join() results in unexpected
2023-04-26 16:28:14 -07:00
Sean Sullivan
3ce0c108fe Refactors discovery content-type and helper functions 2023-04-26 19:05:06 +00:00
Joe Betz
192e9dae31 Update staging/src/k8s.io/apiserver/pkg/cel/common/values.go
Co-authored-by: Alvaro Aleman <alvaroaleman@users.noreply.github.com>
2023-04-25 17:48:26 -04:00
Joe Betz
8d0ac2f6f8 Fix bug where CEL listOfString.join() results in unexpected error 2023-04-25 17:48:19 -04:00
Kubernetes Prow Robot
0e4269487f Merge pull request #117459 from liggitt/automated-cherry-pick-of-#117453-upstream-release-1.27
Automated cherry pick of #117453: Fix stomping os env in kubectl e2e tests
2023-04-25 09:56:16 -07:00
Kubernetes Prow Robot
667e1645fe Merge pull request #117242 from haircommander/bump-runc-1.1.6-1.27
[1.27] Bump runc to 1.1.6
2023-04-25 04:16:16 -07:00
Kubernetes Prow Robot
c2612ddcda Merge pull request #117324 from dddddai/automated-cherry-pick-of-#117182-upstream-release-1.27
Automated cherry pick of #117182: use case-insensitive header keys for http probes
2023-04-24 11:35:03 -07:00
Jordan Liggitt
d0514936f3 Fix stomping os env in kubectl e2e tests 2023-04-19 09:31:28 +02:00
Kubernetes Prow Robot
523dd0297f Merge pull request #117147 from cji/automated-cherry-pick-of-#117020-upstream-release-1.27
[1.27] Automated cherry pick of #117020: Return error for localhost seccomp type with no localhost
2023-04-17 03:00:43 -07:00
Kubernetes Release Robot
95feac5269 Update CHANGELOG/CHANGELOG-1.27.md for v1.27.1 2023-04-14 13:38:32 +00:00
Kubernetes Release Robot
4c9411232e Release commit for Kubernetes v1.27.1 v1.27.1 2023-04-14 13:14:41 +00:00
dddddai
2c81ecc2e2 use case-insensitive header keys for http probes 2023-04-14 11:33:13 +08:00
Kubernetes Prow Robot
1f69edd929 Merge pull request #117308 from alculquicondor/automated-cherry-pick-of-#117194-upstream-release-1.27
Automated cherry pick of #117194: Revert "Optimization on running prePreEnqueuePlugins
2023-04-13 16:10:39 -07:00
Kensei Nakada
1601bb7540 fix: add the bug as a known issue o on the v1.26 release note
Change-Id: I4d38ed15c492abbfafda770fcb6aed2b37e0ac24
2023-04-13 17:12:22 -04:00
Kensei Nakada
845ba3e3a2 Revert "Optimization on running prePreEnqueuePlugins before adding pods into activeQ"
This reverts commit c01fa8279d.
2023-04-13 15:06:08 -04:00
Kubernetes Prow Robot
81eb3b63b9 Merge pull request #117305 from ncdc/automated-cherry-pick-of-#117301-upstream-release-1.27
Automated cherry pick of #117301: Revert "CR conversion: protect from converter input
2023-04-13 11:42:39 -07:00
Andy Goldstein
a1f97a35fc Revert "Merge pull request #113151 from ncdc/refactor-crd-conversion"
This reverts commit f524d765f4, reversing
changes made to c2b5457dfa.
2023-04-13 12:52:21 -04:00
Andy Goldstein
1da781e29b Revert "CR conversion: protect from converter input edits"
This reverts commit f14cc7fdfc.
2023-04-13 12:52:21 -04:00
Kubernetes Prow Robot
a94d7b76a3 Merge pull request #117254 from smarterclayton/automated-cherry-pick-of-#116482-upstream-release-1.27
Automated cherry pick of #116482: kubelet: Do not mutate pods in the pod manager
2023-04-12 23:24:36 -07:00
Clayton Coleman
d662e339aa kubelet: Do not mutate pods in the pod manager
The pod manager is a cache and modifying objects returned from the
pod manager can cause race conditions in the Kubelet. In this case,
it causes static pod status from the mirror pod to leak back to
the config source, which means a static pod whose mirror pod is
set to a terminal phase (succeeded or failed) cannot restart.
2023-04-12 16:55:48 -04:00
Peter Hunt
e599722bc5 vendor: bump runc to 1.1.6
Signed-off-by: Peter Hunt <pehunt@redhat.com>
2023-04-12 09:27:40 -04:00
Pushkar Joglekar
25b061d820 CVE-2023-27561: Bump runc go module v1.1.4 -> v1.1.5 2023-04-12 09:27:25 -04:00
Kubernetes Release Robot
398e38784e Update CHANGELOG/CHANGELOG-1.27.md for v1.27.0 2023-04-11 17:27:35 +00:00
Kubernetes Release Robot
1b4df30b3c Release commit for Kubernetes v1.27.0 v1.27.0 2023-04-11 17:04:23 +00:00
Kubernetes Release Robot
848d99050c Merge remote-tracking branch 'origin/master' into release-1.27 2023-04-07 02:00:43 +00:00
Kubernetes Release Robot
c1f2baebf7 Merge remote-tracking branch 'origin/release-1.27' into release-1.27 2023-04-06 22:37:06 +00:00
Kubernetes Release Robot
2b6072ba00 Update CHANGELOG/CHANGELOG-1.27.md for v1.27.0-rc.1 2023-04-06 20:17:17 +00:00
Kubernetes Release Robot
ad18954259 CHANGELOG: Update directory for v1.27.0-rc.1 release 2023-04-06 20:17:16 +00:00
Kubernetes Release Robot
db31c0e4e9 Merge remote-tracking branch 'origin/master' into release-1.27 2023-04-06 20:00:57 +00:00
Kubernetes Release Robot
80bc6ffd0d Release commit for Kubernetes v1.27.0-rc.1 v1.27.0-rc.1 2023-04-06 19:52:26 +00:00
Craig Ingram
951f8dcc96 Return error for localhost seccomp type with no localhost profile defined 2023-04-06 16:57:07 +00:00
Kubernetes Prow Robot
d152baf143 Merge pull request #117134 from xmudrii/pub-bot-go1198
Update publishing-bot rules for release branches to Go 1.19.8
2023-04-06 09:25:47 -07:00
Kubernetes Release Robot
d2a8a4dab1 Merge remote-tracking branch 'origin/master' into release-1.27 2023-04-06 14:00:02 +00:00
Kubernetes Prow Robot
54348233b5 Merge pull request #115036 from harche/vol_attach_log
Do not log entire pod struct while attaching the volume
2023-04-06 03:07:47 -07:00
Marko Mudrinić
4e0bc2397d Update publishing-bot rules for release branches to Go 1.19.8
Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
2023-04-06 10:31:33 +02:00
Kubernetes Release Robot
e48a823043 Merge remote-tracking branch 'origin/master' into release-1.27 2023-04-06 07:59:25 +00:00
Kubernetes Prow Robot
f28e9f6f45 Merge pull request #117126 from xmudrii/iptables-go1203
Update distroless-iptables to v0.2.3
2023-04-05 21:41:47 -07:00
Harshal Patil
1972dd1005 Do not log entire pod struct while attaching the volume
Signed-off-by: Harshal Patil <harpatil@redhat.com>
2023-04-05 20:24:12 -04:00
Marko Mudrinić
b19c362bf5 Update distroless-iptables to v0.2.3
Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
2023-04-06 01:37:14 +02:00