Commit Graph

1202 Commits

Author SHA1 Message Date
Dan Winship
f278b47ecd Drop TopologyAwareHints and ServiceTraficDistribution feature gates 2026-01-09 12:42:34 -05:00
Antonio Ojea
51f614a156 ipallocator: handle errors correctly
The ipallocator was blindly assuming that all errors are retryable, that
causes that the allocator tries to exhaust all the possibilities to
allocate an IP address.

If the error is not retryable this means the allocator will generate as
many API calls as existing available IPs are in the allocator, causing
CPU exhaustion since this requests are coming from inside the apiserver.

In addition to handle the error correctly, this patch also interpret the
error to return the right status code depending on the error type.

Co-authored-by: carlory <baofa.fan@daocloud.io>
2025-12-03 10:39:57 +00:00
ndixita
84776abaff Modifying validation logic and pod strategy for PodResize to accommodate for Pod Level Resources resize 2025-11-11 18:15:22 +00:00
Praveen Krishna
c30b75b008 feat: Implement node declared features reporting and validation.
* Reports node declared features in Node.Status.DeclaredFeatures.
* Add kubelet admission handler to check pod required features and match with node declared features on pod creation.
* Checks node declared features on pod updates and emits events if the node does not
  satisfy the pod's feature requirements.
* Adds API validation for node object.
2025-11-06 00:51:39 +00:00
Patrick Ohly
8b6f98b06e DRA: lock to default-on
The core functionality was enabled by default in 1.34 without any issues that
would have suggested turning it off, so now we can lock it to on-by-default.

Tests which cover disabling the feature must use version emulation.
2025-10-24 20:04:20 +02:00
Dan Winship
715228f478 Remove LoadBalancerIPMode feature gate 2025-10-24 09:12:03 -04:00
Sean Sullivan
413c34f319 Added feature gate and tests 2025-10-21 20:31:24 +00:00
Jordan Liggitt
339dba881f Add synthetic create authz check to pods/exec, pods/attach, pods/portforward 2025-10-21 18:26:06 +00:00
Kubernetes Prow Robot
4bb072512e Merge pull request #134446 from aaron-prindle/dv-device-allocation-mode-enum-migration
feat: add +k8s:enum declarative validation to ResourceClaim DeviceAllocationMode
2025-10-17 11:54:41 -07:00
Aaron Prindle
9d83f71cde fix validation_test.go to use path normalization 2025-10-16 17:40:19 +00:00
Tim Allclair
debe026b21 Fix unit tests to work with explicit depndencies 2025-10-15 15:04:26 -07:00
Kubernetes Prow Robot
9b9cd768a0 Merge pull request #134516 from ramzeng/hotfix/ipallocator
fix: Add CIDR filtering and overflow protection to IP allocator
2025-10-13 21:47:34 -07:00
曾是然
0554102ab3 test: Add CIDR allocator metrics test with multiple CIDRs 2025-10-14 01:59:34 +00:00
Kubernetes Prow Robot
db63a581ca Merge pull request #134366 from tallclair/feature-gates-test
Set multiple feature gates simultaneously in test
2025-10-13 13:11:33 -07:00
曾是然
83eebc2290 fix: Add CIDR filtering and overflow protection to IP allocator 2025-10-11 15:29:25 +00:00
曾是然
20dafe678b test: Add failing tests for IP allocator CIDR filtering and overflow protection 2025-10-11 01:45:04 +00:00
Kubernetes Prow Robot
3e4b5e48f2 Merge pull request #134193 from hoskeri/fix-ipv6allocator
Fix IPv6 allocator for /64 CIDRs
2025-10-08 18:03:01 -07:00
Tim Hockin
8443187688 Warn when quota request > limit 2025-10-03 10:58:35 -07:00
rongfu.leng
79678dd393 feat: add resourcequota WarningsOnCreate request less than limits
Signed-off-by: rongfu.leng <lenronfu@gmail.com>
2025-10-03 10:58:34 -07:00
Tim Allclair
4986abe0b8 Automated refactoring to use SetFeatureGatesDuringTest 2025-10-01 21:10:53 -07:00
Tim Hockin
229c6b13ca Validate ReplicationController.metadata.name
This relies on `+k8s:subfield` and validation cohorts.  The
`k8s:optional` ensures that we don't run the name validation if name is
empty, because core apimachinery will already flag it as Required().

