mirror of https://github.com/docker/cli.git
Merge pull request #32030 from ehazlett/any-runtime
Support Swarmkit Generic Task Runtime
This commit is contained in:
commit
abaaa82400
|
@ -45,7 +45,9 @@ func runList(dockerCli *command.DockerCli, opts listOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
client := dockerCli.Client()
|
client := dockerCli.Client()
|
||||||
|
|
||||||
services, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: opts.filter.Value()})
|
serviceFilters := opts.filter.Value()
|
||||||
|
serviceFilters.Add("runtime", string(swarm.RuntimeContainer))
|
||||||
|
services, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: serviceFilters})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
|
swarmtypes "github.com/docker/docker/api/types/swarm"
|
||||||
"github.com/docker/docker/cli"
|
"github.com/docker/docker/cli"
|
||||||
"github.com/docker/docker/cli/command"
|
"github.com/docker/docker/cli/command"
|
||||||
"github.com/docker/docker/cli/command/formatter"
|
"github.com/docker/docker/cli/command/formatter"
|
||||||
|
@ -58,8 +59,11 @@ func runPS(dockerCli *command.DockerCli, opts psOptions) error {
|
||||||
serviceIDFilter := filters.NewArgs()
|
serviceIDFilter := filters.NewArgs()
|
||||||
serviceNameFilter := filters.NewArgs()
|
serviceNameFilter := filters.NewArgs()
|
||||||
for _, service := range opts.services {
|
for _, service := range opts.services {
|
||||||
|
// default to container runtime
|
||||||
serviceIDFilter.Add("id", service)
|
serviceIDFilter.Add("id", service)
|
||||||
|
serviceIDFilter.Add("runtime", string(swarmtypes.RuntimeContainer))
|
||||||
serviceNameFilter.Add("name", service)
|
serviceNameFilter.Add("name", service)
|
||||||
|
serviceNameFilter.Add("runtime", string(swarmtypes.RuntimeContainer))
|
||||||
}
|
}
|
||||||
serviceByIDList, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: serviceIDFilter})
|
serviceByIDList, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: serviceIDFilter})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -17,6 +17,12 @@ func getStackFilter(namespace string) filters.Args {
|
||||||
return filter
|
return filter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getServiceFilter(namespace string) filters.Args {
|
||||||
|
filter := getStackFilter(namespace)
|
||||||
|
filter.Add("runtime", string(swarm.RuntimeContainer))
|
||||||
|
return filter
|
||||||
|
}
|
||||||
|
|
||||||
func getStackFilterFromOpt(namespace string, opt opts.FilterOpt) filters.Args {
|
func getStackFilterFromOpt(namespace string, opt opts.FilterOpt) filters.Args {
|
||||||
filter := opt.Value()
|
filter := opt.Value()
|
||||||
filter.Add("label", convert.LabelNamespace+"="+namespace)
|
filter.Add("label", convert.LabelNamespace+"="+namespace)
|
||||||
|
@ -36,7 +42,7 @@ func getServices(
|
||||||
) ([]swarm.Service, error) {
|
) ([]swarm.Service, error) {
|
||||||
return apiclient.ServiceList(
|
return apiclient.ServiceList(
|
||||||
ctx,
|
ctx,
|
||||||
types.ServiceListOptions{Filters: getStackFilter(namespace)})
|
types.ServiceListOptions{Filters: getServiceFilter(namespace)})
|
||||||
}
|
}
|
||||||
|
|
||||||
func getStackNetworks(
|
func getStackNetworks(
|
||||||
|
|
Loading…
Reference in New Issue