479 Commits

Author SHA1 Message Date
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
AxeZhan
070e7a38cb generic set 2023-10-28 15:31:28 +08:00
Stephen Kitt
aa89e6dc97 Use ptr.To to retrieve intstr addresses
This uses the generic ptr.To in k8s.io/utils to replace functions and
code constructs which only serve to return pointers to intstr
values. Other uses of the deprecated pointer package are updated in
modified files.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2023-09-08 11:10:50 +02:00
Patrick Ohly
2472291790 api: introduce separate VolumeResourceRequirements struct
PVC and containers shared the same ResourceRequirements struct to define their
API. When resource claims were added, that struct got extended, which
accidentally also changed the PVC API. To avoid such a mistake from happening
again, PVC now uses its own VolumeResourceRequirements struct.

The `Claims` field gets removed because risk of breaking someone is low:
theoretically, YAML files which have a claims field for volumes now
get rejected when validating against the OpenAPI. Such files
have never made sense and should be fixed.

Code that uses the struct definitions needs to be updated.
2023-08-21 15:31:28 +02:00
git-jxj
a5b3a4b738 cleanup: Update deprecated FromInt to FromInt32 (#119858)
* redo commit

* apply suggestions from liggitt

* update Parse function based on suggestions
2023-08-16 09:33:01 -07:00
Tim Hockin
ec3379a717 Do hostNet Pod-ports -> hostPorts in Pod defaults
Rather than doing it in PodSpec defaulting, which triggers in
Deployments and DaemonSets, do it only when a Pod is actually in play.
2023-05-09 18:10:20 -07: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
Stephen Kitt
4911e9de4a api: replace intstr.FromInt with intstr.FromInt32
This touches cases where FromInt() is used on numeric constants, or
values which are already int32s, or int variables which are defined
close by and can be changed to int32s with little impact.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2023-05-01 09:16:15 +02:00
mfordjody
c3384191ea remove validation GCE-ism
update testing

update testing

update testing

update core and testing

update testing
2023-04-24 14:27:37 +08:00
Kubernetes Prow Robot
4c6d6aa482 Merge pull request #116602 from mattcary/fuzz
Simplify statefulset fuzzer
2023-04-13 17:24:38 -07:00
Kubernetes Prow Robot
c4ebf5f1e3 Merge pull request #116722 from luoqr96/myfeature
Chore: test simplification for stateful set
2023-04-11 18:19:37 -07:00
Kubernetes Prow Robot
d0fc9d16ce Merge pull request #114800 from haoruan/feature-8976-spew-sprintf-refactor
Capture spew.Sprintf() with all our favorite config into a util func
2023-04-11 15:34:57 -07:00
Hao Ruan
f638e2849f replaced spew.Sprintf with a util pretty print function 2023-03-27 09:24:22 +08:00
Qirui
ddc13e983b Chore: add selector labels tweak function 2023-03-22 11:02:25 +08:00