Skip to content

Commit

Permalink
Merge pull request #82 from mutagen-io/no-network-dep-fix
Browse files Browse the repository at this point in the history
sidecar: disable networking if no network dependencies are present
  • Loading branch information
xenoscopic authored Nov 11, 2024
2 parents 3c59b77 + 810dc0e commit 8a63563
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkg/mutagen/liaison.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,13 @@ func (l *Liaison) processProject(project *types.Project) error {
}
composeVersion := strings.TrimPrefix(versions.Compose, "v")

// If there are no network dependencies, then disable networking.
var networkMode string
if len(networkDependencies) == 0 {
networkMode = "none"
networkDependencies = nil
}

// Create and record the Mutagen sidecar service definition. The service
// configuration we generate here needs to match (as closely as possible)
// those generated by projectOptions.toProject in Compose. In particular,
Expand All @@ -476,9 +483,10 @@ func (l *Liaison) processProject(project *types.Project) error {
sidecarRoleLabelKey: sidecarRoleLabelValue,
sidecarVersionLabelKey: mutagen.Version,
},
Networks: networkDependencies,
Volumes: serviceVolumeDependencies,
CapAdd: capabilities,
NetworkMode: networkMode,
Networks: networkDependencies,
Volumes: serviceVolumeDependencies,
CapAdd: capabilities,
CustomLabels: types.Labels{
api.ProjectLabel: project.Name,
api.ServiceLabel: sidecarServiceName,
Expand Down

0 comments on commit 8a63563

Please sign in to comment.