Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4a6c657
Spike: refactoring ProxyMachinesContext and usage into a MultiMachine…
jabr Jan 26, 2026
19f47e5
Move proxy machines name/id lookup logic to server side
jabr Jan 27, 2026
b2a286b
Add machine/machines option distinction for handling single machine, …
jabr Jan 28, 2026
8b96d0c
Refactor the director-mapper-backend interactions and also address ch…
jabr Jan 28, 2026
1940cf2
Clean up some of the items noted on review
jabr Feb 9, 2026
c542468
Remove unnecessary error param from ProxyMachine(s)Context usage
jabr Feb 9, 2026
f4ee1ef
Remove newly added print warnings from ListImages for now
jabr Feb 9, 2026
b1ad042
Clean up proxy code and comments in machine rm
jabr Feb 9, 2026
887f95d
Return error if multi-machine proxy doesn't match all names/ids. Also…
jabr Feb 9, 2026
9a8fe9c
Rename metadata machine to machine_addr
jabr Feb 9, 2026
05867d8
Fix custom proxy call setup code in service.go but not entirely refac…
jabr Feb 9, 2026
57a0914
Fix some tests
jabr Feb 9, 2026
e02f92d
Remove ps collect container tests that are no longer relevant
jabr Feb 9, 2026
fcab71c
Fix tests and two bugs they caught
jabr Feb 9, 2026
4f72b05
Return more informative error from director/mapper with the specis ma…
jabr Feb 9, 2026
1206f87
Small refactoring of start/stop/remove container to remove linter dup…
jabr Feb 9, 2026
4940525
Clean up merge conflicts
jabr Apr 16, 2026
6faf9cd
Merge branch 'main' into improved-proxy-machines-context
jabr Apr 21, 2026
128b5fd
Fix some issues after merge
jabr Apr 21, 2026
28cacfa
Set min client/server version to 0.20.0 (guess for actual release thi…
jabr Apr 21, 2026
fde7c79
Pass machine name through in MachineServiceContainer
jabr Apr 22, 2026
f8cf71d
Unit tests on proxy director and mapper
jabr Apr 23, 2026
ac8c307
Dedup proxy machines on id (catches same machine specified by name an…
jabr Apr 23, 2026
b37dd06
Use machine name from metadata in client/volume
jabr Apr 23, 2026
05a016d
Handle edge cases with machine mapper: called with no names/ids shoul…
jabr Apr 23, 2026
0a21eb7
Return error from proxy director is both "machine" and "machines" are…
jabr Apr 23, 2026
c88c0da
Add metadata missing and error warnings in client/image
jabr Apr 23, 2026
5160327
Merge branch 'main' into improved-proxy-machines-context
jabr May 10, 2026
fea0c78
Post merge cleanup
jabr May 11, 2026
884fde0
Use atomic to store proxy Director's localAddress to handle unlikely …
jabr May 16, 2026
f3dc341
Fixes for minor review notes
jabr May 16, 2026
8da7d7d
Remove InspectMachine call that is no longer needed (machine name is …
jabr May 16, 2026
136fe2d
fix minor inconsistenct in test
jabr May 16, 2026
c0d62bb
test commit in PR branch
psviderski May 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Handle edge cases with machine mapper: called with no names/ids shoul…
…d be an error and a wildcard with no machines in the cluster (somehow)
  • Loading branch information
jabr committed Apr 23, 2026
commit 05a016d47ea85a647178f2bf1e15508e75edd712
7 changes: 7 additions & 0 deletions internal/machine/api/proxy/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func NewCorrosionMapper(store Store) *CorrosionMapper {
}

func (m *CorrosionMapper) MapMachines(ctx context.Context, namesOrIDs []string) ([]MachineTarget, error) {
if len(namesOrIDs) == 0 {
return nil, fmt.Errorf("no machines specified")
}

machines, err := m.store.ListMachines(ctx)
if err != nil {
return nil, fmt.Errorf("list machines: %w", err)
Expand All @@ -67,6 +71,9 @@ func (m *CorrosionMapper) MapMachines(ctx context.Context, namesOrIDs []string)
}

if slices.Contains(namesOrIDs, "*") {
if len(allTargets) == 0 {
return nil, fmt.Errorf("no machines in cluster")
}
return allTargets, nil
}

Expand Down
16 changes: 12 additions & 4 deletions internal/machine/api/proxy/mapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ func TestCorrosionMapper_MapMachines(t *testing.T) {
wantErr: true,
errMsg: "machine not found: missing",
},
{
name: "wildcard with no machines",
store: &mockStore{machines: []*pb.MachineInfo{}},
input: []string{"*"},
wantErr: true,
errMsg: "no machines in cluster",
},
{
name: "store error",
store: &mockStore{err: errors.New("store down")},
Expand All @@ -136,10 +143,11 @@ func TestCorrosionMapper_MapMachines(t *testing.T) {
errMsg: "invalid management IP for machine bad-ip",
},
{
name: "empty input returns empty",
store: &mockStore{machines: machines},
input: []string{},
want: []MachineTarget{},
name: "empty input returns error",
store: &mockStore{machines: machines},
input: []string{},
wantErr: true,
errMsg: "no machines specified",
},
}

Expand Down