Commit Graph

117181 Commits

Author SHA1 Message Date
Patrick Ohly
80ab8f0542 dra: handle scheduled pods in kube-controller-manager
When someone decides that a Pod should definitely run on a specific node, they
can create the Pod with spec.nodeName already set. Some custom scheduler might
do that. Then kubelet starts to check the pod and (if DRA is enabled) will
refuse to run it, either because the claims are still waiting for the first
consumer or the pod wasn't added to reservedFor. Both are things the scheduler
normally does.

Also, if a pod got scheduled while the DRA feature was off in the
kube-scheduler, a pod can reach the same state.

The resource claim controller can handle these two cases by taking over for the
kube-scheduler when nodeName is set. Triggering an allocation is simpler than
in the scheduler because all it takes is creating the right
PodSchedulingContext with spec.selectedNode set. There's no need to list nodes
because that choice was already made, permanently. Adding the pod to
reservedFor also isn't hard.

What's currently missing is triggering de-allocation of claims to re-allocate
them for the desired node. This is not important for claims that get created
for the pod from a template and then only get used once, but it might be
worthwhile to add de-allocation in the future.
2023-07-13 21:27:11 +02:00
Patrick Ohly
cffbb1f1b2 dra controller: enhance testing
The allocation mode is relevant when clearing the reservedFor: for delayed
allocation, deallocation gets requested, for immediate allocation not. Both
should get tested.

All pre-defined claims now use delayed allocation, just as they would if
created normally.
2023-07-13 21:27:11 +02:00
Patrick Ohly
5cec6d798c dra: revamp event handlers in kube-controller-manager
Enabling logging is useful to track what the code is doing.

There are some functional changes:
- The pod handler checks for existence of claims. This
  avoids adding pods to the work queue in more cases
  when nothing needs to be done, at the cost of
  making the event handlers a bit slower. This will become
  more important when adding more work to the controller
- The handler for deleted ResourceClaim did not check for
  cache.DeletedFinalStateUnknown.
