Skip to content

Conversation

@Transcendental-Programmer

At the moment, there's no validation in place for ServiceExport resources thereby meaning users can reference slices or namespaces that don't actually exist or aren't onboarded. This PR starts to address that by adding a validation webhook that runs on create/update and performs a couple of basic checks:

  • Confirms the referenced slice exists on the cluster
  • Verifies the namespace is part of the slice’s onboarded application namespaces

This should prevent some common misconfigurations early on.

To support this, I added a unified webhook handler so we can route validation requests in one place (might help later if we add more webhooks). I also updated the ServiceExport types with the necessary annotations.

There’s a bit of test coverage now for the main paths valid/invalid slices, and valid/invalid namespaces. But might still need to flesh that out further depending on edge cases we hit.

No changes to existing behavior just validation layered on top. That said, this does introduce some tight coupling between the ServiceExport logic and slice state, so we may need to revisit that if we plan to cache slice data, or support partial validation in disconnected scenarios.

Leaving this open for discussion especially interested in feedback around the validation strategy and whether this should eventually move server-side.

Fixes #358.

- Add validation webhook to check slice existence on cluster
- Validate namespace is in onboarded application namespaces
- Implement unified webhook handler for routing requests
- Add comprehensive test coverage for all validation scenarios
- Update serviceexport types with proper webhook annotations

Fixes kubeslice#358

Signed-off-by: GitHub Copilot <noreply@github.com>
Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
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.

Feature: Validation webhook for serviceexport

1 participant