Skip to content

feat(): route entire slice subnet via hub for spoke gateways - #496

Draft
Shreesha001 wants to merge 4 commits into
kubeslice:masterfrom
Shreesha001:feature/spoke-to-spoke-routing
Draft

feat(): route entire slice subnet via hub for spoke gateways#496
Shreesha001 wants to merge 4 commits into
kubeslice:masterfrom
Shreesha001:feature/spoke-to-spoke-routing

Conversation

@Shreesha001

Copy link
Copy Markdown

Description

Worker side of spoke-to-spoke communication for Hub-and-Spoke slices.

Two spokes have no direct tunnel, so their traffic has to go through the hub.

When a spoke's gateway to the hub has routeEntireSliceSubnet set (the controller sets this), the worker programs the entire slice subnet—not just the hub's subnet—into both the slice router and the gateway pod.

That makes the spoke send all slice traffic (including traffic for other spokes) to the hub, which relays it to the destination spoke.

A shared helper (remoteNsmSubnetForRoute) keeps the slice-router and gateway-pod paths in sync, and requeues if the slice subnet isn't known yet.

Depends on kubeslice/apis#44 for the routeEntireSliceSubnet field. Until it merges, go.mod points at the apis fork via a replace directive.

How Has This Been Tested?

On a 4-cluster kind setup (1 hub + 3 workers), Hub-and-Spoke slice:

  • Spoke-to-spoke traffic (spoke1 → spoke2) reaches the destination via the hub — verified with ping and iperf.
  • The whole slice subnet is programmed on the spoke gateway pod and slice router when the flag is set.
  • Normal (peer-subnet) routing is unchanged when the flag is not set.
  • Unit test for the route-decision helper (slicegateway_route_test.go).

Checklist

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I've updated documentation as required by this PR.
  • I have ran go fmt.
  • I have updated the helm chart as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit test cases.
  • I have verified the E2E test cases with new code changes.
  • I have added all the required E2E test cases.

Does this PR introduce a breaking change?

NONE

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

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

Signed-off-by: Shreesha001 <shettyshreesha552@gmail.com>
@Shreesha001
Shreesha001 marked this pull request as draft August 3, 2026 13:30
@pnavali
pnavali requested review from rajendra-avesha and a lite review from Copilot and removed request for richiesebastian August 19, 2026 12:31

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 “route entire slice subnet via hub” behavior for spoke gateways by propagating a new routeEntireSliceSubnet flag and using it to choose the remote NSM subnet programmed into both the gateway pod and the slice router.

Changes:

  • Propagates RouteEntireSliceSubnet from hub WorkerSliceGateway into worker-cluster SliceGateway status config.
  • Introduces a shared route-decision helper (remoteNsmSubnetForRoute) plus unit tests, and updates gateway-pod + slice-router connection-context programming to use it (with requeue when slice subnet isn’t available yet).
  • Vendors an apis fork (via go.mod replace) to pick up the new API field and accompanying generated code updates.

Reviewed changes

Copilot reviewed 7 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vendor/modules.txt Updates vendored module metadata to reflect the apis fork replacement.
vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/zz_generated.deepcopy.go Updates autogenerated deepcopy logic for WorkerSliceGateway status.
vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/workerslicegateway_types.go Adds RouteEntireSliceSubnet to WorkerSliceGatewaySpec and expands gateway status fields/constants.
vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/zz_generated.deepcopy.go Updates autogenerated deepcopy logic for new controller-side types.
vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/cluster_types.go Adds StorageCapabilities types/fields to ClusterStatus (vendored).
pkg/hub/controllers/slicegateway_controller.go Propagates RouteEntireSliceSubnet into worker-cluster SliceGateway status config updates.
go.sum Adds checksums for the apis fork and removes the original module checksums.
go.mod Adds a replace to an apis fork to access the new field pre-merge.
controllers/slicegateway/slicegateway.go Adds remoteSubnetForGateway and uses it when sending connection context to gateway pods and slice router (with requeue).
controllers/slicegateway/slicegateway_route.go Adds the shared helper to decide remote subnet for routing.
controllers/slicegateway/slicegateway_route_test.go Adds unit tests for the route-decision helper.
config/crd/bases/networking.kubeslice.io_slicegateways.yaml Extends the CRD schema to include routeEntireSliceSubnet under status.config.
api/v1beta1/slicegateway_types.go Adds RouteEntireSliceSubnet to the SliceGatewayConfig model.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +951 to +954
// The returned subnet is programmed both into the local slice router (so pods
// reach the gateway) and into the gateway pod itself (so it forwards the traffic
// over the tunnel); both must agree, otherwise packets loop at the gateway.
//
Comment thread go.mod
Comment on lines +105 to +106

replace github.com/kubeslice/apis => github.com/Shreesha001/apis v0.0.0-20260716162233-4dfda414c6d2
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.

2 participants