Commit Graph

3267 Commits

Author SHA1 Message Date
John McGrath
e72788d58e
Revert "DisableServiceLinks admission controller" 2024-05-20 12:20:46 -05:00
Jan Safranek
e7a6ed2e3d Remove PersistentVolumeLabel admission plugin
Remove useless admission plugin.

* It has been deprecated for years.
* All in-tree cloud providers were removed, so the admission plugin does not have
  any way to get PV labels.
* There is a replacement in https://github.com/kubernetes-sigs/cloud-pv-admission-labeler
2024-05-09 11:10:14 +02:00
Davanum Srinivas
7f9a0ef5d2
Fixes from review by Jan Šafránek/Andrew/Michael
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2024-05-03 15:11:36 -04:00
Kubernetes Prow Robot
6abdfb97c0
Merge pull request #124621 from sttts/sttts-controlplane-admission-initializers
kube-apiserver: split admission initializers into generic and non-generic
2024-05-01 01:10:15 -07:00
Kubernetes Prow Robot
8bd39b8eb1
Merge pull request #123128 from yue9944882/admission-runtime-class-empty-map-fix
Fail admission check upon nil/empty overhead map
2024-04-30 16:30:43 -07:00
Dr. Stefan Schimanski
acbb89d9b9
kube-apiserver: split admission initializers into generic and non-generic
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
2024-04-29 23:28:42 +02:00
Marek Siarkowicz
3ee8178768 Cleanup defer from SetFeatureGateDuringTest function call 2024-04-24 20:25:29 +02:00
Kubernetes Prow Robot
6faeecc87d
Merge pull request #122631 from jmcgrath207/disable-service-links
DisableServiceLinks admission controller
2024-04-18 00:00:28 -07:00
Rita Zhang
128d6cc146
Add envFrom to serviceaccount admission plugin
Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>
2024-04-12 10:49:30 -07:00
Nilekh Chaudhari
9161302e7f
feat: implements svm controller
Signed-off-by: Nilekh Chaudhari <1626598+nilekhc@users.noreply.github.com>
2024-03-08 19:25:10 +00:00
Patrick Ohly
0b6a0d686a dra api: rename NodeResourceSlice -> ResourceSlice
While currently those objects only get published by the kubelet for node-local
resources, this could change once we also support network-attached
resources. Dropping the "Node" prefix enables such a future extension.

