4385 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
9acdca64e0 Merge pull request #130724 from jpbetz/replication-controller-to-declarative
Enable Declarative Validation for ReplicationController
2025-03-12 22:41:53 -07:00
Kubernetes Prow Robot
7b6c56e5fb Merge pull request #130135 from saschagrunert/image-volume-beta
[KEP-4639] Graduate image volume sources to beta
2025-03-12 18:03:58 -07:00
Kubernetes Prow Robot
2261137135 Merge pull request #122550 from danwinship/tighten-ip-validation
Tighten IP/CIDR validation
2025-03-12 15:57:46 -07:00
Tim Hockin
e856356225 Enable validation-gen on core/v1
This enables generation but does not activate the strategy calling of
declarative.
2025-03-12 18:05:20 -04:00
Kubernetes Prow Robot
21f7eaa8e2 Merge pull request #130705 from aaron-prindle/validation-gen-add-metric-and-runtime-verification-upstream
[Declarative Validation] feat: add declarative validation metrics and associated runtime verification tests
2025-03-12 11:29:54 -07:00
Dan Winship
ad22c0d495 Fix IP/CIDR validation to allow updates to existing invalid objects
Ignore pre-existing bad IP/CIDR values in:
  - pod.spec.podIP(s)
  - pod.spec.hostIP(s)
  - service.spec.externalIPs
  - service.spec.clusterIP(s)
  - service.spec.loadBalancerSourceRanges (and corresponding annotation)
  - service.status.loadBalancer.ingress[].ip
  - endpoints.subsets
  - endpointslice.endpoints
  - networkpolicy.spec.{ingress[].from[],egress[].to[]}.ipBlock
  - ingress.status.loadBalancer.ingress[].ip

In the Endpoints and EndpointSlice case, if *any* endpoint IP is
changed, then the entire object must be valid; invalid IPs are only
allowed to remain in place for updates that don't change any IPs.
(e.g., changing the labels or annotations).

In most of the other cases, when the invalid IP is part of an array,
it can be moved around within the array without triggering
revalidation.
2025-03-12 12:41:32 -04:00
Kubernetes Prow Robot
caf541857f Merge pull request #130673 from gauravkghildiyal/kep-4444-ga
Promote ServiceTrafficDistribution feature-gate to GA and update docs with latest descriptions
2025-03-12 08:23:47 -07:00
Dan Winship
692785d25b Add legacy versions of IsValidIP/IsValidCIDR
Add validation.IsValidIPForLegacyField and
validation.IsValidCIDRForLegacyField, which validate "legacy" IP/CIDR
fields correctly. Use them for all such fields (indirectly, via a
wrapper in pkg/apis/core/validation that handles the
StrictIPCIDRValidation feature gate correctly).

Change IsValidIP and IsValidCIDR to require strict parsing and
canonical form, and update the IPAddr, ServiceCIDR, and
NetworkDeviceData validation to make use of them.
2025-03-12 09:58:04 -04:00
Dan Winship
ba189de78f Slightly improve EndpointSlice address validation
Because it used both IsValidIPv4Address and ValidateEndpointIP,
EndpointSlice validation produced duplicate error messages when given
an invalid IP. Fix this by calling IsValidIP first, and only doing the
other checks if that one fails.

Also, since no one else was using the IsValidIPv4Address and
IsValidIPv6Address methods anyway, just inline them into the
EndpointSlice validation, so we don't have to worry about "should they
do legacy or strict validation" later.
2025-03-12 09:37:39 -04:00
Dan Winship
fc4bb4fdb9 Add validation.IsValidInterfaceAddress
Split "ifaddr"-style ("192.168.1.5/24") validation out of IsValidCIDR.
Since there is currently only one field that uses this format, and it
already requires canonical form, IsValidInterfaceAddress requires
canonical form unconditionally.
2025-03-12 09:37:39 -04:00
Dan Winship
f79bccf4d9 validation unit test cleanups
Fix some incorrect test case names.

Use t.Run() in a few more places (to facilitate using
SetFeatureGateDuringTest later).

Clarify TestPodIPsValidation/TestHostIPsValidation (and fix
weird indentation).
2025-03-12 09:37:39 -04:00
Dan Winship
76f1684117 Rename ValidateNonSpecialIP to ValidateEndpointIP
There is not a single definition of "non-special IP" that makes sense
in all contexts. Rename ValidateNonSpecialIP to ValidateEndpointIP and
clarify that it shouldn't be used for other validations.

Also add a few more unit tests.
2025-03-12 09:37:39 -04:00
Joe Betz
9fe18bf486 Update core v1 fuzzer and validation tests to use util/ptr instead of util/pointer 2025-03-11 17:02:55 -04:00
Kubernetes Prow Robot
309c4c17fb Merge pull request #128499 from stlaz/ctb_betav1
ClusterTrustBundles - move to beta
2025-03-11 12:47:45 -07:00
Aaron Prindle
cd9df2f115 chore: change error_matcher.go to use test interface instead of importing testing pkg 2025-03-11 18:15:50 +00:00
Stanislav Láznička
ccd2d4d62a generate code 2025-03-11 18:07:26 +01:00
Kubernetes Prow Robot
07d66d9c26 Merge pull request #130574 from natasha41575/drop_proposed_resize_status
[FG:InPlacePodVerticalScaling] Drop `Proposed` resize status
2025-03-11 09:49:46 -07:00
Stanislav Láznička
f598b4860c copy ClusterTrustBundle API to v1beta1 2025-03-11 17:39:07 +01:00
Sascha Grunert
f9e5dd84ad Graduate image volume sources to beta
Graduate the feature to beta, by:

- Allowing `subPath`/`subPathExpr` for image volumes
- Modifying the CRI to pass down the (resolved) sub path
- Adding metrics which are outlined in the KEP

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2025-03-11 13:41:45 +01:00
Kubernetes Prow Robot
3782b558a2 Merge pull request #128786 from danwinship/bad-ip-warnings
warn on bad IPs in objects
2025-03-11 00:11:47 -07:00
Kubernetes Prow Robot
a38d4e53e1 Merge pull request #130697 from thockin/fix_replication_controller_validation_tests
Fix validation test for ReplicationController
2025-03-10 14:41:54 -07:00
Natasha Sarkar
8a20e90839 [FG:InPlacePodVerticalScaling] Drop 'Proposed' resize status 2025-03-10 20:46:02 +00:00
Tim Hockin
46ac2af06a Fix validation test for ReplicationController
I discovered this by changing the validation in a way that SHOULD fail
(by allowing something it should not).  But it didn't.  A different
error happens which totally masks the non-failure I expected.  New test
is much more explicit about what failures are expected.

This does not focus on adding test coverage, just making sure the test
is not terrible.
2025-03-10 11:51:53 -07:00
Paco Xu
ce163947aa fix a flake of TestRoundTripTypes: for FirstAvailable[].AllocationMode 2025-03-10 14:03:55 +08:00
Gaurav Ghildiyal
0d0b81b937 Update trafficDistribution API spec docs for GA graduation 2025-03-09 14:35:03 -07:00
Tim Hockin
e54719bb66 Use randfill, do API renames 2025-03-08 15:18:00 -08:00
Kubernetes Prow Robot
2effa5e3cf Merge pull request #130352 from natasha41575/kubelet-pod-observedgen
[FG:PodObservedGenerationTracking] Kubelet sets pod `status.observedGeneration` when updating the pod status
2025-03-07 13:33:45 -08:00
Dan Winship
5e067b6781 Minor IP/CIDR validation cleanups/fixups
Remove unnecessary duplicate checks for pod.spec.podIPs /
pod.spec.hostIPs / node.spec.podCIDRs. (A list that is known to
contain exactly 2 values, where one is IPv4 and the other is IPv6,
cannot possibly contain duplicates.)

