Commit Graph

1225 Commits

Author SHA1 Message Date
Shiming Zhang
d303cec118 Update test 2024-02-29 11:48:18 +08:00
Kensei Nakada
f46df21cad update comments on API 2024-02-28 12:32:32 +00:00
Kubernetes Prow Robot
72c92e975d
Merge pull request #123411 from hunshcn/fix/volume-link
fix persistent volume docs link
2024-02-27 16:47:27 -08:00
Gunju Kim
a24f2c1192
Validate restartable init container state transition
This allows the state of restartable init containers to be transitioned
from terminated to non-terminated even for pods with RestartPolicyNever
or RestartPolicyOnFailure.
2024-02-26 20:47:40 +09:00
Paco Xu
dc7114fa91 fix default IPMode set in UT 2024-02-26 12:32:01 +08:00
hunshcn
ce6bacb5ac
fix persistent volume docs link
Signed-off-by: hunshcn <hunsh.cn@gmail.com>
2024-02-21 16:26:16 +08:00
Kubernetes Prow Robot
91ee30074b
Merge pull request #123174 from danwinship/cidr-validation-cleanup
Make CIDR validation consistent
2024-02-15 18:37:20 -08:00
Akihiro Suda
5c825d8a22
core/v1: remove comment about non-existing constants
`NodeReachable`, `NodeLive`, `NodeSchedulable`, and `NodeRunnable` are mentioned
as "built-in set of conditions" but some of them do not exist in the current API.

Updated `pkgs/apis/core/types.go` too for consistency.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-02-12 23:16:43 +09:00
Dan Winship
593b1c6c63 Do service.spec.LoadBalancerSourceRanges validation inline
Inline the LoadBalancerSourceRanges parsing to make it more obvious
what it's requiring (and more importantly, *not* requiring), and
change it to use IsValidCIDR as well.
2024-02-09 10:43:20 -05:00
Dan Winship
d930215794 Update service.Spec.LoadBalancerSourceRanges validation tests
In preparation for rewriting LoadBalancerSourceRanges validation,
add/update the existing unit tests to cover some of the more exciting
edge cases of the existing validation code:

  - The values in service.Spec.LoadBalancerSourceRanges are allowed to
    have arbitrary whitespace around them.

  - The annotation must be unset for non-LoadBalancer services, but
    for LoadBalancer services, "set but empty" and "whitespace-only"
    are treated the same as "unset".

  - The annotation value is only validated if the field is not set.

Also fix some of the existing tests to be more precise about what they
are testing.

Also fix the CIDR values to actually be valid. Sigh.
2024-02-09 10:43:20 -05:00
Dan Winship
7a56b6e3f7 Add validation.IsValidCIDR
Move apivalidation.ValidateCIDR to apimachinery, and rename it and
change its return value to match the other functions.

Also, add unit tests.

(Also, while updating NetworkPolicy validation for the API change, fix
a variable name that implied that IPBlock.Except[] is IP-valued rather
than CIDR-valued.)
2024-02-07 09:48:01 -05:00
Kubernetes Prow Robot
052bce26f4
Merge pull request #122931 from danwinship/ip-validation-cleanup
consistently use IsValidIP for IP validation
2024-02-06 15:58:15 -08:00
Kubernetes Prow Robot
f025a96d2f
Merge pull request #122728 from RomanBednar/pv-phase-transition-time-doc-fix
Remove alpha reference from PersistentVolumeStatus.lastPhaseTransitionTime docs
2024-01-24 19:51:51 +01:00
Kubernetes Prow Robot
fc4d6ac8ea
Merge pull request #121731 from Taction/service-account-token-projected-volume-validation
Fix service account token projected volume validation
2024-01-24 19:51:43 +01:00
zhangchao
7972f0309c Fix service account token projected volume validation
Signed-off-by: zhangchao <zchao9100@gmail.com>
2024-01-23 23:03:37 +08:00
Dan Winship
1d59d6b6c6 Use validation.IsValidIP in a few more places
Rather than using netutils.ParseIPSloppy directly.

