Commit Graph

3245 Commits

Author SHA1 Message Date
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
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
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
Todd Neal
ea1eb7f8f7
implement sidecar resource calculation 2023-07-08 07:26:13 +09:00
Patrick Ohly
a514f40131 dra resourceclaim controller: delete generated claims when pod is done
When a pod is done, but not getting removed yet for while, then a claim that
got generated for that pod can be deleted already. This then also triggers
deallocation.
2023-07-05 16:10:20 +02:00
guoguangwu
1d9eed9f95 chore: slice replace loop 2023-06-05 22:40:53 +08:00
Rita Zhang
d6168bb658
Add ephemeralcontainer to imagepolicy securityaccount admission plugin
Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>
2023-06-01 23:05:06 -07:00
Kubernetes Prow Robot
c35a2775b2
Merge pull request #115554 from yt2985/cleanSA
LegacyServiceAccountTokenCleanUp alpha
2023-05-26 08:54:53 -07:00
Kubernetes Prow Robot
03ebd4b7ef
Merge pull request #116656 from HirazawaUi/fik-fd-leaks
Cleanup fd leaks and file removal cleanup
2023-05-24 22:50:50 -07:00
tinatingyu
133eff3df4 implement LegacyServiceAccountTokenCleanUp alpha 2023-05-24 23:20:17 +00:00
Joe Betz
f0f92853ad Add api-machinery TL owners permissions for jpbetz 2023-05-15 11:09:54 -04:00
Daniel Smith
1ffe3f467e lavalamp is taking a long break 2023-05-11 16:43:38 +00:00
HirazawaUi
82e3fa0930 fix fd leaks and failed file removing for main pkg and cmd 2023-05-09 09:24:11 -05:00
Kubernetes Prow Robot
78833e1b33
Merge pull request #117713 from flant/ssr-ga
KEP-3325: Promote SelfSubjectReview to GA
2023-05-03 08:54:24 -07:00
m.nabokikh
40de26dcff KEP-3325: Promote SelfSubjectReview to GA
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
2023-05-02 14:50:40 +02: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
ialidzhikov
d231d6022b Remove endpoints (old leader election) related RBAC from kube-controller-manager ClusterRole 2023-04-17 23:01:35 +03:00
Hao Ruan
c4e1b01416 replace spew methods with dump methods 2023-04-14 08:05:53 +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
97bab44cae
Replace apimachinery diff.StringDiff with cmp
I forced failures of most of these tests and verified readability
2023-04-12 08:45:31 -07:00
Sathyanarayanan Saravanamuthu
9363afc650 Fixing broken tests
Signed-off-by: Sathyanarayanan Saravanamuthu <sathyanarays@vmware.com>
2023-04-10 11:18:09 +05:30
Sathyanarayanan Saravanamuthu
26b35ce36a Remove endpoint related RBAC from scheduler cluster role 2023-04-06 17:40:52 +05:30
Monis Khan
735bbc135c
Clean up formatting
Signed-off-by: Monis Khan <mok@microsoft.com>
2023-03-30 16:38:15 -04:00
Taahir Ahmed
51f759aa05 ClusterTrustBundles: kube-apiserver integration tests 2023-03-15 20:19:48 -07:00