Commit Graph

313 Commits

Author SHA1 Message Date
Heba Elayoty
36f5750042 Move path-segment validation to pkg content
This is where all the scrubbed validation helpers are going.

Note: This does NOT check for  or too-long inputs, and changing it now
would be a breaking change.

Co-authored-by: Tim Hockin <thockin@google.com>
Signed-off-by: Heba Elayoty <heelayot@microsoft.com>
2026-01-13 13:27:41 -08:00
Omer Aplatony
6cbb58349d HPA: Enable DV support for MaxReplicas (#135412)
Signed-off-by: Omer Aplatony <omerap12@gmail.com>
2026-01-13 00:54:09 +05:30
Maciej Szulik
e347aa994b React to removing autoscaling v2beta1 and v2beta2
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-12-05 11:59:30 +01:00
Maciej Szulik
fad6e977f7 Remove autoscaling v2beta1 and v2beta2
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-12-05 11:28:58 +01:00
yongruilin
47fb373c31 run update-codegen.sh 2025-11-06 00:54:52 +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
Kubernetes Prow Robot
50e3cb3f58 Merge pull request #133128 from jm-franc/set-gate-to-beta
Promote HPAConfigurableTolerance gate to beta
2025-10-16 12:04:43 -07:00
Aaron Prindle
9d83f71cde fix validation_test.go to use path normalization 2025-10-16 17:40:19 +00:00
Tim Hockin
2d48dae391 Eliminate public ValidateReplicationControllerName
Everyone who referenced it now uses the underlying function.  Clearer
and frees me up to change objectMeta validation without impacting anyone
else.
2025-10-01 19:45:37 +00:00
yongruilin
9a7e2291d1 refactor: Remove Validate(Update)Declaratively and improve error handling 2025-09-26 17:22:48 +00:00
Joe Betz
d2ec0308c7 simplify scale subresource testing and document expectations
Co-Authored-by: Yongrui Lin <yongrlin@outlook.com>
2025-09-26 17:22:48 +00:00
Jean-Marc François
c1e74a1a98 Promote HPAConfigurableTolerance gate to beta 2025-09-23 19:56:03 -04: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
Tim Hockin
b6fdbe4a6a Emit ratchet check for fields with a type func
This could go inside the type func but then we end up with a double
ratchet sometimes.

Co-Authored-By: Yongrui Lin <yongrlin@outlook.com>
2025-09-09 21:58:55 +00:00
yongruilin
8130cf82b5 run "hack/update-codegen.sh valid" 2025-09-09 16:54:46 +00:00
Lalit Chauhan
f6aee63690 add validation logic for APIVersion fields of HPA
New validation logic follows the API ratcheting principle,  will not be executed for already stored invalid if the corresponding fields or item in array is not modified. Please enter the commit message for your changes. Lines starting
2025-07-22 20:40:48 +00:00
ylink-lfs
ca1d7fff7f chore: remove utilpointer usage in pkg/apis/autoscaling 2025-07-05 11:45:52 +08:00
ylink-lfs
9016f9cb1b chore: remove utilpointer usage in conversion package 2025-07-04 09:29:47 +08:00
Kubernetes Prow Robot
2a4b5f6476 Merge pull request #132314 from thockin/jp_nicer_api_errors
Nicer value rendering in API errors
2025-07-03 01:33:33 -07:00
Tim Hockin
4ca91a0305 WIP: Fix tests
Notes:
* For types that define String() - should we prefer that or JSON?
* metav1.Time has a MarshalJSON() and inhereits a String() and they are
  different
* Since validation runs on internal types, we still get some GoNames
  instead of goNames.
2025-06-19 10:11:17 +09:00
yongruilin
1574001a1c run update-codegen.sh 2025-06-11 23:44:52 +00:00
Joe Betz
1d17ca9b7e generate code 2025-05-24 00:03:35 -04:00
Joe Betz
7dc8660d03 Update testing to fully track subresources 2025-05-23 21:47:08 -04:00
Joe Betz
030b4ab9cc Add declarative validation testing to Scale.spec.replicas 2025-05-23 21:47:07 -04:00
Joe Betz
8c5c5fb761 Add origin and use apivalidation.ValidateNonnegativeField for Scale.spec.replicas validation.
This does not change the resulting errors but it makes declarative validation testing easier.
2025-05-23 21:47:07 -04:00
Joe Betz
d0f6fe30bf Add k8s:minimum validation to Scale.spec.replicas
This applies to all group version kinds of Scale.  Validation-gen must be enabled for all at the
same time since our testing checks that cross-GV declarative validation to matches.
2025-05-23 21:47:07 -04:00
Joe Betz
ffb4e003f7 Enable validation-gen for scale group-versions
This adds declarative validation for all all versioned types of Scale
since our testing uses apitesting.VerifyVersionedValidationEquivalence,
will fail if we don't convert them all at the same time.
2025-05-23 21:47:06 -04:00
Matthieu MOREL
4adb58565c chore: bump golangci-lint to v2
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-02 12:51:02 +02:00
Jean-Marc François
ac107137ce Refresh autogenerated files following the configurable tolerance updates. 2025-03-21 18:48:38 -04:00
Jean-Marc François
dc1696d807 Fix API doc and tolerance field handling when gate is flipped. 2025-03-21 18:48:37 -04:00
Jean-Marc François
a41284d9fa Add the HorizontalPodAutoscaler tolerance field.
Includes v2beta2 HPA round-trip conversion, defaulting, and validation.
2025-03-21 18:48:37 -04:00
Tim Hockin
e54719bb66 Use randfill, do API renames 2025-03-08 15:18:00 -08:00
Patrick Ohly
8a908e0c0b remove import doc comments
The "// import <path>" comment has been superseded by Go modules.
We don't have to remove them, but doing so has some advantages:

- They are used inconsistently, which is confusing.
- We can then also remove the (currently broken) hack/update-vanity-imports.sh.
- Last but not least, it would be a first step towards avoiding the k8s.io domain.

This commit was generated with
   sed -i -e 's;^package \(.*\) // import.*;package \1;' $(git grep -l '^package.*// import' | grep -v 'vendor/')

Everything was included, except for
   package labels // import k8s.io/kubernetes/pkg/util/labels
because that package is marked as "read-only".
2024-12-02 16:59:34 +01:00
Kubernetes Prow Robot
f9a57ba82d Merge pull request #126760 from ncdc/ncdc/emeritus
Move ncdc to emeritus
2024-09-20 21:01:58 +01:00
Joe Betz
2595aa1309 generate 2024-09-03 14:26:26 -04:00
Andy Goldstein
0e228be96f Use emeritus_*
Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2024-08-22 17:48:27 -04:00
Andy Goldstein
3ab816dcab Move ncdc to emeritus
I am moving myself to emeritus as I am now firmly on the end-user side
of things.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2024-08-17 13:06:45 -04:00
Marek Siarkowicz
3ee8178768 Cleanup defer from SetFeatureGateDuringTest function call 2024-04-24 20:25:29 +02:00
Kensei Nakada
07e0a80216 graduate HPAContainerMetrics to stable 2024-02-25 00:58:00 +00:00
AxeZhan
070e7a38cb generic set 2023-10-28 15:31:28 +08:00
Daniel Smith
1ffe3f467e lavalamp is taking a long break 2023-05-11 16:43:38 +00: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
Tim Hockin
29c0b73d64 Replace uses of diff.ObjectDiff with cmp.Diff
ObjectDiff is already a shim over cmp.Diff, so no actual output or
behavior changes
2023-04-12 08:46:12 -07:00
Kubernetes Prow Robot
48e4052fc0 Merge pull request #114902 from TommyStarK/pkg-apis/replace-deprecated-pointer-function
pkg/apis: Replace deprecated pointer function
2023-03-09 21:34:15 -08:00
Mateusz Puczyński
81987dba34 update obsolete links 2023-02-28 00:13:24 +01:00
Rayowang
00c836b44a Fix API field references for autoscaling v1, v2 and v2beta2 2023-02-27 10:02:56 +08:00
TommyStarK
c242e647ae pkg/apis: Replace deprecated pointer function
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
2023-01-08 13:14:37 +01:00
SataQiu
40a6d6306a autoscaling: advance v2 as the preferred API version over v1 2022-12-11 13:09:39 +08:00
Davanum Srinivas
a9593d634c Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
HaoJie Liu
66205bb313 Remove redundant variable definitions in apis/autoscaling
Signed-off-by: HaoJie Liu <liuhaojie@beyondcent.com>
2022-07-15 14:03:59 +08:00