Also fix the field paths in the errors for pod.spec.hostAliases to
include the array index.
2024-01-23 09:10:35 -05:00
Dan Winship
519dd6887d Make validation.IsValidIP return a field.ErrorList for consistency 2024-01-23 09:08:27 -05:00
Roman Bednar
2ce04fc04b flag PersistentVolumeLastPhaseTransitionTime field as beta 2024-01-17 13:14:09 +01:00
Lubomir I. Ivanov
47ee56a7f2 core/v1: remove note about hostAliases not working with hostNetwork
Support for this was added in 1.8 by PR 50646.
Local tests confirm that the feature indeed works.
E2e tests seem to be missing.
2023-12-20 18:09:21 +02:00
Kevin Hannon
7ba546cfeb drop alpha comment on ephemeral storage 2023-11-20 09:58:13 -05:00
Taahir Ahmed
599fdb7add Regenerate for ClusterTrustBundlePEM projected volume API 2023-11-03 11:40:48 -07:00
Taahir Ahmed
ecfdc8fda5 Define ClusterTrustBundlePEM projected volume
This commit defines the ClusterTrustBundlePEM projected volume types.
These types have been renamed from the KEP (PEMTrustAnchors) in order to
leave open the possibility of a similar projection drawing from a
yet-to-exist namespaced-scoped TrustBundle object, which came up during
KEP discussion.

* Add the projection field to internal and v1 APIs.
* Add validation to ensure that usages of the project must specify a
  name and path.
* Add TODO covering admission control to forbid mirror pods from using
  the projection.

Part of KEP-3257.
2023-11-03 11:40:48 -07:00
Humble Chirammal
3890546265 Update APIs and adjust tests
Signed-off-by: zhucan <zhucan.k8s@gmail.com>
Signed-off-by: Humble Chirammal <humble.devassy@gmail.com>
2023-11-01 09:28:36 +05:30
Kubernetes Prow Robot
dba565193c
Merge pull request #121104 from carlory/kep-3751-api-changes
[KEP-3571] introduce the VolumeAttributesClass API
2023-10-31 20:23:50 +01:00
Kubernetes Prow Robot
d475c249da
Merge pull request #120954 from HirazawaUi/deprecate-kubeProxyVersione-field
deprecate the kubeProxyVersion field of v1.Node
2023-10-31 19:16:20 +01:00
Kubernetes Prow Robot
418e9d08a4
Merge pull request #120592 from AxeZhan/validation_sets
Use generic set in package "/pkg/apis/core/validation"
2023-10-31 19:16:02 +01:00
carlory
56ab6c5942 generated changes 2023-10-31 11:26:35 +08:00
carlory
ae90a69677 volumeattributesclass and core api changes 2023-10-31 11:18:56 +08:00
HirazawaUi
2c2fa2107a deprecate the kubeProxyVersion field of v1.Node 2023-10-29 15:04:11 +08:00
AxeZhan
070e7a38cb generic set 2023-10-28 15:31:28 +08:00
Paco Xu
36d6917ae1 valid error for creation and update from valid to invalid only
- using an option AllowNamespacedSysctlsForHostNetAndHostIPC

