adding configs/secrets to service inspect pretty

Signed-off-by: Essam A. Hassan <es.hassan187@gmail.com>
This commit is contained in:
Essam A. Hassan 2018-04-15 19:38:59 +02:00
parent e5980c541a
commit 3ae2d4b24c
1 changed files with 20 additions and 0 deletions

View File

@ -97,6 +97,18 @@ Mounts:
ReadOnly = {{ $mount.ReadOnly }}
Type = {{ $mount.Type }}
{{- end -}}
{{- if .Configs}}
Configs:
{{- range $config := .Configs }}
Target: {{$config.File.Name}}
Source: {{$config.ConfigName}}
{{- end }}{{ end }}
{{- if .Secrets }}
Secrets:
{{- range $secret := .Secrets }}
Target: {{$secret.File.Name}}
Source: {{$secret.SecretName}}
{{- end }}{{ end }}
{{- if .HasResources }}
Resources:
{{- if .HasResourceReservations }}
@ -200,6 +212,14 @@ func (ctx *serviceInspectContext) Labels() map[string]string {
return ctx.Service.Spec.Labels
}
func (ctx *serviceInspectContext) Configs() []*swarm.ConfigReference {
return ctx.Service.Spec.TaskTemplate.ContainerSpec.Configs
}
func (ctx *serviceInspectContext) Secrets() []*swarm.SecretReference {
return ctx.Service.Spec.TaskTemplate.ContainerSpec.Secrets
}
func (ctx *serviceInspectContext) IsModeGlobal() bool {
return ctx.Service.Spec.Mode.Global != nil
}