Skip to content

areed/ch3130/container inspect all#36

Merged
areed merged 1 commit intoreplicatedcom:masterfrom
areed:areed/ch3130/container-inspect-all
Nov 7, 2017
Merged

areed/ch3130/container inspect all#36
areed merged 1 commit intoreplicatedcom:masterfrom
areed:areed/ch3130/container-inspect-all

Conversation

@areed
Copy link
Copy Markdown

@areed areed commented Nov 6, 2017

This allows Replicated to get logs and inspect for all containers in an app version.

Copy link
Copy Markdown
Member

@emosbaugh emosbaugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can take or leave some of this feedback

// convert labels to field args
args := filters.NewArgs()
for k, v := range spec.Config.ContainerLabels {
label := fmt.Sprintf("%s=%s", k, v)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you should make v optional, see below

vagrant@default:/vagrant$ sudo docker container ls --filter=label=com.docker.compose.project
CONTAINER ID        IMAGE                                  COMMAND                  CREATED             STATUS              PORTS                                                                               NAMES
25a46e09d15a        vagrant_replicated-ui                  "sh -c 'make insta..."   6 days ago          Up 6 days           0.0.0.0:8800->8800/tcp, 0.0.0.0:32778->6060/tcp                                     replicated-ui
300a0a3b3f2b        vagrant_qa-integration-onprem          "sh -c 'sleep infi..."   6 days ago          Up 6 days           0.0.0.0:8082->8081/tcp                                                              qa-integration-onprem
4a4836ce176f        vagrant_replicated                     "sh -c 'make insta..."   6 days ago          Up 6 days           0.0.0.0:9874->9874/tcp, 0.0.0.0:9877-9878->9877-9878/tcp, 0.0.0.0:32777->6060/tcp   replicated
c89b929f175a        vagrant_replicated-operator            "sh -c 'make insta..."   6 days ago          Up 6 days           0.0.0.0:32775->6060/tcp                                                             replicated-operator
b3659ae60a77        selenium/standalone-chrome-debug:3.6   "/opt/bin/entry_po..."   6 days ago          Up 6 days           0.0.0.0:4444->4444/tcp, 0.0.0.0:5900->5900/tcp                                      vagrant_selenuim_1
6118cd42d299        nginx:1                                "nginx -g 'daemon ..."   6 days ago          Up 6 days           80/tcp, 0.0.0.0:32769->8006/tcp                                                     saas_market-api_1
22dd7ca60fb5        nginx:1                                "nginx -g 'daemon ..."   6 days ago          Up 6 days           80/tcp, 0.0.0.0:32768->10443/tcp                                                    saas_registry_1
vagrant@default:/vagrant$ sudo docker container ls --filter=label=com.docker.compose.project=
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
vagrant@default:/vagrant$ sudo docker container ls --filter=label=com.docker.compose.project=saas
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                              NAMES
6118cd42d299        nginx:1             "nginx -g 'daemon ..."   6 days ago          Up 6 days           80/tcp, 0.0.0.0:32769->8006/tcp    saas_market-api_1
22dd7ca60fb5        nginx:1             "nginx -g 'daemon ..."   6 days ago          Up 6 days           80/tcp, 0.0.0.0:32768->10443/tcp   saas_registry_1
vagrant@default:/vagrant$

inspectTask := &plans.StructuredSource{
Producer: d.producers.Inspect(container.ID),
}
logsTask := &plans.StreamSource{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why logs and inspect especially if this task has name InspectLabels? i think this should be two separate tasks

Comment thread pkg/plugins/docker/docker.go Outdated
"daemon": docker.Daemon,
"logs": docker.Logs,
"inspect": docker.Inspect,
"inspect-labels": docker.InspectLabels,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about container-inspect-ls?

container-inspect
container-logs

Comment thread pkg/types/spec.go Outdated
EnablePull bool `json:"enable_pull"`
ContainerID string `json:"container_id"`
ContainerName string `json:"container_name"`
ContainerLabels map[string]string `json:"container_labels"`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about the whole ContainerListOptions? similar to DockerRunCommand

https://github.com/docker/engine-api/blob/4290f40c056686fcaa5c9caf02eac1dde9315adf/types/client.go#L47

container_list_options:
filters:
label:
foo=bar: true`)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird but ok

Comment thread pkg/types/spec.go Outdated
EnablePull bool `json:"enable_pull"`
ContainerID string `json:"container_id"`
ContainerName string `json:"container_name"`
ContainerLabels map[string]string `json:"container_labels"`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you still need this?

Comment thread pkg/plugins/docker/docker.go Outdated
"read-file": docker.ReadFile,
"exec-command": docker.ExecCommand,
"run-command": docker.RunCommand,
"container-logs": docker.ContainerLogs,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suppose i meant for logs to be container-logs and inspect to be container-inspect. these could be container-ls-logs and container-ls-inspect

@areed areed merged commit f029c63 into replicatedcom:master Nov 7, 2017
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.

2 participants