detached 590fa2e

feat: add ListNetworks and GetConfig to ControlPlane interface

commit
590fa2ec9b906276a7316fe1aed4285841bc2a7b
author
brice · · 2026-03-14 03:16 UTC
parent
c016c64
signature
unsigned
4 files · +43 -0
M internal/adapters/in/cli/controlplane.go +2 -0
@@ -35,6 +35,8 @@ type ControlPlane interface {
3535
3636 GetStatus(ctx context.Context) (*remote.Status, error)
3737 Reload(ctx context.Context) error
38+ ListNetworks(ctx context.Context) ([]*domain.NetworkInfo, error)
39+ GetConfig(ctx context.Context) (*remote.Config, error)
3840 DeployIntent(ctx context.Context, imageName string) error
3941 Deploy(ctx context.Context, deployDomain string) (*remote.DeployResult, error)
4042 Restart(ctx context.Context, restartDomain string, withAttachments bool) (*remote.RestartResult, error)
@@ -35,6 +35,8 @@ type ControlPlane interface {
35 35
36 GetStatus(ctx context.Context) (*remote.Status, error)36 GetStatus(ctx context.Context) (*remote.Status, error)
37 Reload(ctx context.Context) error37 Reload(ctx context.Context) error
38+ ListNetworks(ctx context.Context) ([]*domain.NetworkInfo, error)
39+ GetConfig(ctx context.Context) (*remote.Config, error)
38 DeployIntent(ctx context.Context, imageName string) error40 DeployIntent(ctx context.Context, imageName string) error
39 Deploy(ctx context.Context, deployDomain string) (*remote.DeployResult, error)41 Deploy(ctx context.Context, deployDomain string) (*remote.DeployResult, error)
40 Restart(ctx context.Context, restartDomain string, withAttachments bool) (*remote.RestartResult, error)42 Restart(ctx context.Context, restartDomain string, withAttachments bool) (*remote.RestartResult, error)
M internal/adapters/in/cli/controlplane_local.go +25 -0
@@ -321,6 +321,31 @@ func (l *localControlPlane) Reload(_ context.Context) error {
321321 return app.SendReloadSignal()
322322 }
323323
324+func (l *localControlPlane) ListNetworks(ctx context.Context) ([]*domain.NetworkInfo, error) {
325+ if l.containerSvc == nil {
326+ return nil, fmt.Errorf("container service unavailable")
327+ }
328+ return l.containerSvc.ListNetworks(ctx)
329+}
330+
331+func (l *localControlPlane) GetConfig(ctx context.Context) (*remote.Config, error) {
332+ if l.configSvc == nil {
333+ return nil, fmt.Errorf("config service unavailable")
334+ }
335+ cfg := &remote.Config{
336+ Routes: l.configSvc.GetRoutes(ctx),
337+ ExternalRoutes: l.configSvc.GetExternalRoutes(),
338+ }
339+ cfg.Server.Port = l.configSvc.GetServerPort()
340+ cfg.Server.RegistryPort = l.configSvc.GetRegistryPort()
341+ cfg.Server.RegistryDomain = l.configSvc.GetRegistryDomain()
342+ cfg.Server.DataDir = l.configSvc.GetDataDir()
343+ cfg.AutoRoute.Enabled = l.configSvc.IsAutoRouteEnabled()
344+ cfg.NetworkIsolation.Enabled = l.configSvc.IsNetworkIsolationEnabled()
345+ cfg.NetworkIsolation.Prefix = l.configSvc.GetNetworkPrefix()
346+ return cfg, nil
347+}
348+
324349 func (l *localControlPlane) DeployIntent(_ context.Context, imageName string) error {
325350 if l.deployCoord != nil {
326351 l.deployCoord.SuppressDeployEvent(imageName)
@@ -321,6 +321,31 @@ func (l *localControlPlane) Reload(_ context.Context) error {
321 return app.SendReloadSignal()321 return app.SendReloadSignal()
322 }322 }
323 323
324+func (l *localControlPlane) ListNetworks(ctx context.Context) ([]*domain.NetworkInfo, error) {
325+ if l.containerSvc == nil {
326+ return nil, fmt.Errorf("container service unavailable")
327+ }
328+ return l.containerSvc.ListNetworks(ctx)
329+}
330+
331+func (l *localControlPlane) GetConfig(ctx context.Context) (*remote.Config, error) {
332+ if l.configSvc == nil {
333+ return nil, fmt.Errorf("config service unavailable")
334+ }
335+ cfg := &remote.Config{
336+ Routes: l.configSvc.GetRoutes(ctx),
337+ ExternalRoutes: l.configSvc.GetExternalRoutes(),
338+ }
339+ cfg.Server.Port = l.configSvc.GetServerPort()
340+ cfg.Server.RegistryPort = l.configSvc.GetRegistryPort()
341+ cfg.Server.RegistryDomain = l.configSvc.GetRegistryDomain()
342+ cfg.Server.DataDir = l.configSvc.GetDataDir()
343+ cfg.AutoRoute.Enabled = l.configSvc.IsAutoRouteEnabled()
344+ cfg.NetworkIsolation.Enabled = l.configSvc.IsNetworkIsolationEnabled()
345+ cfg.NetworkIsolation.Prefix = l.configSvc.GetNetworkPrefix()
346+ return cfg, nil
347+}
348+
324 func (l *localControlPlane) DeployIntent(_ context.Context, imageName string) error {349 func (l *localControlPlane) DeployIntent(_ context.Context, imageName string) error {
325 if l.deployCoord != nil {350 if l.deployCoord != nil {
326 l.deployCoord.SuppressDeployEvent(imageName)351 l.deployCoord.SuppressDeployEvent(imageName)
M internal/adapters/in/cli/controlplane_remote.go +8 -0
@@ -92,6 +92,14 @@ func (r *remoteControlPlane) Reload(ctx context.Context) error {
9292 return r.client.Reload(ctx)
9393 }
9494
95+func (r *remoteControlPlane) ListNetworks(ctx context.Context) ([]*domain.NetworkInfo, error) {
96+ return r.client.ListNetworks(ctx)
97+}
98+
99+func (r *remoteControlPlane) GetConfig(ctx context.Context) (*remote.Config, error) {
100+ return r.client.GetConfig(ctx)
101+}
102+
95103 func (r *remoteControlPlane) DeployIntent(ctx context.Context, imageName string) error {
96104 return r.client.DeployIntent(ctx, imageName)
97105 }
@@ -92,6 +92,14 @@ func (r *remoteControlPlane) Reload(ctx context.Context) error {
92 return r.client.Reload(ctx)92 return r.client.Reload(ctx)
93 }93 }
94 94
95+func (r *remoteControlPlane) ListNetworks(ctx context.Context) ([]*domain.NetworkInfo, error) {
96+ return r.client.ListNetworks(ctx)
97+}
98+
99+func (r *remoteControlPlane) GetConfig(ctx context.Context) (*remote.Config, error) {
100+ return r.client.GetConfig(ctx)
101+}
102+
95 func (r *remoteControlPlane) DeployIntent(ctx context.Context, imageName string) error {103 func (r *remoteControlPlane) DeployIntent(ctx context.Context, imageName string) error {
96 return r.client.DeployIntent(ctx, imageName)104 return r.client.DeployIntent(ctx, imageName)
97 }105 }
M internal/adapters/in/cli/push_test.go +8 -0
@@ -100,6 +100,14 @@ func (c *resolveFromImageTestControlPlane) Reload(context.Context) error {
100100 panic("unexpected call")
101101 }
102102
103+func (c *resolveFromImageTestControlPlane) ListNetworks(context.Context) ([]*domain.NetworkInfo, error) {
104+ panic("unexpected call")
105+}
106+
107+func (c *resolveFromImageTestControlPlane) GetConfig(context.Context) (*remote.Config, error) {
108+ panic("unexpected call")
109+}
110+
103111 func (c *resolveFromImageTestControlPlane) DeployIntent(context.Context, string) error {
104112 panic("unexpected call")
105113 }
@@ -100,6 +100,14 @@ func (c *resolveFromImageTestControlPlane) Reload(context.Context) error {
100 panic("unexpected call")100 panic("unexpected call")
101 }101 }
102 102
103+func (c *resolveFromImageTestControlPlane) ListNetworks(context.Context) ([]*domain.NetworkInfo, error) {
104+ panic("unexpected call")
105+}
106+
107+func (c *resolveFromImageTestControlPlane) GetConfig(context.Context) (*remote.Config, error) {
108+ panic("unexpected call")
109+}
110+
103 func (c *resolveFromImageTestControlPlane) DeployIntent(context.Context, string) error {111 func (c *resolveFromImageTestControlPlane) DeployIntent(context.Context, string) error {
104 panic("unexpected call")112 panic("unexpected call")
105 }113 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close