This demonstrates some of the DV value - docs and clients are now (in
theory) able to see what RC's name format is.

Co-Authored-by: Yongrui Lin <yongrlin@outlook.com>
2025-10-01 19:45:37 +00:00
Tim Hockin
7b93851395 Fix ReplicationControl double validation 2025-10-01 18:37:13 +00:00
yongruilin
96349a4608 chore: Move declarative validation featuregates to staging apiserver 2025-09-26 22:30:16 +00:00
yongruilin
2d7dd9164f Refactor: Centralize declarative validation and migration logic
The boilerplate for running declarative validation was duplicated across multiple resource strategies. This included feature gate checks, metric identifier generation, error comparison, and conditional merging logic, which made the code verbose and difficult to maintain.

This commit introduces a new helper function, `rest.ValidateDeclarativelyWithMigrationChecks`, to encapsulate this common logic. All relevant strategies have been refactored to use this new function, resulting in cleaner and more concise code.
2025-09-26 17:22:46 +00:00
Abhijit Hoskeri
22551e56a6 Fix IPv6 allocator for /64 CIDRs
An ipAllocator with a 64 bit IPv6 CIDR can allocate
addresses outside the CIDR range, due to an improper uint64 to int64
cast in the addOffsetAddress function.

Replace the cast with a call to `math/big.Int.SetUint64()`.
2025-09-22 11:07:57 -07:00
Lalit Chauhan
92dcd02459 Add helpers for declarative validation tests
Introduces new testing helpers to simplify testing of declarative validation rules. The new `VerifyValidationEquivalence` and `VerifyUpdateValidationEquivalence` functions reduce boilerplate by encapsulating the logic for:

- Toggling the `DeclarativeValidation` and `DeclarativeValidationTakeover` feature gates.
- Comparing the validation output from the imperative and declarative paths.

