Commit Graph

492 Commits

Author SHA1 Message Date
Mads Jensen
f11bb48738 Remove redundant re-assignment in for-loops under pkg
This the forvar rule from modernize. The semantics of the for-loop
changed from Go 1.22 to make this pattern obsolete.
2026-03-02 08:47:43 +01:00
Your Name
701db6b6a6 validation-gen: Fix all stable api violations by prefixing +k8s:alpha(since:"1.36") and exclude output_tests from linting 2026-02-25 00:50:31 +00:00
Davanum Srinivas
550cc8645b Move dump package from apimachinery to k8s.io/utils
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>
2026-02-12 07:34:19 -05:00
yongruilin
47fb373c31 run update-codegen.sh 2025-11-06 00:54:52 +00:00
Kubernetes Prow Robot
f051670a47 Merge pull request #133087 from atiratree/terminating-replicas-beta
promote DeploymentReplicaSetTerminatingReplicas to Beta
2025-10-27 04:47:37 -07:00
Lubomir I. Ivanov
3968f7ec5d apis/apps/fuzzer: add missing MaxUnavailable defaulting
Include defaulting in the StatefulSet fuzzer for the field
RollingUpdate.MaxUnavailable, otherwise when the feature gate
MaxUnavailableStatefulSet is enabled it changes the default
in SetDefaults_StatefulSet from /pkg/apis/apps/v1/defaults.go.

That can cause errors such as:
  --- FAIL: TestRoundTripTypes (1.05s)

...

  - MaxUnavailable: nil,
  + MaxUnavailable: s"1",
2025-10-21 19:03:57 +02:00
Filip Křepinský
b0e47a88f7 promote DeploymentReplicaSetTerminatingReplicas to Beta 2025-10-10 20:22:37 +02:00
Heba Elayoty
fe681cfd8f update comments
Signed-off-by: Heba Elayoty <heelayot@microsoft.com>
2025-09-29 21:31:11 +00:00
Heba Elayoty
83163d0b4a update comments on beta apis
Signed-off-by: Heba Elayoty <heelayot@microsoft.com>
2025-09-29 14:02:17 -07:00
Heba Elayoty
b656027b93 Update MaxUnavailableStatefulSet feature gate to beta
Signed-off-by: Heba Elayoty <heelayot@microsoft.com>
2025-09-29 14:02:13 -07: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
Maciej Szulik
09e357d31f Drop StatefulSetAutoDeletePVC after the feature GA-ed in 1.32
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-08-28 13:35:16 +02:00
carlory
94bf8fc8a9 Promoted API VolumeAttributesClass and VolumeAttributesClassList to storage.k8s.io/v1.
Promoted feature-gate `VolumeAttributesClass` to GA (on by default)

