Skip to content

refactor: consolidate CEL filter into ShootSelector struct#34

Merged
mikolajkucinski merged 3 commits intomainfrom
refactor/consolidate-shoot-selector
Feb 18, 2026
Merged

refactor: consolidate CEL filter into ShootSelector struct#34
mikolajkucinski merged 3 commits intomainfrom
refactor/consolidate-shoot-selector

Conversation

@mikolajkucinski
Copy link
Copy Markdown
Contributor

@mikolajkucinski mikolajkucinski commented Feb 5, 2026

Summary

  • Consolidated shootSelector and shootFilter into a single shootSelector struct with labelSelector and expression fields
  • CEL filtering now happens at the watch level via predicates instead of in the reconcile loop
  • CEL-excluded shoots are tracked in status.shoots with Excluded status alongside onboarded/failed shoots
  • Label selector now uses LabelSelectorAsSelector to support both matchLabels and matchExpressions
  • Renamed ClusterStatus to ShootStatus with Enum=Onboarded;Failed;Excluded
  • Renamed status.clusters to status.shoots and status.totalShootCount to status.totalTargetShootCount
  • CEL filter errors emit warning events on the CareInstruction

Breaking change: shootSelector field structure changed

Migrate existing CareInstructions with

kubectl get careinstructions -A -o json | \
  jq -c '.items[] |
    .spec.shootSelector = ({
      labelSelector: .spec.shootSelector,
      expression: .spec.shootFilter
    } | del(.[] | nulls)) |
    del(.spec.shootFilter)' | \
  while read -r ci; do
    echo "$ci" | kubectl apply -f -
  done

@mikolajkucinski mikolajkucinski requested a review from a team as a code owner February 5, 2026 12:49
@mikolajkucinski mikolajkucinski marked this pull request as draft February 5, 2026 12:49
@mikolajkucinski mikolajkucinski force-pushed the refactor/consolidate-shoot-selector branch 11 times, most recently from 64696ea to ef8f1b2 Compare February 10, 2026 14:31
- Restructure ShootSelector with nested LabelSelector and Expression fields
- Move CEL filtering to watch-level predicates in shoot controller
- Add ExcludedShoots/EffectiveShootCount status for observability
- Fix ListShoots to support MatchExpressions via LabelSelectorAsSelector

On-behalf-of: @SAP mikolaj.kucinski@sap.com
@mikolajkucinski mikolajkucinski force-pushed the refactor/consolidate-shoot-selector branch from ef8f1b2 to c500fb0 Compare February 10, 2026 14:36
@mikolajkucinski mikolajkucinski marked this pull request as ready for review February 10, 2026 14:36
Copy link
Copy Markdown
Contributor

@uwe-mayer uwe-mayer left a comment

Choose a reason for hiding this comment

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

Some suggestions on status collection, nice work!

Comment thread api/v1alpha1/careinstruction_types.go Outdated
Comment thread controller/careinstruction/careinstruction_controller.go Outdated
Comment thread api/v1alpha1/careinstruction_types.go Outdated
Comment thread api/v1alpha1/careinstruction_types.go Outdated
Comment thread api/v1alpha1/careinstruction_types.go Outdated
Comment thread api/v1alpha1/careinstruction_types.go Outdated
Comment thread controller/careinstruction/careinstruction_controller.go
Comment thread controller/shoot/shoot_controller.go
- Rename ClusterStatus to ShootStatus with Enum=Onboarded;Failed;Excluded
- Remove ExcludedShootStatus, merge into ShootStatus with Excluded status
- Rename Clusters to Shoots, TotalShoots to TotalTargetShoots
- Remove secret cleanup for CEL-excluded shoots
- Simplify CEL predicate using predicate.NewPredicateFuncs pattern

On-behalf-of: @SAP mikolaj.kucinski@sap.com
@mikolajkucinski mikolajkucinski force-pushed the refactor/consolidate-shoot-selector branch from 5d9ca25 to 7e69945 Compare February 13, 2026 17:19
Comment thread api/v1alpha1/careinstruction_types.go Outdated
Copy link
Copy Markdown
Contributor

@uwe-mayer uwe-mayer left a comment

Choose a reason for hiding this comment

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

One comment on the code I initialy wrote. I think I returned too early on error. Can you take a 2nd look?

Comment thread controller/careinstruction/careinstruction_controller.go
On-behalf-of: @SAP mikolaj.kucinski@sap.com
@github-actions
Copy link
Copy Markdown

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/cloudoperators/shoot-grafter/api/v1alpha1 0.00% (ø)
github.com/cloudoperators/shoot-grafter/controller/careinstruction 0.00% (ø)
github.com/cloudoperators/shoot-grafter/controller/shoot 0.00% (ø)
github.com/cloudoperators/shoot-grafter/webhook/v1alpha1 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/cloudoperators/shoot-grafter/api/v1alpha1/careinstruction_types.go 0.00% (ø) 0 0 0
github.com/cloudoperators/shoot-grafter/api/v1alpha1/zz_generated.deepcopy.go 0.00% (ø) 0 0 0
github.com/cloudoperators/shoot-grafter/controller/careinstruction/careinstruction_controller.go 0.00% (ø) 0 0 0
github.com/cloudoperators/shoot-grafter/controller/shoot/shoot_controller.go 0.00% (ø) 0 0 0
github.com/cloudoperators/shoot-grafter/webhook/v1alpha1/careinstruction_webhook.go 0.00% (ø) 0 0 0

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/cloudoperators/shoot-grafter/controller/careinstruction/careinstruction_controller_test.go
  • github.com/cloudoperators/shoot-grafter/controller/shoot/shoot_controller_test.go

@mikolajkucinski mikolajkucinski merged commit b5eca43 into main Feb 18, 2026
6 checks passed
@uwe-mayer uwe-mayer linked an issue Mar 3, 2026 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT shoot-grafter] - Introduce CEL to target shoots

2 participants