Skip to content

feat(): add hub-and-spoke topology fields to SliceConfig CRD#408

Open
Shreesha001 wants to merge 1 commit into
kubeslice:masterfrom
Shreesha001:feature/301-topology-crd
Open

feat(): add hub-and-spoke topology fields to SliceConfig CRD#408
Shreesha001 wants to merge 1 commit into
kubeslice:masterfrom
Shreesha001:feature/301-topology-crd

Conversation

@Shreesha001

Copy link
Copy Markdown

Adds the API for Hub-and-Spoke topology (Partial Mesh MVP), per the ADR (#300).

  • New optional spec.topology field on SliceConfig: mode (FullMesh | HubAndSpoke) and hubs. All non-hub clusters are spokes automatically.
  • Validation: mode enum and max 2 hubs in the CRD schema; cross-field rules in the webhook (hub must be a slice member, no duplicates, at least one spoke, single hub for this release).
  • Backward compatible: no topology field → existing full-mesh behavior, unchanged.
  • API only — gateway creation does not consume the field yet (that is Controller: Compute hub-and-spoke edges and publish worker intents (Partial Mesh MVP) #302).

Fixes #301

How Has This Been Tested?

  • 12 table-driven unit tests covering every validation rule and the valid paths.
  • Local Kind cluster: valid HubAndSpoke config accepted; each invalid config rejected with a clear error; slices without topology unaffected.

Checklist:

  • The title of the PR states what changed and the related issues number.
  • I have performed a self-review of my own code.
  • I have added all the required unit test cases.

Does this PR introduce a breaking change for other components like worker-operator?

No

Signed-off-by: Shreesha001 <shettyshreesha552@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds Hub-and-Spoke (partial mesh MVP) API surface to the SliceConfig CRD and enforces the initial validation rules via the admission webhook, while keeping default behavior backward compatible (no spec.topology → full mesh).

Changes:

  • Introduces spec.topology (mode, hubs) in the SliceConfig Go types and CRD OpenAPI schema.
  • Adds create/update webhook validation for topology cross-field rules (single hub for this release, hub must be a member, etc.) with unit tests.
  • Adds a Hub-and-Spoke sample SliceConfig manifest.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
service/slice_config_webhook_validation.go Adds validateTopology + Hub-and-Spoke rules and wires validation into create/update paths.
service/slice_config_webhook_validation_test.go Adds table-driven unit tests covering valid/invalid topology configurations.
config/samples/controller_v1alpha1_sliceconfig_hub_and_spoke.yaml Adds a sample SliceConfig manifest demonstrating the new spec.topology fields.
config/crd/bases/controller.kubeslice.io_sliceconfigs.yaml Extends the CRD schema with spec.topology (mode enum, hubs maxItems).
apis/controller/v1alpha1/zz_generated.deepcopy.go Updates generated deepcopy functions for the new TopologySpec.
apis/controller/v1alpha1/sliceconfig_types.go Adds TopologySpec / TopologyMode types and integrates them into SliceConfigSpec.
Files not reviewed (1)
  • apis/controller/v1alpha1/zz_generated.deepcopy.go: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 4 to 7
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.19.0
controller-gen.kubebuilder.io/version: v0.17.3
name: sliceconfigs.controller.kubeslice.io
Comment on lines +3 to +9
# worker-1 acts as the hub; worker-2 and worker-3 become spokes (all
# non-hub members are spokes). Tunnel links are created only between
# hub and spokes: worker-1<->worker-2 and worker-1<->worker-3.
# No spoke<->spoke (worker-2<->worker-3) link is created.
#
# Omitting spec.topology entirely (or setting mode: FullMesh with no
# hubs) keeps the existing full-mesh behavior.
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.

API: Add Hub-and-Spoke topology fields to Slice CRD (Partial Mesh MVP)

2 participants