Skip to content

add local override {delete,list} - #209

Merged
davixcky merged 20 commits into
feature-mwfrom
add-override-skeleton
Oct 3, 2025
Merged

davixcky merged 20 commits into
feature-mwfrom
add-override-skeleton

Conversation

@davixcky

@davixcky davixcky commented Sep 24, 2025 •

Copy link
Copy Markdown
Contributor

Basic Override Creation

# Create a traffic override 
> signadot local override --sandbox my-test-sandbox --to localhost:3000 --port 80
Waiting (up to --wait-timeout=3m0s) for sandbox to be ready...
✓ Sandbox status: Ready: All desired workloads are available.
^C
Session terminated
→ Removing redirect in my-test-sandbox

# Create a detached override (preserves changes after session termination and needs manual clear)
> signadot local override --sandbox my-test-sandbox --to localhost:3000 --port 80 -d
Waiting (up to --wait-timeout=3m0s) for sandbox to be ready...
✓ Sandbox status: Ready: All desired workloads are available.
Overriding traffic from sandbox 'my-test-sandbox' workload 'frontend-fork' to localhost:3000
Traffic override will persist after this session ends
To remove override, run:
	./signadot local override delete override-1 --sandbox=my-test-sandbox

# Create override with specific w
> signadot local override --sandbox my-test-sandbox --to localhost:3000 --port 80 -d -w frontend-fork
Waiting (up to --wait-timeout=3m0s) for sandbox to be ready...
✓ Sandbox status: Ready: All desired workloads are available.
Overriding traffic from sandbox 'my-test-sandbox' workload 'frontend-fork' to localhost:3000
Traffic override will persist after this session ends
To remove override, run:
	./signadot local override delete override-2 --sandbox=my-test-sandbox

Override Management

# List all active overrides
> signadot local override list
NAME            TARGET                        TO               CREATED
override-0      sandbox=my-test-sandbox       localhost:3000   6 days ago
zealous_borg0   sandbox=my-location-sandbox   localhost:3000   5 days ago
override-190    sandbox=my-location-sandbox   localhost:3000   5 days ago
override-30     sandbox=my-location-sandbox   localhost:3000   5 days ago
override-191    sandbox=my-location-sandbox   localhost:3000   5 days ago
altflow         sandbox=sb2                   localhost:9999   7 days ago
altflow         sandbox=sbr                   localhost:9999   8 days ago

# List overrides in JSON format
> signadot local override list -o json

Override Deletion

# Delete a specific override
> signadot local override delete override-30 --sandbox=my-location-sandbox
→ Removing override override-30 from sandbox my-location-sandbox
✓ Override override-30 deleted successfully from sandbox my-location-sandbox

Expected Output Examples

Override Creation:

→ Redirecting traffic from my-sandbox to localhost:9999
* Redirect changes will be removed once session is terminated
Press Ctrl+C to terminate redirect

→ Waiting for sandbox ready
POST    /locations -> Ok (local)
POST    /locations -> Ok (local)
GET     /locations/test -> Skipped (sandbox)

@davixcky davixcky changed the title add skeleton for local override add local override {delete,list} Sep 30, 2025
Comment thread internal/command/local/override/list.go Resolved
Comment thread internal/command/local/override/list.go Resolved
Comment thread internal/command/command.go Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The sandbox package doesn't build:

$ go build ./internal/command/sandbox/
# github.com/signadot/cli/internal/command/sandbox
internal/command/sandbox/delete.go:98:21: cannot use func() bool {…} (value of type func() bool) as func() "github.com/signadot/cli/internal/poll".PollingState value in argument to retry.Until

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@davixcky

davixcky commented Oct 2, 2025

Copy link
Copy Markdown
Contributor Author

@scott-cotton @scott-cotton PTAL whenever you can, it addressed all the comments you made

Use: "override --sandbox=<sandbox> --to=<target> [--detach]",
Short: "Override traffic routing for sandboxes",
Long: `Override traffic routing allows you to route traffic from a sandbox to a local service.
This is useful for testing local changes against a sandbox environment.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should link to docs once available (in another PR)

Comment thread internal/poll/poll.go Outdated
"time"
)

type PollingState int

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not terribly important, but I find the addition of this type a bit more complicated than using bools as before because the reader of the code has to go and look it up, whereas a bool is just a bool indicating whether or the condition passed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agree, but also i think the reading of true is still polling or it will stop? Then you have to go and see the details makes little bit harder. But if you think that's not true, sure happy to change it back

@scott-cotton scott-cotton Oct 3, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's certainly not objective. When called in context, like retry.Until(func () bool {...}) I don't think it's ambiguous which way the bool means stop, as there is Until there. And, at any rate, one needs to go look at the details of what is PollingState when done this way.

As it's quite subjective, I don't think it's important but just wanted to share my thoughts here. Please feel free to do with it what you think best.

@scott-cotton

Copy link
Copy Markdown
Member

@davixcky great to see the progress here.

As it is basically workable, but also has some outstanding things to refine, I think it's ok to merge to feature-mw and refine on a stacked PR or to keep working in this one, as you prefer.

@davixcky
davixcky merged commit 12dd243 into feature-mw Oct 3, 2025
@davixcky
davixcky deleted the add-override-skeleton branch October 3, 2025 20:12
scott-cotton added a commit that referenced this pull request Oct 6, 2025
* first commits for feature-mw

- allow exp-middleware: in sandbox spec
- support free revtuns

* show-revtun-svc-name

* use latest go-sdk with valueFrom

* use go-sdk from main branch

* rename revtun to forward (#212)

depends on signadot/signadot#6231

* fix revtun to forward rename

* add local override {delete,list} (#209)

* add skeleton for local override

* add sandbox builder

* use sandbox builder to add middleware

* Fix merge

* apply go-mod-tidy

* feat: add refresh api config and missing flags

* refactor: move waitforsandbox readiness to separate function

* feat: make sandbox apply use new utility + sandbox builder

* feat: add helpers in sandbox builder that allows to set machine id and others fields

* feat: complete create, list and delete methods for override

* feat: move sbmg logic to sbmgr pacakge

* fix: build

* fix logic in sandbox builder for removing override

* fix pending PR comments

* fix logic for getting overrides

* add examples for other commands and clear the local logic for override

* redo poll enum

---------

Co-authored-by: David Orozco <[email protected]>
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.

3 participants