diff --git a/components/cli/command/stack/common.go b/components/cli/command/stack/common.go index 920a1af0cc..4ae8184933 100644 --- a/components/cli/command/stack/common.go +++ b/components/cli/command/stack/common.go @@ -9,18 +9,6 @@ import ( "github.com/docker/docker/client" ) -const ( - labelNamespace = "com.docker.stack.namespace" -) - -func getStackLabels(namespace string, labels map[string]string) map[string]string { - if labels == nil { - labels = make(map[string]string) - } - labels[labelNamespace] = namespace - return labels -} - func getStackFilter(namespace string) filters.Args { filter := filters.NewArgs() filter.Add("label", labelNamespace+"="+namespace) @@ -46,11 +34,3 @@ func getStackNetworks( ctx, types.NetworkListOptions{Filters: getStackFilter(namespace)}) } - -type namespace struct { - name string -} - -func (n namespace) scope(name string) string { - return n.name + "_" + name -} diff --git a/components/cli/command/stack/deploy.go b/components/cli/command/stack/deploy.go index 00a7634a0a..f1ab65ce95 100644 --- a/components/cli/command/stack/deploy.go +++ b/components/cli/command/stack/deploy.go @@ -179,51 +179,6 @@ func getConfigFile(filename string) (*composetypes.ConfigFile, error) { }, nil } -func convertNetworks( - namespace namespace, - networks map[string]composetypes.NetworkConfig, -) (map[string]types.NetworkCreate, []string) { - if networks == nil { - networks = make(map[string]composetypes.NetworkConfig) - } - - // TODO: only add default network if it's used - networks["default"] = composetypes.NetworkConfig{} - - externalNetworks := []string{} - result := make(map[string]types.NetworkCreate) - - for internalName, network := range networks { - if network.External.External { - externalNetworks = append(externalNetworks, network.External.Name) - continue - } - - createOpts := types.NetworkCreate{ - Labels: getStackLabels(namespace.name, network.Labels), - Driver: network.Driver, - Options: network.DriverOpts, - } - - if network.Ipam.Driver != "" || len(network.Ipam.Config) > 0 { - createOpts.IPAM = &networktypes.IPAM{} - } - - if network.Ipam.Driver != "" { - createOpts.IPAM.Driver = network.Ipam.Driver - } - for _, ipamConfig := range network.Ipam.Config { - config := networktypes.IPAMConfig{ - Subnet: ipamConfig.Subnet, - } - createOpts.IPAM.Config = append(createOpts.IPAM.Config, config) - } - result[internalName] = createOpts - } - - return result, externalNetworks -} - func validateExternalNetworks( ctx context.Context, dockerCli *command.DockerCli,