Signed-off-by: Paco Xu <paco.xu@daocloud.io>
2023-10-28 06:58:54 +08:00
Paco Xu
9a8ccdebc5 use sysctl utils to do pod spec validation
Signed-off-by: Paco Xu <paco.xu@daocloud.io>
2023-10-28 06:58:51 +08:00
Paco Xu
4321652d13 reject pod creation for hostNet pod with net sysctl; hostIPC pod with ipc sysctl
Signed-off-by: Paco Xu <paco.xu@daocloud.io>
2023-10-28 06:58:28 +08:00
Kubernetes Prow Robot
6d7d249372
Merge pull request #121077 from chrishenzie/readwriteoncepod-ga
Graduate ReadWriteOncePod to GA
2023-10-24 05:26:05 +02:00
Kubernetes Prow Robot
441d4b54ae
Merge pull request #120397 from ty-dc/StaticCheck
cleanup: omit comparison with bool constants
2023-10-24 05:25:52 +02:00
Kubernetes Prow Robot
581552eaf0
Merge pull request #116065 from sanposhiho/match-label-key-alternative
feature(scheduler): implement matchLabelKeys in PodAffinity and PodAntiAffinity
2023-10-23 18:39:13 +02:00
Chris Henzie
2dbd405583 Graduate ReadWriteOncePod to GA 2023-10-20 10:40:39 -07:00
Kubernetes Prow Robot
2c10d9cacb
Merge pull request #121277 from dprotaso/update-standard-protocols
update standard protocols to match KEP-3726
2023-10-20 03:10:43 +02:00
Dave Protasowski
b7477c31b0 update versioned types 2023-10-18 11:36:48 -04:00
Kensei Nakada
d5d3c26337 feature(scheduler): implement matchLabelKeys in PodAffinity and PodAntiAffinity 2023-10-18 11:28:02 +00:00
Kubernetes Prow Robot
bb16282831
Merge pull request #120249 from pacoxu/downwardAPI-hugepages
remove GAed FG DownwardAPIHugePages
2023-10-16 23:40:57 +02:00
Dave Protasowski
76059738a4 update standard protocols to match KEP3726 2023-10-16 17:38:06 -04:00
AxeZhan
5c0618b848 codegen 2023-10-16 19:50:33 +08:00
AxeZhan
fa01dfdb0a validation 2023-10-15 13:55:08 +08:00
AxeZhan
9327f3a173 api changes 2023-10-15 13:32:54 +08:00
Kubernetes Prow Robot
e606314f2f
Merge pull request #118768 from killshotrevival/master
Fail validation if container restart policy is 'Never' and resource resize restart policy isn't 'NotRequired'
2023-10-15 04:13:34 +02:00
Kubernetes Prow Robot
a2cc9db02f
Merge pull request #119665 from vinaykul/getpodqos-optimization
Perf optimization: GetPodQOS() returns persisted value of PodStatus.QOSClass, if set.
2023-10-12 06:48:26 +02:00
carlory
5fcffcf4e4 Add APIGroup ratcheting validation to PVC.DataSource 2023-09-13 13:10:22 +08:00
tao.yang
b35357b6c0 cleanup: omit comparison with bool constants
Signed-off-by: tao.yang <tao.yang@daocloud.io>
2023-09-05 10:24:38 +08:00
Quan Tian
2b69daa960 Allow specifying ExternalTrafficPolicy for ClusterIP Services with ExternalIPs
When defining a ClusterIP Service, we can specify externalIP, and the
traffic policy of externalIP is subject to externalTrafficPolicy.
However, the policy can't be set when type is not NodePort or
LoadBalancer, and will default to Cluster when kube-proxy processes the
Service.

This commit updates the defaulting and validation of Service to allow
specifying ExternalTrafficPolicy for ClusterIP Services with
ExternalIPs.

Signed-off-by: Quan Tian <qtian@vmware.com>
2023-08-30 23:56:47 +08:00
Kubernetes Prow Robot
370c85f5ab
Merge pull request #118493 from kerthcet/cleanup/pod-status-reason
Remove reasons from PodConditionType
2023-08-30 01:40:47 -07:00
Paco Xu
41adc93ca3 remove GAed FG DownwardAPIHugePages 2023-08-30 10:56:35 +08:00
Kubernetes Prow Robot
c0691f3784
Merge pull request #119789 from thockin/deprecate_svc_lb_ingress_with_clusterip
Gate: disallow .status.loadBalancer on non-LB svc
2023-08-22 10:02:55 -07:00
Patrick Ohly
c1eb18c00c generated files 2023-08-21 17:07:43 +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
a930892769
Gate: disallow .status.loadBalancer on non-LB svc
The fact that the .status.loadBalancer field can be set while .spec.type
is not "LoadBalancer" is a flub.  Any spec update will already clear
.status.ingress, so it's hard to really rely on this.  After this
change, updates which try to set this combination will fail validation.

Existing cases of this will not be broken.  Any spec/metadata update
will clear it (no error) and this is the only stanza of status.