The NodeName in ResourceSlice and StructuredResourceHandle then becomes
optional. The kubelet still needs to provide one and it must match its own node
name, otherwise it doesn't have permission to access ResourceSlice objects.
2024-03-07 22:22:55 +01:00
Patrick Ohly
3de376ecf6 dra controller: support structured parameters
When allocation was done by the scheduler, the controller needs to do the
deallocation because there is no control-plane controller which could react to
"DeallocationRequested".
2024-03-07 22:22:13 +01:00
Patrick Ohly
096e948905 dra scheduler: support structured parameters
When a claim uses structured parameters, as indicated by the resource class
flag, the scheduler is responsible for allocating it. To do this it needs to
gather information about available node resources by watching
NodeResourceSlices and then match the in-tree claim parameters against those
resources.
2024-03-07 22:21:04 +01:00
Patrick Ohly
a92d2a4cea noderestriction admission: lock down create of NodeResourceSlice
The proper value of NodeName must be checked here for create because
the node authorizer cannot do it.
2024-03-07 16:15:52 +01:00
Patrick Ohly
2e34e187c9 node authorizer: lock down access for NodeResourceSlice
The kubelet running on one node should not be allowed to access
NodeResourceSlice objects belonging to some other node, as defined by the
NodeResourceSlice.NodeName field.
2024-03-07 16:15:52 +01:00
John Mcgrath
edb0287cb1 DisableServiceLinks admission controller 2024-03-06 00:39:23 -06:00
cici37
de506ce7ac Promote ValidatingAdmissionPolicy to GA. 2024-03-05 16:00:21 -08:00
Jiahui Feng
b115df227a update tests due to change of NewPluginInitializer. 2024-02-28 15:56:14 -08:00
Jan Chaloupka
0045ef5294 system:kube-scheduler: extend the RBAC with pods/finalizers
When enabling DynamicResourceAllocation the dynamicresource plugin may
error during scheduling with:
```
E0212 08:57:53.817268       1 framework.go:1323] "Plugin failed" err="podschedulingcontexts.resource.k8s.io \"pod\" is forbidden: cannot set blockOwnerDeletion if an ownerReference refers to a resource you can't set finalizers on: , <nil>" plugin="DynamicResources" pod="gpu-test2/pod"
```
2024-02-26 15:42:35 +01:00
Kubernetes Prow Robot
7bea14097b
Merge pull request #122612 from mtardy/remove-scdeny
auth: remove SecurityContextDeny admission plugin
2024-02-12 08:37:13 -08:00
Min Jin
fdd1f3766b
fail admission check upon nil/empty overhead map
Signed-off-by: Min Jin <minkimzz@amazon.com>
2024-02-04 21:53:38 -08:00
Kubernetes Prow Robot
42941cb88a
Merge pull request #122635 from carlory/KEP-2799
Promote LegacyServiceAccountTokenCleanUp to GA
2024-02-02 12:47:23 -08:00
Kubernetes Prow Robot
55f9657e07
Merge pull request #122692 from aroradaman/reject-packets-to-invalid-port
proxy/nftables: reject packets destined for invalid ports of service ips
2024-01-24 23:17:34 +01:00
Daman Arora
4b40299133 pkg/proxy/nftables: handle traffic to cluster ip
NFTables proxy will now drop traffic directed towards unallocated
ClusterIPs and reject traffic directed towards invalid ports of
Cluster IPs.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-01-21 19:58:37 +05:30
Quan Tian
3a6060745c Remove unneeded permissions of node-controller role
Signed-off-by: Quan Tian <qtian@vmware.com>
2024-01-18 15:58:28 +08:00
carlory
041e97af1f fix evaluate resource quota if a resource is updated when the InPlacePodVerticalScaling feature-gate is on 2024-01-17 11:02:54 +08:00
carlory
0fc1b9c9aa Promote LegacyServiceAccountTokenCleanUp to GA 2024-01-08 10:58:49 +08:00
Mahe Tardy
73bec0f6d9 api: remove SecurityContextDeny admission plugin 2024-01-05 15:11:18 +00:00
Michael Taufen
ab1eb8ff24 Add comment in noderestriction on Node-bound-tokens
Explains why we don't explicitly prevent cross-node bindings in noderestriction (it's already implicitly enforced).
2023-11-06 18:04:16 +00:00
Taahir Ahmed
1ebe5774d0 kubelet: Support ClusterTrustBundlePEM projections 2023-11-03 11:40:48 -07:00
Taahir Ahmed
ecfdc8fda5 Define ClusterTrustBundlePEM projected volume
This commit defines the ClusterTrustBundlePEM projected volume types.
These types have been renamed from the KEP (PEMTrustAnchors) in order to
leave open the possibility of a similar projection drawing from a
yet-to-exist namespaced-scoped TrustBundle object, which came up during
KEP discussion.

* Add the projection field to internal and v1 APIs.
* Add validation to ensure that usages of the project must specify a
  name and path.
* Add TODO covering admission control to forbid mirror pods from using
  the projection.

Part of KEP-3257.
2023-11-03 11:40:48 -07:00
Jordan Liggitt
cda349cda4
Make service-cidrs-controller role feature-gated 2023-11-01 15:10:33 -04:00
Antonio Ojea
4ff80864e1 service cidr controller manager
Controls the lifecycle of the ServiceCIDRs adding finalizers and
setting the Ready condition in status when they are created, and
removing the finalizers once it is safe to remove (no orphan IPAddresses)

An IPAddress is orphan if there are no ServiceCIDR containing it.

