Skip to content

Commit b459782

Browse files
kvapsclaude
andcommitted
fix(dispatcher): match nodes by original LINSTOR name
The k8s metadata.Name on a Node CRD may have been slugified at write time when the LINSTOR name doesn't satisfy RFC 1123. The dispatcher compared target.Spec.NodeName (original LINSTOR-side string) against nodes[i].Name (slug), which silently produced "no SatelliteEndpoint" errors for non-RFC1123 nodes. Match against k8s.OriginalName so the slug is transparent to the dispatch path. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
1 parent 3c8907b commit b459782

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

pkg/dispatcher/dispatcher.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535

3636
blockstoriov1alpha1 "github.com/cozystack/blockstor/api/v1alpha1"
3737
satellitepb "github.com/cozystack/blockstor/pkg/satellite/proto"
38+
"github.com/cozystack/blockstor/pkg/store/k8s"
3839
)
3940

4041
// drbdAddrAny is the placeholder address we put into the .res file at
@@ -119,10 +120,13 @@ func (d *Dispatcher) Apply(ctx context.Context, target *blockstoriov1alpha1.Reso
119120
return resp.GetResults()[0], nil
120121
}
121122

122-
// lookupEndpoint reads SatelliteEndpoint from the Node prop bag.
123+
// lookupEndpoint reads SatelliteEndpoint from the Node prop bag. We
124+
// match by the original LINSTOR name (annotation when slugified, else
125+
// metadata.Name) so non-RFC1123 LINSTOR names still resolve back to
126+
// the right CRD on the controller side.
123127
func lookupEndpoint(nodeName string, nodes []blockstoriov1alpha1.Node) string {
124128
for i := range nodes {
125-
if nodes[i].Name == nodeName {
129+
if k8s.OriginalName(&nodes[i].ObjectMeta) == nodeName {
126130
return nodes[i].Spec.Props["SatelliteEndpoint"]
127131
}
128132
}

0 commit comments

Comments
 (0)