Skip to content

Conversation

Danil-Grigorev
Copy link
Member

@Danil-Grigorev Danil-Grigorev commented Apr 24, 2025

Motivation

Extend the set of supported property modifications with x-kubernetes rules related to SSA merge strategy:

  • x-kubernetes-list-type
  • x-kubernetes-list-map-keys
  • x-kubernetes-map-type

Solution

The current implementation replaces CELSchema with KubeSchema, renames cel_validate to x_kube, and adds a new x_kube(merge_strategy = …) attribute to specify the merge strategy for the annotated field.

Changes:

  • CELSchema is replaced with KubeSchema.
  • cel_validate(rule = …) attribute is renamed to x_kube(validation = …).
  • x_kube(merge_strategy = …) attribute is added to specify merge strategy.

This change should cover #1744

Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
Copy link

codecov bot commented Apr 24, 2025

Codecov Report

Attention: Patch coverage is 87.80488% with 5 lines in your changes missing coverage. Please review.

Project coverage is 76.2%. Comparing base (6480ccd) to head (c3e26fe).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
kube-core/src/cel.rs 76.2% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1750     +/-   ##
=======================================
+ Coverage   76.2%   76.2%   +0.1%     
=======================================
  Files         84      84             
  Lines       7855    7883     +28     
=======================================
+ Hits        5980    6003     +23     
- Misses      1875    1880      +5     
Files with missing lines Coverage Δ
kube-derive/src/cel_schema.rs 93.7% <100.0%> (+0.7%) ⬆️
kube-derive/src/custom_resource.rs 84.1% <100.0%> (ø)
kube-derive/src/lib.rs 0.0% <ø> (ø)
kube-derive/tests/crd_schema_test.rs 97.1% <100.0%> (+0.1%) ⬆️
kube/src/lib.rs 88.5% <ø> (ø)
kube-core/src/cel.rs 63.8% <76.2%> (+7.1%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Clippy fixes

Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
@Danil-Grigorev Danil-Grigorev changed the title Implement rest of x-kuberentes rules Support additional x-kubernetes-* schema extensions Apr 25, 2025
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fantastic! thank you so much for doing this.

the rename makes sense to me, and i have a couple of follow-up suggestions on naming, but overall i don't have any problems with how this is done.

@clux clux added the changelog-change changelog change category for prs label Apr 28, 2025
@clux clux added this to the 0.100.0 milestone Apr 28, 2025
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
@clux clux merged commit 0d79006 into kube-rs:main Apr 30, 2025
17 checks passed
@aharbis
Copy link

aharbis commented Apr 30, 2025

@Danil-Grigorev thank you for this change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-change changelog change category for prs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support additional x-kubernetes-* schema extensions
3 participants