Commit Graph

68 Commits

Author SHA1 Message Date
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
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
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
Qirui
4cab11f26f Chore: add persistent volume claim retention policy tweak function 2023-03-22 11:02:01 +08:00
Qirui
ba9dfe686f Chore: add persistent volume claim template tweak function 2023-03-22 11:01:37 +08:00
Qirui
f97d3cf748 Chore: add rolling update max unavailable type tweak function 2023-03-22 11:01:25 +08:00
Qirui
1b17b4fa79 Chore: add rolling update partition type tweak function 2023-03-22 11:01:04 +08:00
Qirui
f3ffeae426 Chore: add update strategy type tweak function 2023-03-22 11:00:46 +08:00
Qirui
5e0161b3de Chore: add labels tweak function 2023-03-22 11:00:25 +08:00
Qirui
ec34891782 Chore: add annotation tweak function 2023-03-22 10:51:54 +08:00
Qirui
b907d5af49 Chore: add finalizers tweak function 2023-03-22 10:51:41 +08:00
Qirui
18ba7c0e43 Chore: add ordinal start tweak function 2023-03-22 10:51:18 +08:00
Qirui
3eb34d8b6c Chore: add min ready seconds tweak function 2023-03-22 10:51:03 +08:00
Qirui
2161d095fa Chore: add template restart policy tweak function 2023-03-22 10:50:42 +08:00
Qirui
4418a9f590 Chore: add replicas tweak function 2023-03-22 10:49:51 +08:00
Qirui
7fc08e0ce7 Chore: add pod management policy tweak function 2023-03-22 10:48:29 +08:00
Qirui
77c7d6efcf Chore: add basic make function for stateful set
Add name and namespace tweak functions
2023-03-22 10:47:43 +08:00
Peter Schuurman
a714e9e485 Fix validation.go to validate without StatefulSetStartOrdinal feature gate check. Adds test case to validate regression fix of validation failing when spec.ordinals set and feature gate disabled 2023-02-23 16:22:56 -08:00
Tim Hockin
c5c58eb653
StatefulSet validation needs to allow old names
A recent commit changed name validation from DNS Subdomain to DNS Label.
The assumption was that a subdomain-named SS could never work and the
only reasonable thing to do would be to delete it.  But if there is a
finalizer, the delete is not possible because we would reject the update
because the old name (subdomain) did not pass the new validation.

This commit does not re-validate the ObjectMeta on update.  Probably
every resource should follow this pattern, but mostly it's a non-issue
becauase the above change (name validation) is not something we do -
this case was excpetional.
2022-12-15 09:33:47 -08:00
Tim Hockin
f4c1682fb1
Validate StatefulSet names as DNS Label
Any StatefuleSet which took advantage of this (by having dots in the
name) can't have worked because we set `pod.spec.hostname` from it,
which is validated as a DNS label.

So while this is strictly a breaking change, it doesn't break anything
that was not already broken.
2022-11-28 17:31:08 -08:00
Peter Schuurman
366997951b Update doc comments and change name of feature gate 2022-11-08 07:48:10 -08:00
Peter Schuurman
7b3d77a41a Adding implementation of KEP-3335, StatefulSetSlice 2022-11-08 07:48:00 -08:00
Lee Verberne
d238e67ba6 Remove EphemeralContainers feature-gate checks 2022-07-26 02:55:30 +02:00
Ravi Gudimetla
7397c029e8 Promote DS MaxSurge to GA 2022-07-18 07:54:59 -04:00
Ravi Gudimetla
9144250a92 Promote minReadySeconds to GA 2022-07-13 11:37:10 -04:00
areller
a6943ad863
[fix] fix and refactor TestValidateStatefulSet and TestValidateStatefulSet test cases (#109809)
* restructure tests

restructure TestValidateStatefulSet and TestValidateStatefulSetUpdate to be an array and accept list of expected errors. in this commits, no tests were changed and expected errors are not filled yet

* add expected errors

adding expected errors and making the tests pass, without making any changes to the tests

* clean up TestValidateStatefulSet error cases

* clean up TestValidateStatefulSetUpdate cases

* validate new statefulset as part of update validation

* address PR comments
2022-05-24 11:55:24 -07:00
Mayank Kumar
357203d992 API: maxUnavailable for StatefulSet 2022-03-28 11:01:05 -07:00
Matthew Cary
f1d5d4df5a tests for statefulset PersistentVolumeClaimDeletePolicy api change 2021-11-17 16:46:48 -08:00
Matthew Cary
aeb82243fc Revert "tests for statefulset PersistentVolumeClaimDeletePolicy api change"
This reverts commit b259686b36.

Change-Id: I25cc8ae8a9aa77d0bc483147d3f8fb65616a2b2b
2021-07-16 11:51:35 -07:00
Matthew Cary
b259686b36 tests for statefulset PersistentVolumeClaimDeletePolicy api change
Change-Id: I07c8e31a8c76a6a1022c08fb749af7e353b731de
2021-06-23 11:55:35 -07:00
ravisantoshgudimetla
f3ab955018 validation: Handle presence of api introduced
When the StatefulSetMinReadySeconds feature gate is disabled,
the registry and validation must properly handle dropping the
minReadySeconds and AvailableReplicas fields
2021-05-25 20:03:18 -04:00
Abdullah Gharaibeh
d7e80ab038 Implement pod deletion cost 2021-03-01 13:45:58 -05:00
Clayton Coleman
c37c93f47a
validation: Handle presence of MaxSurge on DaemonSet
When the maxsurge daemonset gate is disabled, the registry and validation
must properly handle stripping the field. In the special case where that
would leave the MaxUnavailable field set to 0, we must set it to 1 which
is the default value.
2020-12-17 09:00:56 -05:00
Derek Carr
45bd6cb186 Downward API hugepages 2020-11-10 16:09:13 -05:00
Lee Verberne
013f049ce0 Add Ephemeral Containers to the Kubernetes core API 2019-07-22 11:19:22 +00:00
Jordan Liggitt
283e282515 Move extensions validation to apps 2018-10-25 21:11:52 -04:00
Di Xu
48388fec7e fix all the typos across the project 2018-02-11 11:04:14 +08:00
yuexiao-wang
400f5545bf add more test case in TestValidateStatefulSet
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2017-11-22 16:00:38 +08:00
Dr. Stefan Schimanski
012b085ac8 pkg/apis/core: mechanical import fixes in dependencies 2017-11-09 12:14:08 +01:00