The declarative validation tests for CertificateSigningRequest and ReplicationController are updated to use these new, simpler helpers.
2025-09-16 16:57:21 +00:00
Kubernetes Prow Robot
09278c1292 Merge pull request #133946 from lalitc375/k8s-dv-metrics
Add fine grained metrics to narrow down DV mismatches and panics
2025-09-15 19:44:09 -07:00
Lalit Chauhan
1a5e77135b Add fine grained metrics to narrow down DV mismatches and panics 2025-09-16 00:36:14 +00:00
Marek Siarkowicz
1ac067ae0e Fix tests to to only accesses keys from under resourcePrefix 2025-09-10 14:49:58 +02:00
Kubernetes Prow Robot
ef4add4509 Merge pull request #133356 from mayuka-c/issue-133175
Replace usage of deprecated ErrWaitTimeout with recommended method across all Pkgs
2025-09-05 06:43:34 -07:00
Keisuke Ishigami
ddb015f023 Resolve confusing use of TooManyRequests error for eviction (#133097)
modify test "the error includes the reason when the condition.Status is False"
2025-09-04 12:19:14 -07:00
Marek Siarkowicz
683a76dd15 Enforce that all resources set resourcePrefix 2025-09-04 00:11:15 +02:00
Kubernetes Prow Robot
4d15270bd7 Merge pull request #132549 from gavinkflam/130656-fix-duplicate-validations-3
bug: Remove duplicate storage resources update validations
2025-08-27 14:54:12 -07:00
Mayuka Channankaiah
6c56d2fd1b Replace usage of deprecated ErrWaitTimeout with recommended method across all Pkgs 2025-08-01 14:18:06 +05:30
utam0k
60fa65db88 Clear pod.Status.NominatedNodeName when pod is bound
Signed-off-by: utam0k <k0ma@utam0k.jp>
2025-07-29 23:48:11 +09:00
Patrick Ohly
5c4f81743c DRA: use v1 API
As before when adding v1beta2, DRA drivers built using the
k8s.io/dynamic-resource-allocation helper packages remain compatible with all
Kubernetes release >= 1.32. The helper code picks whatever API version is
enabled from v1beta1/v1beta2/v1.

However, the control plane now depends on v1, so a cluster configuration where
only v1beta1 or v1beta2 are enabled without the v1 won't work.
2025-07-24 08:33:45 +02:00
Kubernetes Prow Robot
ade9b7746a Merge pull request #132595 from AxeZhan/ga3960
Graduate PodLifecycleSleepAction to GA
2025-07-19 13:22:39 -07:00
Tim Allclair
5f829195e6 Only warn when AppArmor annotation doesn't match pod field 2025-07-17 14:46:47 -07:00
Tim Allclair
4fdf09fdc1 Stop syncing AppArmor fields to annotations 2025-07-17 14:07:35 -07:00
Kubernetes Prow Robot
48e04d0d6c Merge pull request #132871 from dims/bump-k8s.io/kube-openapi-to-latest-SHA-f3f2b991d03b
Bump k8s.io/kube-openapi to latest SHA (f3f2b991d03b) and sigs.k8s.io/structured-merge-diff/{v4 => v6}
2025-07-14 22:32:22 -07:00
Davanum Srinivas
ebc1ccc491 Bump k8s.io/kube-openapi to latest SHA (f3f2b991d03b)
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2025-07-14 07:24:48 -04:00
Daman Arora
fcb595a2df service-ip-alloc: delay ip processing on service recreate
Service storage implements transactions. It creates an IPAddress object first and then creates
the Service object, and if the Service object already exists the complete transaction is
reverted. There can be race conditions when the repair loop picks up the new IPAddress object
for reconciliation before the transaction is reverted. This leads to spurious
IPAddressWrongReference warnings, to suppress these warnings we delay the processing of the new
IPAddress object by 5 seconds. The service allocation creates the IPAddress object before creating
the Service object, we easily identify this scenario when the IPAddress object creation timestamp
is after the Service creation timestamp. We do this only when the IPAddress object is created
recently in order to avoid indefinitely requeue/delay in IPAddress cleanup if for some reason
the service transaction revert fails.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-07-14 00:31:53 +05:30
Daman Arora
8de14b526e service-ip-alloc: make repair loop consumer clock interface
The private constructor for the repair loop now consumes clock.Clock interface allowing
predictable unit testing.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-07-13 23:51:48 +05:30
Anish Ramasekar
45dfb46448 Add TokenRequestServiceAccountUIDValidation feature gate with UID validation
This change introduces the TokenRequestServiceAccountUIDValidation feature
gate and implements feature-gated service account UID validation for the
TokenRequest API. When enabled, the API validates that the service account
UID in token requests matches the actual service account UID, preventing
token requests for recreated service accounts with the same name but
different UIDs.

Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
2025-07-10 23:20:23 -05:00
AxeZhan
dcbed2fbdc Graduate PodLifecycleSleepAction to GA 2025-07-02 09:37:14 +08:00
Gavin Lam
ba46831c87 bug: Remove duplicate storage resources update validations
Signed-off-by: Gavin Lam <gavin.oss@tutamail.com>
2025-06-26 00:29:51 -04:00
Natasha Sarkar
7d85134cae improve unit test coverage for pod observedGeneration 2025-06-25 17:18:07 +00:00
Joe Betz
7dc8660d03 Update testing to fully track subresources 2025-05-23 21:47:08 -04:00
Joe Betz
105391403f Enable scale subresource in generated validations 2025-05-23 21:47:08 -04:00
Joe Betz
a3eddf7d85 Add declarative validation testing for replicationcontroller/scale 2025-05-23 21:47:07 -04:00