Change-Id: Icbe31e1ed8525fa04df3b741c8a817e5f2a49e80
2023-10-31 21:05:05 +00:00
Kubernetes Prow Robot
1c8f88d4b6
Merge pull request #118760 from saschagrunert/user-namespaces-pss
KEP-127: Update PSS based on feature gate
2023-10-28 09:48:54 +02:00
Sascha Grunert
77e0adeb31
KEP-127: Update PSS based on feature gate
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2023-10-27 10:49:11 +02:00
tinatingyu
5925dc0775 LegacyServiceAccountTokenCleanUp beta 2023-10-27 03:52:06 +00:00
Kubernetes Prow Robot
9aa04752e7
Merge pull request #118463 from testwill/replace_loop
chore: slice replace loop
2023-10-24 15:04:39 +02:00
Kubernetes Prow Robot
441d4b54ae
Merge pull request #120397 from ty-dc/StaticCheck
cleanup: omit comparison with bool constants
2023-10-24 05:25:52 +02:00
Michal Wozniak
32fdb55192 Use Patch instead of SSA for Pod Disruption condition 2023-10-19 21:00:19 +02:00
Monis Khan
e00551fe5d
Allow storage migration of CTB without attest authorization
Signed-off-by: Monis Khan <mok@microsoft.com>
2023-09-20 12:26:11 -04:00
tao.yang
b35357b6c0 cleanup: omit comparison with bool constants
Signed-off-by: tao.yang <tao.yang@daocloud.io>
2023-09-05 10:24:38 +08:00
Patrick Ohly
2472291790 api: introduce separate VolumeResourceRequirements struct
PVC and containers shared the same ResourceRequirements struct to define their
API. When resource claims were added, that struct got extended, which
accidentally also changed the PVC API. To avoid such a mistake from happening
again, PVC now uses its own VolumeResourceRequirements struct.

The `Claims` field gets removed because risk of breaking someone is low:
theoretically, YAML files which have a claims field for volumes now
get rejected when validating against the OpenAPI. Such files
have never made sense and should be fixed.

Code that uses the struct definitions needs to be updated.
2023-08-21 15:31:28 +02:00
Kubernetes Prow Robot
f55f2785e2
Merge pull request #116254 from pohly/dra-node-authorizer
node authorizer: limit kubelet access to ResourceClaim objects
2023-07-18 13:44:04 -07:00
Hao Ruan
056c19e8b3
Add slash ended urls for service-account-issuer-discovery to match API in swagger (#117511)
* Add slash ended urls for service-account-issuer-discovery to match API in swagger

* update the comment for adding slash-ended URLs

Co-authored-by: Jordan Liggitt <jordan@liggitt.net>

---------

Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
2023-07-18 01:11:08 -07:00
Hemant Kumar
e011187114 Update code to use new generic allocatedResourceStatus field 2023-07-17 15:30:35 -04:00
Kubernetes Prow Robot
bea27f82d3
Merge pull request #118209 from pohly/dra-pre-scheduled-pods
dra: pre-scheduled pods
2023-07-13 14:43:37 -07:00
Jiahui Feng
049614f884
ValidatingAdmissionPolicy controller for Type Checking (#117377)
* [API REVIEW] ValidatingAdmissionPolicyStatucController config.

worker count.

* ValidatingAdmissionPolicyStatus controller.

* remove CEL typechecking from API server.

* fix initializer tests.

* remove type checking integration tests

from API server integration tests.

* validatingadmissionpolicy-status options.

* grant access to VAP controller.

* add defaulting unit test.

* generated: ./hack/update-codegen.sh

* add OWNERS for VAP status controller.

* type checking test case.
2023-07-13 13:41:50 -07:00
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
4121c1fc79 auth: don't allow kubelet to from modify ResourceClaimStatuses
The status determines which claims kubelet is allowed to access when claims get
created from a template. Therefore kubelet must not be allowed to modify that
part of the status, because otherwise it could add an entry and then gain
access to a claim it should have access to.
2023-07-13 20:42:21 +02:00
Patrick Ohly
1db11c07ff node authorizer: limit kubelet access to ResourceClaim objects
As discussed during the KEP and code review of dynamic resource allocation for
Kubernetes 1.26, to increase security kubelet should only get read access to
those ResourceClaim objects that are needed by a pod on the node.

This can be enforced easily by the node authorizer:
- the names of the objects are defined by the pod status
- there is no indirection as with volumes (pod -> pvc -> pv)

Normally the graph only gets updated when a pod is not scheduled yet.
Resource claim status changes can still happen after that, so they
also must trigger an update.
2023-07-13 08:35:12 +02:00