Skip to content

Show SecretID and ConfigID with --Pretty in inspect service #2834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

adeniyistephen
Copy link

@adeniyistephen adeniyistephen commented Nov 8, 2020

- What I did
@thaJeztah
I'm new to docker, so I didn't really solve a bug but I followed the project and read the CLI codebase, I only want to make a suggestion based on showing Config/Secret with --Pretty, I was thinking since the --pretty is meant to show the service details for simple understanding for people who are not programmers, does that mean the Config/Secret ID's should not show with --pretty.
- How I did it
I ran the CLI code, created a service with Config and secret.
echo "bla" | docker config create foo.conf -
echo "bla" | docker secret create secret.conf -

Create Service
docker service create -d\
--label foo=bar \
--label bar=baz \
--config src=foo.conf,target=/foo/config \
--config src=foo.conf,target=/bar/config \
--secret src=secret.conf,target=/foo/secret \
--secret src=secret.conf,target=/bar/secret \
--mount type=volume,src=foobar,target=/bax \
--mount type=volume,src=foobar,target=/baz \
--network bridge \
--name testie \
nginx:alpine

Check with Pretty
docker service inspect testie --pretty
- How to verify it
I haven't been able to verify it, that's why I'm making the suggestion, would it not look nice with the ConfigID/SecretID carrying its IDs when showing with --pretty, This push has a change in the format.go file of service to display the SecretID and ConfigID
{{- if .Configs}}
Configs:
{{- range $config := .Configs }}
ConfigID: {{$config.ConfigID}}
Target: {{$config.File.Name}}
Source: {{$config.ConfigName}}
{{- end }}{{ end }}
{{- if .Secrets }}
Secrets:
{{- range $secret := .Secrets }}
ID: {{$secret.SecretID}}
Target: {{$secret.File.Name}}
Source: {{$secret.SecretName}}
{{- end }}{{ end }}

- Description for the changelog
Here's the printout
ID: jah2kj5dkkeiivikdwaqx1646
Name: testie
Labels:
bar=baz
foo=bar
Service Mode: Replicated
Replicas: 1
Placement:
UpdateConfig:
Parallelism: 1
On failure: pause
Monitoring Period: 5s
Max failure ratio: 0
Update order: stop-first
RollbackConfig:
Parallelism: 1
On failure: pause
Monitoring Period: 5s
Max failure ratio: 0
Rollback order: stop-first
ContainerSpec:
Image: nginx:alpine@sha256:5aa44b407756b274a600c7399418bdfb1d02c33317ae27fd5e8a333afb115db1
Init: false
Mounts:
Target: /bax
Source: foobar
ReadOnly: false
Type: volume
Target: /baz
Source: foobar
ReadOnly: false
Type: volume
Configs:
Target: /foo/config
Source: foo.conf
Target: /bar/config
Source: foo.conf
Secrets:
Target: /foo/secret
Source: secret.conf
Target: /bar/secret
Source: secret.conf
Resources:
Networks: bridge
Endpoint Mode: vip

The ID are still missing.

This is just a suggestion for better reading.

- A picture of a cute animal (not mandatory but encouraged)
teacup-pomeranian-870x490

@thaJeztah This is a reference to the #908

Signed-off-by: adeniyistephen1 <adeniyistadz@gmail.com>
Signed-off-by: adeniyistephen1 <adeniyistadz@gmail.com>
Signed-off-by: adeniyistephen1 <adeniyistadz@gmail.com>
@adeniyistephen adeniyistephen changed the title Show secrets configs Show SecretID and ConfigID with --Pretty in inspect service Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant