diff --git a/internal/agent/sync.go b/internal/agent/sync.go index ce4d454..443bd63 100644 --- a/internal/agent/sync.go +++ b/internal/agent/sync.go @@ -157,6 +157,24 @@ func (a *Agent) reconcileUntracked(ctx context.Context, known map[string]bool) e // protoToComponent converts a proto ComponentSpec to a registry Component. func protoToComponent(service string, cs *mcpv1.ComponentSpec, desiredState string) *registry.Component { + var routes []registry.Route + for _, r := range cs.GetRoutes() { + mode := r.GetMode() + if mode == "" { + mode = "l4" + } + name := r.GetName() + if name == "" { + name = "default" + } + routes = append(routes, registry.Route{ + Name: name, + Port: int(r.GetPort()), + Mode: mode, + Hostname: r.GetHostname(), + }) + } + return ®istry.Component{ Name: cs.GetName(), Service: service, @@ -167,6 +185,7 @@ func protoToComponent(service string, cs *mcpv1.ComponentSpec, desiredState stri Ports: cs.GetPorts(), Volumes: cs.GetVolumes(), Cmd: cs.GetCmd(), + Routes: routes, DesiredState: desiredState, Version: runtime.ExtractVersion(cs.GetImage()), }