Commit graph

35 commits

Author SHA1 Message Date
Kubernetes Prow Robot
b263071241
Merge pull request #139673 from suii2210/migrate-observedgeneration-dv
Migrate metav1.Condition ObservedGeneration to declarative validation
2026-06-18 23:48:43 +05:30
Kubernetes Prow Robot
47d52eabda
Merge pull request #139743 from antekjb/renamePodGroupScheduled
Rename PodGroupScheduled condition to PodGroupInitiallyScheduled
2026-06-17 20:16:50 +05:30
Antoni Basista
0d59683459 Rename PodGroupScheduled condition to PodGroupInitiallyScheduled 2026-06-17 12:49:22 +00:00
Antoni Basista
61dc7df681 Make minCount mutable in Workload and PodGroup APIs 2026-06-17 12:44:49 +00:00
Antoni Basista
920c2d8f52 Update API codegen 2026-06-17 12:44:35 +00:00
Kubernetes Prow Robot
05f19de8ed
Merge pull request #139520 from macsko/merge_featuregates
Merge GangScheduling and WorkloadAwarePreemption feature gates into GenericWorkload
2026-06-17 12:33:35 +05:30
Shruti Singh
77f3a2ab2a Add test case for observedGeneration zero condition
Signed-off-by: suii2210 <work8758@gmail.com>
2026-06-17 05:33:53 +00:00
Maciej Skoczeń
54ca619d4b Merge GangScheduling and WorkloadAwarePreemption feature gates into GenericWorkload 2026-06-15 11:42:10 +00:00
Maciej Skoczeń
5b94a58696 Update API codegen 2026-06-15 11:42:10 +00:00
suii2210
530be8dcac Migrate metav1.Condition ObservedGeneration to declarative validation
Signed-off-by: suii2210 <work8758@gmail.com>
2026-06-12 19:23:32 +00:00
Lidang-Jiang
91341fc879 Migrate StatefulSet immutable fields to declarative validation 2026-06-12 08:38:14 +08:00
Yongrui Lin
462aa20ad9 node: add declarative validation tests for toleration key
RuntimeClass across v1, v1alpha1, and v1beta1; prefixed and unprefixed keys.
2026-06-11 06:35:35 +00:00
Yongrui Lin
fd8870da09 batch: add declarative validation tests for toleration key
Job and CronJob; prefixed and unprefixed keys.
2026-06-11 06:35:35 +00:00
Yongrui Lin
627834ba06 apps: add declarative validation tests for toleration key
Deployment, DaemonSet, ReplicaSet, and StatefulSet; prefixed and unprefixed keys.
2026-06-11 06:35:35 +00:00
Yongrui Lin
ca4ae01f4d core: add declarative validation tests for toleration key
Pod, PodTemplate, and ReplicationController; prefixed and unprefixed keys.
2026-06-11 06:35:35 +00:00
Yongrui Lin
e4cc8f8e9d testing: skip unserved extensions/v1beta1 in validation equivalence sweep
Add WithSkipGroupVersions and apply it to the NetworkPolicy and Scale tests,
whose internal types also register under the now-unvalidated extensions/v1beta1.
2026-06-11 06:35:35 +00:00
Yongrui Lin
d1c82cbeb2 Regenerate validation code and protobuf for toleration migration
Output of hack/update-codegen.sh.
2026-06-11 06:35:28 +00:00
Kubernetes Prow Robot
8f8aa9aae1
Merge pull request #139101 from lalitc375/conditions
Setup metav1.Condition for declarative valdiations.
2026-06-11 04:28:47 +05:30
Jaegoo
2a0a95c811
Migrate secret type immutable (#136886)
* Wire up Secret for declarative validation

* Migrate Secret.Type to declarative immutable validation

* Add +k8s:optional tag to Secret.Type field

* Add TestDeclarativeValidate test for CREATE flow

* Add immutability test cases for unset->set and set->unset

* Fix ValidateDeclarativelyWithMigrationChecks call to include DeclarativeValidationConfig

* Fix double declarative validation by removing manual ValidateDeclarativelyWithMigrationChecks calls

The secret strategy embedded rest.DeclarativeValidation (which implements
DeclarativeValidationStrategy) but also called ValidateDeclarativelyWithMigrationChecks
directly inside Validate and ValidateUpdate. The REST handler and test framework
call ValidateDeclaratively separately after Validate/ValidateUpdate, causing
double execution that broke the AllDeclarativeEnforced test scenario.

Fix by returning only handwritten errors from Validate/ValidateUpdate, matching
the pattern used by csiDriverStrategy and other correctly-migrated strategies.

* Use alpha stability level for +k8s:immutable on Secret.Type

The validation-gen tool enforces that Beta-level tags cannot be used in
Stable validation. Change +k8s:immutable to
+k8s:alpha(since: "1.36")=+k8s:immutable to match other stable-API fields.
Regenerate zz_generated.validations.go and update test expected errors
with .MarkAlpha() accordingly.

* Update alpha stability level version from 1.36 to 1.37

Update +k8s:alpha(since: "1.36") annotations to 1.37 in types.go
and generated.proto for Secret.Type immutability and ReplicationController
declarative validation tags.

* Regenerate zz_generated.validations.go after rebase

Rebase onto latest master brought in validation-gen changes that add
.MarkShortCircuit() to immutable and optional field validations.

* Add generated declarative validation test files for Secret

validation-gen generates test/declarative_validation/core/secret/
as part of Secret declarative validation wiring.

* Add declarative validation coverage test for Secret.type immutability

The coverage checker requires all registered validation rules to be
exercised by tests. Add a test that triggers the immutable validation
error for Secret.type to satisfy coverage for the generated rule:
  v1, Kind=Secret: type FieldValueInvalid origin="immutable"

* Move Secret declarative validation tests to test/declarative_validation

Move all test cases from pkg/registry/core/secret/declarative_validation_test.go
to test/declarative_validation/core/secret/declarative_validation_test.go
per #138872, and remove the original file.

* Revert ReplicationController alpha tags from 1.37 back to 1.36

The since: "1.36" tags on ReplicationController fields track when those
tags were originally added (v1.36) and should not have been changed.
Only the newly added Secret.Type immutable tag targets 1.37.
2026-06-10 05:59:45 +05:30
Yongrui Lin
33565abba4 address feedback: make Job test fixture explicit about both-set case
Removes BackoffLimitPerIndex/MaxFailedIndexes defaults from validJobSpec
and adds tweakMaxFailedIndexes. Test cases now pass both tweaks
explicitly, matching cronjob's style — the truth table is visible at
the test case rather than hidden in the fixture.
2026-06-08 21:58:29 +00:00
Yongrui Lin
724809a4bc Regenerate batch generated code 2026-06-08 21:58:29 +00:00
Yongrui Lin
3c1f8c4fbc Add declarative validation tests for MaxFailedIndexes dependency
Adds a parity test for Job (new test/declarative_validation/batch/job
directory) and a case under cronjob exercising the
spec.jobTemplate.spec.backoffLimitPerIndex path.
2026-06-08 21:58:29 +00:00
Lalit Chauhan
10c505b1d3 Wire tests 2026-05-29 02:55:24 +00:00
Lalit Chauhan
9c89ae8a67 Generate validation code 2026-05-29 02:53:37 +00:00
dom4ha
72d770c679 Convert DisruptionMode from enum to struct 2026-05-22 12:50:19 +00:00
dom4ha
88948acc38 Remove v1alpha2 API definitions
Update client-go lister and informer imports to v1alpha3
2026-05-22 12:50:19 +00:00
dom4ha
6404ddc2b7 Add generated files for v1alpha3
Run code generation for v1alpha3
2026-05-22 12:50:18 +00:00
Kubernetes Prow Robot
42203f13fd
Merge pull request #139198 from yongruilin/dv-test-owners
chore: add OWNERS to test/declarative_validation
2026-05-21 02:30:44 +05:30
yongruilin
b7d52daa7b chore: add OWNERS to test/declarative_validation
Add OWNERS file under test/declarative_validation to ensure only API reviewers and approvers have authority over these tests.
2026-05-20 19:12:25 +00:00
Yongrui Lin
44f6df54da Drop legacy hand-written validation subtest from pkg/api/testing
With DV always enforced, the "hand written validation" subtest (which
set DeclarativeValidation=off and emulated 1.35) now exercises the
same code path as "Beta disabled". Remove it along with the
MinEmulationVersion option, the WithMinEmulationVersion helper,
deDuplicateErrors, and the now-tautological imperative-vs-declarative
equivalence checks.
2026-05-20 18:54:07 +00:00
Yongrui Lin
c50ef6e64c test/declarative_validation: add hand-written Scale equivalence tests
Add declarative_validation_test.go under autoscaling/scale/ and apps/scale/
that invoke ValidateScaleUpdate via VerifyUpdateValidationEquivalenceFunc.
The tests observe the rules declared by the generated fixtures, satisfying
AssertDeclarativeCoverage for autoscaling/v1.Scale, apps/v1beta1.Scale,
and apps/v1beta2.Scale.
2026-05-13 20:35:04 +00:00
Yongrui Lin
87a1f97c90 test/declarative_validation: drop Scale allowlist exemptions and regen
Remove the autoscaling/v1.Scale, apps/v1beta1.Scale, and apps/v1beta2.Scale
entries from coverage-allowlist.yaml, then regenerate declarative-validation
test fixtures so the corresponding RegisterDeclaredRules calls and TestMain
files are emitted under autoscaling/scale/ and apps/scale/.
2026-05-13 20:08:14 +00:00
Yongrui Lin
e35569096e Rename validation-gen test fixtures to zz_generated.validations.* prefix
Mechanical rename to match the new --test-output-file-prefix value;
file contents are unchanged.
2026-05-12 20:31:33 +00:00
Yongrui Lin
a791288d81 test/declarative_validation: migrate DV equivalence tests to new tree
Move the existing declarative_validation_test.go files out of
pkg/registry/ into a top-level tree at
test/declarative_validation/<group>/<kind>/. The new location pairs
each hand-written test with the per-Kind TestMain and version-init
files emitted by validation-gen, so the coverage gate runs alongside
the equivalence checks and apiVersions no longer needs to be
hand-maintained.
2026-05-09 19:11:01 +00:00
Yongrui Lin
daae4100a6 hack: enable coverage fixture generation in update-codegen.sh
Pass -test-output-root and -test-allowlist to validation-gen so the
per-Kind coverage fixtures regenerate alongside the validators. Add the
allowlist YAML at test/declarative_validation/coverage-allowlist.yaml.
2026-05-09 19:11:01 +00:00