New gate "AllowServiceLBStatusOnNonLB" is off by default, but can be
enabled if this change actually breaks someone, which seems exceeedingly
unlikely.
2023-08-20 16:40:41 -07:00
Kubernetes Prow Robot
ee265c92fe
Merge pull request #119937 from RyanAoh/kep-1860-dev
Make Kubernetes aware of the LoadBalancer behaviour
2023-08-17 14:00:28 -07: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
Aohan Yang
29a6705dab Generated code for IP mode field 2023-08-14 12:33:54 +08:00
Aohan Yang
3ac2899d2b Add IP mode field 2023-08-14 11:24:49 +08:00
Mark Rossetti
0d90d1ffa5
Revert "Merge pull request #118895 from RyanAoh/kep-1860"
This reverts commit 890a6c8f70, reversing
changes made to 4f60a8d493.
2023-08-09 15:51:20 -07:00
Vinay Kulkarni
40b604e374 Update pkg/apis/core/helper/qos/qos.go
Co-authored-by: Itamar Holder <77444623+iholder101@users.noreply.github.com>
2023-08-08 04:01:46 +00:00
vinay kulkarni
4063ca4050 Code review fix: Move GetPodQOS code to ComputePodQOS. If set, return PodStatus.QOSClass from GetPodQOS. 2023-08-07 14:47:37 +00:00
vinay kulkarni
5d4410b960 Perf optimization: Move away from GetPodQOS, using PodStatus.QOSClass instead 2023-08-07 14:47:37 +00:00
Roman Bednar
294f5c9a42 make update 2023-07-21 21:39:24 +02:00
Roman Bednar
1b4de065df add LastPhaseTransitionTime field to PersistentVolume 2023-07-21 17:19:11 +02:00
Kubernetes Prow Robot
d17f3ba2cf
Merge pull request #119168 from gjkim42/sidecar-allow-probes-and-lifecycle-hooks
Allow all probes and lifecycle for restartable init containers
2023-07-17 18:11:07 -07:00
Gunju Kim
3bf282652f
Allow restartable init containers to have lifecycle 2023-07-18 08:12:24 +09:00
Gunju Kim
7ef2d674e2
Allow restartable init containers to have livenessProbe 2023-07-18 07:54:33 +09:00
Gunju Kim
2c8b37498e
Allow restartable init containers to have readinessProbe 2023-07-18 07:54:33 +09:00
Gunju Kim
8b20dbd0d1
Add validateStartupProbe 2023-07-18 07:54:32 +09:00
Hemant Kumar
2e217e8cea Reduce duplication between helpers for checking featuregate 2023-07-17 15:34:45 -04:00
Hemant Kumar
137474e283 Fix validation options for old pvc
Also update comments on allocatedresourcestatuses fields
2023-07-17 15:30:36 -04:00
Hemant Kumar
f01a1faa8c Update comments about allocatedResourceStatus
Update API types with more comments
2023-07-17 15:30:36 -04:00
Hemant Kumar
6a780f57ce Update generated data 2023-07-17 15:30:36 -04:00
Hemant Kumar
e011187114 Update code to use new generic allocatedResourceStatus field 2023-07-17 15:30:35 -04:00
Aohan Yang
7c6e399b22 Generated code for IP mode field 2023-07-17 16:01:59 +08:00
Aohan Yang
e6863757f4 Add IP mode field 2023-07-17 15:51:40 +08:00
Shiming Zhang
3e2a1a7b9c Regenerate 2023-07-14 09:43:16 +08:00
Shiming Zhang
14b09c414a Add DownwardAPI validation for status.hostIPs 2023-07-14 09:35:31 +08:00
Shiming Zhang
bf030fd68a Add validate HostIPs 2023-07-14 09:35:30 +08:00
Shiming Zhang
267e76a66e Add status.hostIPs in validEnvDownwardAPIFieldPathExpressions 2023-07-14 09:35:30 +08:00
Shiming Zhang
c287943bdd Add status.hostIPs in ConvertDownwardAPIFieldLabel 2023-07-14 09:35:30 +08:00
Shiming Zhang
7a81ef6406 Add fuzzer for PodStatus 2023-07-14 09:35:30 +08:00
Shiming Zhang
e061143de7 Add HostIPs field and update PodIPs field 2023-07-14 09:35:30 +08:00
Kubernetes Prow Robot
a9e40bd7c6
Merge pull request #114307 from rphillips/promote_probe_termination_grace_period
ProbeTerminationGracePeriod promote to GA
2023-07-13 13:41:38 -07:00
Kubernetes Prow Robot
3f1704dfbd
Merge pull request #119296 from pohly/dra-pod-resource-claim-status-validation
dra API: ensure that pod status contains no duplicate resource claims
2023-07-13 12:39:49 -07:00
Patrick Ohly
ddc0d94790 dra API: ensure that pod status contains no duplicate resource claims
This is a follow-up to https://github.com/kubernetes/kubernetes/pull/117351
which just got merged.
2023-07-13 18:41:40 +02:00
dprotaso
610509fedd Update standard app protocols
Add websocket support - see https://github.com/kubernetes/enhancements/pull/3996
2023-07-12 08:28:50 -04:00
Patrick Ohly
0fc62d5ded dra: generated files 2023-07-11 14:23:48 +02:00
Patrick Ohly
444d23bd2f dra: generated name for ResourceClaim from template
Generating the name avoids all potential name collisions. It's not clear how
much of a problem that was because users can avoid them and the deterministic
names for generic ephemeral volumes have not led to reports from users. But
using generated names is not too hard either.

