Commit Graph

349 Commits

Author SHA1 Message Date
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
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
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
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
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
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
e011187114 Update code to use new generic allocatedResourceStatus field 2023-07-17 15:30:35 -04:00
Aohan Yang
e6863757f4 Add IP mode field 2023-07-17 15:51:40 +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
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
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
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
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
Roman Bednar
6afb363ca1 test: remove RetroactiveDefaultStorageClass feature gate
Since the feature is GA and locked to true, tests can no longer set it
to false. Cleaning up by removing all references to this feature gate
from tests.

Feature gate will be removed in v1.29.
2023-06-07 14:31:16 +02:00
Roman Bednar
97a81a59f6 test: correct validation test error message 2023-06-07 14:31:16 +02:00
Kubernetes Prow Robot
0bb17a88fa
Merge pull request #116741 from gjkim42/promote-expanded-dns-config-to-ga
Promote ExpandedDNSConfig feature to the GA stage
2023-05-30 18:19:56 -07:00
aleskandro
4c9887e3eb Updating the nodeAffinity of gated pods having nil affinity should be allowed 2023-05-18 07:44:34 +02:00
Tim Hockin
4bbf611773
Retool validation for pod HostNetwork ports
This will ensure that HostPort == ContainerPort for pods and that
HostPort == 0 || HostPort == ContainerPort for embedded PodSpecs.
2023-05-09 18:10:44 -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
Ryan Phillips
ae08fe1e19 ProbeTerminationGracePeriod promote to GA 2023-05-05 14:27:54 -05:00
Gunju Kim
b249b4ca9b
Promote ExpandedDNSConfig feature to the GA stage 2023-05-04 20:37:10 +09: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
vinay kulkarni
0e9dd5c51d Call function that validates in-place vpa resize policy 2023-03-22 16:19:19 +00:00
Rob Scott
9e571c0424
Adding validation for topology annotations
Change-Id: I50b3b05b859c69e98daca7c8fca0d3a76024eb80
2023-03-15 18:37:02 +00:00
Kubernetes Prow Robot
9053b5dc2c
Merge pull request #116119 from vinaykul/restart-free-pod-vertical-scaling-fixes
Restructure resize policy naming and set default resize policy values
2023-03-14 19:26:42 -07:00
Kubernetes Prow Robot
f315a4669a
Merge pull request #116576 from pohly/dra-core-validation
api: extend validation of dynamic resource allocation fields in PodSpec
2023-03-14 16:34:48 -07:00
Alex Wang
8a1f9f43e6 feat: validate matchLabelKeys when labelSelector isn't set
Signed-off-by: Alex Wang <wangqingcan1990@gmail.com>
2023-03-14 22:36:41 +08:00
Patrick Ohly
e97531b349 api: extend validation of dynamic resource allocation fields in PodSpec
The generated ResourceClaim name and the names of the ResourceClaimTemplate and
ResourceClaim referenced by a pod must be valid according to the resource API,
otherwise the pod cannot start.

Checking this was removed from the original implementation out of concerns
about validating fields in core against limitations imposed by a separate,
alpha API.  But as this was pointed out again in
https://github.com/kubernetes/kubernetes/pull/116254#discussion_r1134010324
it gets added back.

The same strings that worked before still work now. In particular, the
constraints for a spec.resourceClaim.name are still the same (DNS label).
2023-03-14 11:58:41 +01:00
vinay kulkarni
9a805db010 Set default resize policy only for specified resource types, rename RestartNotRequired -> NotRequired 2023-03-12 23:46:40 +00:00
vinay kulkarni
8b23497ae7 Restructure naming of resource resize restart policy 2023-03-12 23:11:32 +00:00
Daniel Vega-Myhre
86f41dc012 mutable pod scheduling directives 2023-03-10 18:30:09 +00:00
Kubernetes Prow Robot
b4305fcf63
Merge pull request #115391 from haoruan/bugfix/allow-pv-nodeaffinity-to-be-mutable
allow to mutate pv nodeaffinity label key
2023-03-06 21:56:17 -08:00
Hao Ruan
c8d10dcaeb allow to mutate pv nodeaffinity label key 2023-03-07 11:16:10 +08:00
Vinay Kulkarni
76962b0fa7 In-place Pod Vertical Scaling - API changes
1. Define ContainerResizePolicy and add it to Container struct.
 2. Add ResourcesAllocated and Resources fields to ContainerStatus struct.
 3. Define ResourcesResizeStatus and add it to PodStatus struct.
 4. Add InPlacePodVerticalScaling feature gate and drop disabled fields.
 5. ResizePolicy validation & defaulting and Resources mutability for CPU/Memory.
 6. Various fixes from code review feedback (originally committed on Apr 12, 2022)
KEP: /enhancements/keps/sig-node/1287-in-place-update-pod-resources
2023-02-24 17:18:04 +00:00
Sascha Grunert
0c2136ab54
Graduate DownwardAPIHugePages feature to stable / GA
This update updates the feature documentation for its GA graduation.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2023-02-20 09:52:39 +01:00
lianghao208
f09eeaf104 Validating the scheduling gate naming format 2023-02-16 14:56:41 +08:00