Skip to content

Commit a8c57f4

Browse files
committed
fix: handle ext conns in hybrid envs
if a physical switch is connected to a hardware external, the correponding ExternalConnection does not need to be created. Since the connection does not specify the external, the addLink function cannot know from the current config whether that connection is physical or virtual. Work around this by also annotating hardware ExternalConnections and ignoring them when processing the virtual externals. Signed-off-by: Emanuele Di Pascale <emanuele@githedgehog.com>
1 parent 0c377c7 commit a8c57f4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pkg/hhfab/vlabconfig.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,17 +662,26 @@ func createVLABConfig(ctx context.Context, controls []fabapi.ControlNode, nodes
662662
}
663663
}
664664
} else if conn.Spec.External != nil {
665+
// in hybrid environments we can have physical switches connected to
666+
// both virtual and hardware externals. Since a connection is not associated
667+
// with a specific external, we need to annotate the connection itself
668+
if isHardware(&conn) {
669+
slog.Debug("Skipping hardware external connection", "connection", conn.Name)
670+
671+
continue
672+
}
665673
if externalID > MaxExternalConns {
666674
return nil, fmt.Errorf("too many external connections") //nolint:goerr113
667675
}
668676

669677
switchName := conn.Spec.External.Link.Switch.DeviceName()
670-
// add the link representing the external connection
678+
// add the link representing the virtual external connection
679+
// note that if the switch is hardware, we will require passthrough annotations
671680
nicName := fmt.Sprintf("enp2s%d", externalID)
672681
externalID++
673682
toStr := fmt.Sprintf("%s/%s", ExternalVMName, nicName)
674683
if err := addLink(conn.Spec.External.Link.Switch.Port, toStr); err != nil {
675-
return nil, fmt.Errorf("failed to add link for external connection %q: %w", conn.Name, err)
684+
return nil, fmt.Errorf("failed to add link for virtual external connection %q: %w", conn.Name, err)
676685
}
677686
extNicCfg := ExternalNICCfg{
678687
Attachments: make([]ExternalAttachCfg, 0),

0 commit comments

Comments
 (0)