What makes it relatively easy is that the new pod.status.resourceClaimStatus
map stores the generated name for kubelet and node authorizer, i.e. the
information in the pod is sufficient to determine the name of the
ResourceClaim.

The resource claim controller becomes a bit more complex and now needs
permission to modify the pod status. The new failure scenario of "ResourceClaim
created, updating pod status fails" is handled with the help of a new special
"resource.kubernetes.io/pod-claim-name" annotation that together with the owner
reference identifies exactly for what a ResourceClaim was generated, so
updating the pod status can be retried for existing ResourceClaims.

The transition from deterministic names is handled with a special case for that
recovery code path: a ResourceClaim with no annotation and a name that follows
the Kubernetes <= 1.27 naming pattern is assumed to be generated for that pod
claim and gets added to the pod status.

There's no immediate need for it, but just in case that it may become relevant,
the name of the generated ResourceClaim may also be left unset to record that
no claim was needed. Components processing such a pod can skip whatever they
normally would do for the claim. To ensure that they do and also cover other
cases properly ("no known field is set", "must check ownership"),
resourceclaim.Name gets extended.
2023-07-11 14:23:48 +02:00
twelcon
70f979c8da
Alert message improved according to standards
Signed-off-by: twelcon <mastermind12210@gmail.com>
2023-07-10 17:13:35 +05:30
Gunju Kim
c187b38117 Sidecar: Generated code 2023-07-07 21:39:35 +00:00
Gunju Kim
5d26bcd468 Sidecar: API changes
- Add SidecarContaienrs feature gate
- Add ContainerRestartPolicy type
- Add RestartPolicy field to the Container
- Drop RestartPolicy field if the feature is disabled
- Add validation for the SidecarContainers
- Allow restartable init containaers to have a startup probe
2023-07-07 21:39:34 +00:00
Kubernetes Prow Robot
c2b7d25ff8
Merge pull request #118691 from giuseppe/drop-check-for-volumes
apis: drop check for volumes with user namespaces
2023-06-29 16:23:56 -07:00
Giuseppe Scrivano
556d713a4a
apis: drop check for volumes with user namespaces
The second phase of user namespaces support was related to supporting
only stateless pods.  Since the changes were accepted for the KEP, now
the scope is extended to support stateful pods as well.  Remove the
check that blocks creating PODs with volumes when using user namespaces.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-06-22 15:15:42 +02:00
twelcon
9d4b489107
Renaming restartPolicy to containerRestartPolicy for better calrity
Signed-off-by: twelcon <mastermind12210@gmail.com>
2023-06-21 12:33:14 +05:30
twelcon
01c2c4f35f
Error test cases added
Signed-off-by: twelcon <mastermind12210@gmail.com>
2023-06-20 19:42:17 +05:30
twelcon
a609beb6b1
Decline on resizePolicy if the restartPolicy is Never
Signed-off-by: twelcon <mastermind12210@gmail.com>
2023-06-20 18:48:47 +05:30
Roman Bednar
ac15d69757 remove RetroactiveDefaultStorageClass feature gate checks 2023-06-07 14:31:16 +02:00