This introduces state-based validation to declarative validation via the +k8s:discriminator and +k8s:member tags.
Key changes:
- Added validate.Modal runtime function to handle state-based logic, including full ratcheting support (skipping validation on Update if discriminator and value are unchanged).
- Implemented +k8s:discriminator to identify the controlling field (supports string, int, and bool).
- Implemented +k8s:member to map discriminator values to validation rules.
- Added implicit "forbidden-by-default" logic for unhandled modes, with support for pointer, slice, and map types.
This introduces MultiWrapperFunction to the generator AST, allowing multiple validation functions to be bundled into a single emitted closure. It correctly handles short-circuiting logic for the wrapped functions.
Introduce IsAlpha() and IsBeta() helper methods on field.Error to
encapsulate stability level checks. Unexport the underlying
ValidationStabilityLevel constants to keep the API surface minimal.
Update the apiserver's validation logic to use these helpers.
- Update resttest and genericregistrytest to support RequestInfo injection.
- Inject RequestInfo in Workload storage and strategy tests to resolve context-related failures.
- Refine validate.go log messages and error deduplication logic.
- Test scenarios: Beta Enabled, Beta Disabled, and Legacy (emulated 1.35).
- Remove deprecated Takeover gate references and redundant coverage checks.
- Add TODO to remove legacy emulation in 1.39.
- Update documentation to match the new Validation Lifecycle strategy.
Mark Workload v1alpha1 validations as +k8s:alpha(since:"1.35") and
configure the registry strategy to use WithDeclarativeEnforcement().
This transitions the resource to the stability-based validation lifecycle,
where enforcement is determined by tag stability and feature gates.
Includes generated code updates.
- Introduce WithDeclarativeEnforcement to opt-in to the lifecycle model.
- Update ValidateDeclarativelyWithMigrationChecks to:
- Enforce Beta-level validations when DeclarativeValidationBeta is enabled.
- Shadow Alpha-level validations.
- Filter handwritten errors only for Beta-level validations (when enabled).
- Limit mismatch checking to Alpha and Beta stages when enforcement is enabled.
- Deprecate WithDeclarativeNative and DeclarativeNative field in field.Error.
- Add comprehensive lifecycle tests and clean up redundant test cases.
This change introduces the DeclarativeValidationBeta feature gate in v1.36
as the global safety switch for Beta-stage validation rules and marks
DeclarativeValidationTakeover as deprecated.
Following KEP-5073.
This metric is meant to help end-users identify which metrics provider
kubelet is using under the hood to expose container stats.
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
We need to add a marker to allow podgroup to be marked up correctly as a union type, and then teach the nonpointerstructs linter how to understand this
Replace all imports of k8s.io/apimachinery/pkg/util/dump with
k8s.io/utils/dump across the repo. The apimachinery dump package
now contains deprecated wrapper functions that delegate to
k8s.io/utils/dump for backwards compatibility.
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This used to be an E2E test, but it turned out to be too slow and unreliable
and therefore got removed. As an integration test we have a bit better control
over the environment, so it should be possible to avoid the same flakes.
Some of the slowness comes from pods entering backoff. Maybe this is an
opportunity for future improvements.
To support this tests, the ResourceClaim controller is needed. The framework
can start it on demand now, similar to how the scheduler was handled already.