2023-07-13 21:27:11 +02:00
Patrick Ohly
08d40f53a7 dra: test with and without immediate ReservedFor
The recommendation and default in the controller helper code is to set
ReservedFor to the pod which triggered delayed allocation. However, this
is neither required nor enforced. Therefore we should also test the fallback
path were kube-scheduler itself adds the pod to ReservedFor.
2023-07-12 16:57:17 +02:00
Patrick Ohly
98ba89d31d resourceclaim controller: avoid caching deleted pod unnecessarily
We don't need to remember that a pod got deleted when it had no resource claims
because the code which checks the cached UIDs only checks for pods which have
resource claims.
2023-07-12 16:57:17 +02:00
Kubernetes Prow Robot
a8b90c9008
Merge pull request #119247 from saschagrunert/setcap
setcap: update to debian bookworm v1.0.0
2023-07-12 02:11:12 -07:00
Sascha Grunert
363874e9b5
setcap: update to debian bookworm v1.0.0
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2023-07-12 09:29:55 +02:00
Kubernetes Prow Robot
95e915c428
Merge pull request #119229 from HirazawaUi/fix-convert-slice
Fix the converts an empty string to nil.
2023-07-11 23:39:11 -07:00
Kubernetes Prow Robot
5130dad2cf
Merge pull request #118408 from danwinship/local-detector
kube-proxy local traffic detector single-vs-dual-stack cleanup
2023-07-11 21:19:11 -07:00
Kubernetes Prow Robot
98e7c2a751
Merge pull request #119237 from jpbetz/jpbetz-apiserver-integration-owner
Add jpbetz as approver of apiserver integration tests
2023-07-11 20:03:18 -07:00
Kubernetes Prow Robot
2d9c951abe
Merge pull request #117011 from fabi200123/Add-Node-Log-Query-Tests-
Add e2e tests for feature NodeLogQuery
2023-07-11 20:03:11 -07:00
Kubernetes Prow Robot
d45b6ba676
Merge pull request #119225 from iholder101/bump-cadvisor/v0.47.3
Bump cadvisor version to v0.47.3
2023-07-11 16:19:11 -07:00
Kubernetes Prow Robot
da8974157f
Merge pull request #119209 from jiahuif-forks/feature/validating-admission-policy/typechecking-expension
ValidatingAdmissionPolicy: expended type checking to messageExpression
2023-07-11 14:19:12 -07:00
Kubernetes Prow Robot
4954c7bac4
Merge pull request #118540 from jiahuif-forks/feature/validating-admission-policy/authorizer-typechecking-support
add support for authorizer to type checking.
2023-07-11 12:41:22 -07:00
Kubernetes Prow Robot
6ffca50136
Merge pull request #116443 from benluddy/secondary-authz-decision-caching
Cache authz decisions within the scope of validating policy admission.
2023-07-11 12:41:11 -07:00
Joe Betz
6d6595d0f6 Add jpbetz as approver of apiserver integration tests 2023-07-11 14:36:45 -04:00
Kubernetes Prow Robot
a6890b361d
Merge pull request #119193 from mimowo/sync-job-context
Introduce syncJobContext to limit the number of function parameters
2023-07-11 10:33:30 -07:00
Kubernetes Prow Robot
da61644869
Merge pull request #119179 from gjkim42/add-prestop-e2e-test
node-e2e: Add container lifecycle e2e tests for preStop hook
2023-07-11 10:33:23 -07:00
Kubernetes Prow Robot
e0dafe57a3
Merge pull request #117351 from pohly/dra-generated-resource-claim-names
DRA: generated resource claim names
2023-07-11 10:33:11 -07:00
HirazawaUi
9759fc3c23 Fix the converts an empty string to nil. 2023-07-12 00:02:13 +08:00
Itamar Holder
f22aa42aa8 bump go.mod cadvisor to v0.47.3
Signed-off-by: Itamar Holder <iholder@redhat.com>
2023-07-11 17:22:33 +03:00
Kubernetes Prow Robot
e1fbd0c113
Merge pull request #119207 from serathius/progress-notify
Implement conditionalProgressRequester that allows requesting watch progress notification if watch cache is not fresh
2023-07-11 06:05:19 -07:00
Arda Güçlü
3267dd9d52
kubectl delete: Introduce new interactive flag for interactive deletion (#114530) 2023-07-11 06:05:11 -07:00
Patrick Ohly
fec25785ee dra: store generated ResourceClaims in cache
This addresses the following bad sequence of events:
- controller creates ResourceClaim
- updating pod status fails
- pod gets retried before the informer receives
  the created ResourceClaim
- another ResourceClaim gets created

Storing the generated ResourceClaim in a MutationCache ensures that the
controller knows about it during the retry.

A positive side effect is that ResourceClaims now get index by pod owner and
thus iterating over existing ones becomes a bit more efficient.
2023-07-11 14:23:49 +02:00
Patrick Ohly
ba810871ad dra e2e: check that not generating a ResourceClaim works
This is not something that normally happens, but the API supports it because it
might be needed at some point, so we have to test it.
2023-07-11 14:23:49 +02:00
Patrick Ohly
0fc62d5ded dra: generated files 2023-07-11 14:23:48 +02:00
Patrick Ohly
444d23bd2f dra: generated name for ResourceClaim from template
Generating the name avoids all potential name collisions. It's not clear how
much of a problem that was because users can avoid them and the deterministic
names for generic ephemeral volumes have not led to reports from users. But
using generated names is not too hard either.

What makes it relatively easy is that the new pod.status.resourceClaimStatus
map stores the generated name for kubelet and node authorizer, i.e. the
information in the pod is sufficient to determine the name of the
ResourceClaim.

The resource claim controller becomes a bit more complex and now needs
permission to modify the pod status. The new failure scenario of "ResourceClaim
created, updating pod status fails" is handled with the help of a new special
"resource.kubernetes.io/pod-claim-name" annotation that together with the owner
reference identifies exactly for what a ResourceClaim was generated, so
updating the pod status can be retried for existing ResourceClaims.

The transition from deterministic names is handled with a special case for that
recovery code path: a ResourceClaim with no annotation and a name that follows
the Kubernetes <= 1.27 naming pattern is assumed to be generated for that pod
claim and gets added to the pod status.

There's no immediate need for it, but just in case that it may become relevant,
the name of the generated ResourceClaim may also be left unset to record that
no claim was needed. Components processing such a pod can skip whatever they
normally would do for the claim. To ensure that they do and also cover other
cases properly ("no known field is set", "must check ownership"),
resourceclaim.Name gets extended.
2023-07-11 14:23:48 +02:00
Kubernetes Prow Robot
86038ae590
Merge pull request #116846 from moshe010/e2e--node-pod-resources
kubelet pod-resources: add e2e for KubeletPodResourcesGet feature
2023-07-11 04:53:24 -07:00
Kubernetes Prow Robot
bc01306c98
Merge pull request #116738 from AxeZhan/TopologyManagerPolicy
When TopologyManagerPolicy is None, skip checks in NewManager.
2023-07-11 04:53:13 -07:00
Marek Siarkowicz
98461be8ff Implement conditionalProgressRequester that allows requesting watch progress notification if watch cache is not fresh 2023-07-11 13:03:13 +02:00
Kubernetes Prow Robot
50782ce5ab
Merge pull request #119198 from jadhaj/fix-115385
Document address family of listening INET sockets
2023-07-11 03:19:23 -07:00
Kubernetes Prow Robot
8f1852bb44
Merge pull request #115295 from Namanl2001/pkg/controller/endpointslice
Migrated `pkg/controller/endpointslice` and `pkg/controller/endpointslicemirroring` to contextual logging
2023-07-11 03:19:12 -07:00
Michal Wozniak
bf48165232 Remarks to syncJobCtx 2023-07-11 09:44:08 +02:00
Michal Wozniak
990339d4c3 Introduce syncJobContext to limit the number of function parameters 2023-07-11 09:27:21 +02:00
Kubernetes Prow Robot
ad72319ece
Merge pull request #115122 from r-erema/110782-oidc-test-coverage
add integration tests for OIDC authenticator
2023-07-10 15:29:10 -07:00
Kubernetes Prow Robot
986171d388
Merge pull request #119185 from xing-yang/metrics_attach
Add reason to force detach metric
2023-07-10 14:03:18 -07:00
Kubernetes Prow Robot
42e1e72105
Merge pull request #119130 from SataQiu/clean-sheduler-20230706
Remove deprecated scheduler CLI flags
2023-07-10 14:03:11 -07:00
Naman
645cb90732 migrated pkg/controller/endpointslicemirroring to contextual logging
Signed-off-by: Naman <namanlakhwani@gmail.com>
2023-07-11 01:43:30 +05:30
Naman
09849b09cf migrated pkg/controller/endpointslice to contextual logging
Signed-off-by: Naman <namanlakhwani@gmail.com>
2023-07-11 01:28:22 +05:30
Kubernetes Prow Robot
c95b16b280
Merge pull request #118608 from utam0k/podtopologyspread-prescore-skip
Return Skip in PodTopologySpread#PreScore under specific conditions
2023-07-10 09:27:07 -07:00
Kubernetes Prow Robot
10a12165de
Merge pull request #116755 from my-git9/feat/endpoint/logging
Migrated `pkg/controller/endpoint` to contextual logging
2023-07-10 05:37:05 -07:00
Jad Haj Yahya
de07643095 Document address family of listening INET sockets 2023-07-10 15:01:13 +03:00
Kubernetes Prow Robot
64939b66c6
Merge pull request #119146 from xuexu6666/xuexu6666/ControllerUtilUseCmpDiff
Use cmp diff in controller_util_test.go
2023-07-10 02:41:18 -07:00
Kubernetes Prow Robot
80dab4127b
Merge pull request #116720 from soltysh/remove_short_version
Remove long/golang version information making short the default
2023-07-10 02:41:06 -07:00
xing-yang
cca6601106 Add reason to force detach metric 2023-07-10 06:30:05 +00:00
Kubernetes Prow Robot
0ae9aaacfa
Merge pull request #118271 from tangwz/add_nodeports_prefilter_skip_status
feat(NodePorts): return Skip status in PreFilter
2023-07-09 20:49:04 -07:00
Jiahui Feng
e655931274 expended type checking. 2023-07-09 19:41:44 -07:00
Gunju Kim
8fb5b6eb4c
node-e2e: Add container lifecycle e2e tests for preStop hook
This ensures that the container's pre-stop hook is invoked if the
startup or liveness probe fails.
2023-07-10 08:55:48 +09:00
Kubernetes Prow Robot
d653dcab5a
Merge pull request #119048 from pohly/scheduler-perf-metrics-for-perfdash
scheduler-perf: metrics for perfdash
2023-07-09 09:27:04 -07:00
Kubernetes Prow Robot
09899b986f
Merge pull request #118926 from mengjiao-liu/improve-scheduler-use-cmp.Diff
scheduler test: Use cmp.Diff instead of reflect.DeepEqual for pkg/scheduler/internal/cache
2023-07-08 21:51:04 -07:00