Add namespace column for docker stack ls command while targeting Kubernetes orchestrator

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
This commit is contained in:
Silvin Lubecki
2018-04-09 15:11:45 +02:00
committed by Mathieu Champlon
parent 31dccfffb5
commit 65526a201f
7 changed files with 39 additions and 24 deletions

View File

@ -16,12 +16,12 @@ func RunList(dockerCli *KubeCli, opts options.List) error {
return err
}
format := opts.Format
if len(format) == 0 {
format = formatter.TableFormatKey
if format == "" || format == formatter.TableFormatKey {
format = formatter.KubernetesStackTableFormat
}
stackCtx := formatter.Context{
Output: dockerCli.Out(),
Format: formatter.NewStackFormat(format),
Format: formatter.Format(format),
}
sort.Sort(byName(stacks))
return formatter.StackWrite(stackCtx, stacks)
@ -51,6 +51,7 @@ func getStacks(kubeCli *KubeCli) ([]*formatter.Stack, error) {
Name: stack.name,
Services: len(stack.getServices()),
Orchestrator: "Kubernetes",
Namespace: stack.namespace,
})
}
return formattedStacks, nil