Skip to content

Commit e6b14a8

Browse files
kvapsclaude
andcommitted
fix(dispatcher): peer endpoint lookup falls through NetInterfaces
The .res-file renderer relies on lookupEndpoint to translate each peer Node CRD into an `address` for the `on <node> { address ... }` block. The function only inspected `Spec.SatelliteEndpoint` and the legacy `Spec.Props["SatelliteEndpoint"]`, so any Node CRD that declared its address via the typed `Spec.NetInterfaces` slice (the upstream-LINSTOR convention; piraeus-operator emits this shape) fell through to the empty string and `peerAddress` returned the `0.0.0.0` placeholder — drbdadm then refused the .res: drbdadm adjust e2e-auto-diskful: ipv4:0.0.0.0:7000 is used for both endpoints: exit status 10 …and no multi-replica scenario could reach UpToDate. Add `Spec.NetInterfaces[0].Address` as the third fallback. First interface wins, mirroring the LINSTOR doc comment on `NodeNetInterface`. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
1 parent 5cce3d8 commit e6b14a8

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

pkg/dispatcher/dispatcher.go

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,18 @@ func seedFromGi(target *blockstoriov1alpha1.Resource, volumeNumber int32) string
354354
return ""
355355
}
356356

357-
// lookupEndpoint reads SatelliteEndpoint from the matching Node CRD.
358-
// Phase 10.3: typed `Spec.SatelliteEndpoint` wins; falls back to the
359-
// legacy `Spec.Props["SatelliteEndpoint"]` for partially-migrated
360-
// clusters. Match by the original LINSTOR name (annotation when
361-
// slugified, else metadata.Name) so non-RFC1123 LINSTOR names still
362-
// resolve back to the right CRD.
357+
// lookupEndpoint reads the satellite endpoint from the matching Node CRD.
358+
// Precedence:
359+
//
360+
// 1. typed `Spec.SatelliteEndpoint` (Phase 10.3 native field)
361+
// 2. legacy `Spec.Props["SatelliteEndpoint"]` (partially-migrated clusters)
362+
// 3. `Spec.NetInterfaces[0].Address` (first advertised interface — the
363+
// upstream-LINSTOR convention is "first interface is the satellite
364+
// endpoint"; piraeus-operator and operator-supplied manifests
365+
// populate this field)
366+
//
367+
// Match is on the original LINSTOR name (annotation when slugified,
368+
// else metadata.Name) so non-RFC1123 LINSTOR names still resolve.
363369
func lookupEndpoint(nodeName string, nodes []blockstoriov1alpha1.Node) string {
364370
for i := range nodes {
365371
if k8s.OriginalName(&nodes[i].ObjectMeta) != nodeName {
@@ -370,7 +376,15 @@ func lookupEndpoint(nodeName string, nodes []blockstoriov1alpha1.Node) string {
370376
return ep
371377
}
372378

373-
return nodes[i].Spec.Props["SatelliteEndpoint"]
379+
if ep := nodes[i].Spec.Props["SatelliteEndpoint"]; ep != "" {
380+
return ep
381+
}
382+
383+
if len(nodes[i].Spec.NetInterfaces) > 0 && nodes[i].Spec.NetInterfaces[0].Address != "" {
384+
return nodes[i].Spec.NetInterfaces[0].Address
385+
}
386+
387+
return ""
374388
}
375389

376390
return ""

0 commit comments

Comments
 (0)