Skip to content

Commit 6682e37

Browse files
kvapsclaude
andcommitted
feat(satellite): advertise reachable endpoint to controller via Hello
HelloRequest gains satellite_endpoint; the satellite passes its $POD_IP:7000 (or whatever --advertised-endpoint says). The controller persists it as a Node prop so future ApplyResources dispatch can dial the satellite back. DaemonSet now exposes containerPort 7000 and pipes spec.nodeName / status.podIP into NODE_NAME / POD_IP env vars; --listen :7000 brings up the satellite-side gRPC server. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
1 parent a52ce6d commit 6682e37

6 files changed

Lines changed: 286 additions & 246 deletions

File tree

cmd/satellite/main.go

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ func run() int {
6464
"directory the satellite uses to persist DRBD .res files and per-resource state")
6565
flag.StringVar(&listenAddr, "listen", ":7000",
6666
"bind address for the satellite-side gRPC server (controller dials this for ApplyResources)")
67+
68+
advertised := os.Getenv("POD_IP")
69+
if advertised != "" {
70+
advertised += ":7000"
71+
}
72+
73+
flag.StringVar(&advertised, "advertised-endpoint", advertised,
74+
"host:port the controller should dial back at (defaults to $POD_IP:7000)")
6775
flag.StringVar(&lvmPoolName, "lvm-pool-name", "",
6876
"register an LVM-thin pool under this LINSTOR pool name (empty disables LVM)")
6977
flag.StringVar(&lvmVG, "lvm-vg", "",
@@ -99,13 +107,14 @@ func run() int {
99107
}
100108

101109
agent := satellite.NewAgent(satellite.Config{
102-
NodeName: nodeName,
103-
ControllerAddr: controllerAddr,
104-
ListenAddr: listenAddr,
105-
StateDir: stateDir,
106-
Providers: providers,
107-
DialTimeout: 10 * time.Second,
108-
Logger: logger,
110+
NodeName: nodeName,
111+
ControllerAddr: controllerAddr,
112+
ListenAddr: listenAddr,
113+
AdvertisedEndpoint: advertised,
114+
StateDir: stateDir,
115+
Providers: providers,
116+
DialTimeout: 10 * time.Second,
117+
Logger: logger,
109118
})
110119

111120
providerNames := make([]string, 0, len(providers))

pkg/satellite/agent.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ type Config struct {
5353
// RPCs, ship). Empty disables the server (useful for unit tests).
5454
ListenAddr string
5555

56+
// AdvertisedEndpoint is the host:port the satellite tells the
57+
// controller to dial back at. Differs from ListenAddr when the
58+
// satellite binds to 0.0.0.0:7000 but is reachable from the
59+
// controller as <pod-ip>:7000.
60+
AdvertisedEndpoint string
61+
5662
// StateDir is the on-disk directory the satellite uses for DRBD .res
5763
// files and per-resource state. Required.
5864
StateDir string
@@ -209,10 +215,11 @@ func (a *Agent) hello(ctx context.Context, client satellitepb.ControllerClient)
209215
defer cancel()
210216

211217
resp, err := client.Hello(rpcCtx, &satellitepb.HelloRequest{
212-
NodeName: a.cfg.NodeName,
213-
BlockstorVersion: version.Version,
214-
LayerKinds: []string{"DRBD", "STORAGE", "LUKS"},
215-
ProviderKinds: []string{"LVM", "LVM_THIN", "ZFS", "ZFS_THIN", "FILE"},
218+
NodeName: a.cfg.NodeName,
219+
BlockstorVersion: version.Version,
220+
LayerKinds: []string{"DRBD", "STORAGE", "LUKS"},
221+
ProviderKinds: []string{"LVM", "LVM_THIN", "ZFS", "ZFS_THIN", "FILE"},
222+
SatelliteEndpoint: a.cfg.AdvertisedEndpoint,
216223
})
217224
if err != nil {
218225
return errors.Wrap(err, "Hello RPC")

0 commit comments

Comments
 (0)