Signed-off-by: carlory <baofa.fan@daocloud.io>
2025-07-25 01:53:59 +08:00
Bing Hongtao
6f3b6b91f0 KEP-3721: Support for env files (#132626)
* Add FileKeyRef field and struct to the Pod API

* Add the implementation code in the kubelet.

* Add validation code

* Add basic functionality e2e tests

* add codes for drop disabled pod fields

* update go.mod
2025-07-22 13:40:42 -07:00
Kubernetes Prow Robot
190b3cca2b Merge pull request #132212 from astraw99/fix-sts-validation
Add validation of `volumeClaimTemplates` in StatefulSet
2025-07-16 11:04:23 -07:00
astraw99
6e93244532 Add validation of volumeClaimTemplates in StatefulSet 2025-07-16 12:24:35 +08:00
Kubernetes Prow Robot
8947e2fae0 Merge pull request #132115 from liangyuanpeng/drop-ptr-wrappers-pkg-apps
pkg/appis/apps: use utils/ptr package instead of utils/pointer
2025-07-03 14:43:25 -07:00
Kubernetes Prow Robot
a9841ca3b3 Merge pull request #131790 from chengjoey/fix/sts-validation
fix pod template spec validation missing in sts
2025-07-01 09:21:31 -07:00
joey
dfd34a5b18 fix pod template spec validation missing in sts
Signed-off-by: joey <zchengjoey@gmail.com>
2025-06-27 16:30:51 +08:00
xiaoweim
8632257c93 Cleanup: Remove redundant detail messages in field.Required 2025-06-26 21:24:43 +00:00
yongruilin
1574001a1c run update-codegen.sh 2025-06-11 23:44:52 +00:00
Lan Liang
258961cb35 pkg/appis/apps: use utils/ptr package instead of utils/pointer
The new k8s.io/utils/ptr package provides generic wrapper functions,
which can be used instead of type-specific pointer wrapper functions.
This replaces the latter with the former, and migrates other uses of
the deprecated pointer package to ptr in affacted files.

See kubernetes/utils#283 for details.

Signed-off-by: Lan Liang <gcslyp@gmail.com>
2025-06-05 05:30:59 +00:00
Joe Betz
1d17ca9b7e generate code 2025-05-24 00:03:35 -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
Luca Lanziani
2ea6892077 Always check for Immutable selector in Deployment Replicaset Daemonset (#131017)
* Always for Immutable selector in Deployment Replicaset Daemonset

With extensions/v1beta1 removed there is no need of a special case
to check for Spec.Selector immutability.

The ValidateImmutableField is now moved into the
Validate[Resource]Update method, tests for v1beta1 are removed and test
for v1 are added.

Validation tests were updated to reflect the changes,
mostly decoupling other fields changes from selectors and creating a
dedicated case to test selector immutability.

* Move validation inside appropriate function

* Fix validation tests
2025-04-23 15:58:37 -07:00
Filip Křepinský
8db1426554 rename DeploymentPodReplacementPolicy FG to DeploymentReplicaSetTerminatingReplicas 2025-03-27 20:27:44 +01:00
Maciej Szulik
8eb74b96e3 Add validation to StatefulSet's .spec.serviceName
.spec.serviceName field is injected into pod.spec.subDomain which
requires values to be valid DNS1123 label, but statefulset validation
never validates the field, if specifired. This can cause the controller
to fail creating pods.

Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-03-13 17:53:12 +01:00
Maciej Szulik
42abc2a73b Mark StatefulSet's .spec.serviceName optional
The API reference doc
(https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/stateful-set-v1/#StatefulSetSpec)
mentions .spec.serviceName field is required, because it doesn't have
optional tag, nor omitempty. In practice this field is optional, and can
be empty. This change explicitly marks the field optional.

Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-03-10 17:13:59 +01:00
Tim Hockin
e54719bb66 Use randfill, do API renames 2025-03-08 15:18:00 -08:00
Tim Hockin
c8111709e5 Add an error matcher, convert 2 tests
I fixed up the TestValidateEndpointsCreate path to show the matcher
instead of manual origin checking.

I picked TestValidateTopologySpreadConstraints because it was the last
failing test on my screen when I changed on of the commonly hard-coded
error strings. I fixed exactly those validation errors that were needed
to make this test pass.  Some of the Origin values can be debated.

The `field/testing.Matcher` interface allows tests to configure the
criteria by which they want to match expected and actual errors.  The
hope is that everyone will use Origin for Invalid errors.

There's some collateral impact for tests which use exact-comparisons and
don't expect origins.  These are all candidates for using the matcher.
2025-02-28 08:36:26 -08:00
Filip Křepinský
28437797b5 update generated files and feature gates 2025-01-23 22:26:34 +01:00
Filip Křepinský
14783b8a9b add validation, field disablement and tests 2025-01-23 22:26:34 +01:00
Filip Křepinský
f7c46df665 api: add terminatingReplicas field to ReplicaSet and Deployment statuses
- update internal ReplicaSet and Deployment type documentation to match with
  versioned API
- made Replicaset and Deployment type documentation more consistent
2025-01-23 22:26:34 +01:00
Arda Güçlü
7c887412c8 Add validation for revisionHistoryLimit in sts to prevent negative value (#129017)
* Add validation for revisionHistoryLimit in sts to prevent negative value

* Add unit tests to verify warning messages
2025-01-06 20:04:31 +01: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
ndixita
85488b5f10 Generated files and compatability data from API changes 2024-11-08 03:00:50 +00:00
Kubernetes Prow Robot
50362ac7d0 Promote StatefulSetAutoDeletePVC to stable for 1.32. 2024-11-07 09:43:49 -08:00
Joe Betz
2595aa1309 generate 2024-09-03 14:26:26 -04:00
Peter Schuurman
585971431b Remove StatefulSetStartOrdinal feature gate to target stable in 1.31 2024-07-16 08:05:09 -07:00
Michael Fraenkel
cd949bafa4 use MakePodSpec consistently (#125805)
cleaning up some tests after MakePod/MakePodSpec were introduced
2024-06-30 10:28:36 -07:00
Michael Fraenkel
a7264f95ff pod terminationGracePeriodSeconds is always valid (#124461)
* Pod terminationGracePeriodSeconds is always valid

Validation of a pod spec will always use the pod's
TerminationGracePeriodSeconds value.

A set of pod test-helpers have been created to help construct Pods.

* remove unused func

* reduction

* reduce 2

* simplify test

* report invalid grace period

* update SupplementalGroupPolicy tests
2024-06-29 18:09:29 -07:00
Tim Hockin
a074dd6f2e Use +default for now deprecated ScaleIO volume 2024-06-19 12:18:33 -07:00
Tim Hockin
0f5ab4beec Use +default for now deprecated AzureDisk volume 2024-06-19 11:59:52 -07:00
Tim Hockin
333c02cf28 Use +default for now deprecated ISCSI volume 2024-06-19 11:59:20 -07:00
Tim Hockin
03f0110b95 Use +default for now deprecated RBD volume
THis leaves us less hand-written code and a better schema.
2024-06-19 11:58:26 -07:00
Jordan Liggitt
d6d78c5581 Ensure controller revision data is valid json 2024-06-17 14:32:51 -04:00
Marek Siarkowicz
3ee8178768 Cleanup defer from SetFeatureGateDuringTest function call 2024-04-24 20:25:29 +02:00
Tim Hockin
ae01c2126f Remove the gate "SkipReadOnlyValidationGCE"
One less GCE-specifc wart in the codebase.
2024-04-06 15:11:20 -07:00