Skip to content

Commit

Permalink
Merge pull request #11409 from ndeloof/swarm_overlay_network
Browse files Browse the repository at this point in the history
don't check external network existence when swarm is enabled
  • Loading branch information
glours committed Jan 29, 2024
2 parents cdb6eb5 + da1a34a commit ac8ea08
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions pkg/compose/create.go
Expand Up @@ -1246,19 +1246,16 @@ func (s *composeService) resolveExternalNetwork(ctx context.Context, n *types.Ne
n.Name = networks[0].ID
return nil
case 0:
if n.Driver == "overlay" {
enabled, err := s.isSWarmEnabled(ctx)
if err != nil {
return err
}
if enabled {
// Swarm nodes do not register overlay networks that were
// created on a different node unless they're in use.
// Here we assume `driver` is relevant for a network we don't manage
// which is a non-sense, but this is our legacy ¯\(ツ)/¯
// So we can't preemptively check network exists, but
// networkAttach will later fail anyway if network actually doesn't exists
enabled, err := s.isSWarmEnabled(ctx)
if err != nil {
return err
}
if enabled {
return nil
}
return nil
}
return fmt.Errorf("network %s declared as external, but could not be found", n.Name)
default:
Expand Down

0 comments on commit ac8ea08

Please sign in to comment.