Fix a bad CIDR in the NetworkPolicy validation tests.

Fix some comment typos.
2025-03-07 10:44:19 -05:00
Kubernetes Prow Robot
9d45ea8b9d Merge pull request #128586 from mortent/DRAPrioritizedList
Prioritized Alternatives in Device Requests
2025-03-06 21:01:44 -08:00
Natasha Sarkar
6edd921746 run 'make update' 2025-03-06 20:08:06 +00:00
Natasha Sarkar
eab9197d1a Add observedGeneration and validation to pod status and conditions 2025-03-06 20:08:06 +00:00
Kubernetes Prow Robot
4696667025 Merge pull request #130543 from thockin/error_matcher_and_origin
Fix up ErrorMatcher from feedback
2025-03-06 00:57:52 -08:00
Kubernetes Prow Robot
cd451c6a36 Merge pull request #130282 from natasha41575/podresizevalidation
Clean up preparation for pod subresource updates
2025-03-05 14:41:45 -08:00
Tim Hockin
0a9f492eed Fix up ErrorMatcher from feedback
a) Rename the type and drop the constructor
b) Make MatchErrors() into a Test() method

For followup:

c) Consider making ByType() assumed
d) Consider making ByField() assumed and handle nil as "don't care"
e) Consider making ByValue() assumed and handle nil as "don't care"
2025-03-05 09:52:44 -08:00
Jefftree
05a90bf642 Revert "Add LeaseCandidate v1beta1"
This reverts commit fad4594fd9.
2025-03-01 14:14:25 +00:00
Jefftree
71622aee49 Revert "generated"
This reverts commit 2d10dec3a2.
2025-03-01 14:10:35 +00:00
Kubernetes Prow Robot
0556b20d3d Merge pull request #129435 from googs1025/dra/validation
chore: add more error info for validateResourceSliceSpec
2025-03-01 02:16:55 -08:00
Kubernetes Prow Robot
aad87f2ee9 Merge pull request #130388 from thockin/error_matcher_and_origin
Add an error matcher, convert 2 tests
2025-02-28 17:14:55 -08:00
Kubernetes Prow Robot
d04883c90c Merge pull request #130061 from mimowo/make-backoffperindex-stable
Graduate Backoff Limit Per Index as stable
2025-02-28 13:37:02 -08:00
Morten Torkildsen
e2d1fcc162 Addressed comments 2025-02-28 20:47:35 +00:00
Morten Torkildsen
a716095a8a DRA: Update validation for Prioritized Alternatives in Device Requests 2025-02-28 19:28:50 +00:00
Morten Torkildsen
68040a3173 Run make update 2025-02-28 19:28:26 +00:00
Morten Torkildsen
8f7b43b6fd DRA: Update types and defaults for Prioritized Alternatives in Device Requests 2025-02-28 19:13:48 +00:00
Natasha Sarkar
f91105a77e fix prep and validation for pod subresource updates 2025-02-28 16:51:10 +00: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
Kubernetes Prow Robot
ef1c659569 Merge pull request #130291 from Jefftree/cle-beta
LeaseCandidate v1beta1 API
2025-02-28 08:26:56 -08:00
Tim Hockin
6b7e38f018 Fix nits from PR 130355 2025-02-28 00:06:11 -08:00
Kubernetes Prow Robot
803e9d6495 Merge pull request #130355 from yongruilin/validation_origin
validation: Add Origin field to field.Error for more precise error tracking
2025-02-28 00:04:23 -08:00
yongruilin
c7cf852086 test: Add Origin field support to ReplicationController spec.Replicas validation test 2025-02-28 06:56:02 +00:00
yongruilin
07477c656e test: convert ValidateEndpointsCreate to use error Origin field in test
Update ValidateEndpointsCreate validation tests to use the new Origin field for more precise error comparisons. It leverage the Origin field instead of detailed error messages, improving test robustness and readability.

Co-authored-by: Tim Hockin <thockin@google.com>
2025-02-28 06:55:58 +00:00