kubernetes / system-validators

A set of system-oriented validators for kubeadm preflight checks.
Apache License 2.0
35 stars 26 forks source link

Add check for docker engine liveness #3

Closed odinuge closed 5 years ago

odinuge commented 5 years ago

What type of PR is this? /kind cleanup

What this PR does / why we need it:

If docker engine/server is not running, the preflight check will now report:

system validation failed: [unsupported docker version: ]

because the output of docker info --format "{{json .}}" is:

{
  "ServerErrors": [
    "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
  ],
  "ClientInfo": {
    "Debug": false,
    "Plugins": [],
    "Warnings": null
  }
}

With this PR the check will report:

system validation failed: [error when fetching docker info: "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"]

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

/assign neolit123

Does this PR introduce a user-facing change?:

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

neolit123 commented 5 years ago

thanks for moving the PR here @odinuge please have a look at my latest comments.

odinuge commented 5 years ago

Thanks for the feedback @neolit123!

When it comes to the error message I just took the result from the docker info command directly. I guess we can run lowercase on the result inside the validator, but it feels kinda yanky to me.

Originates from here: https://github.com/moby/moby/blob/master/client/errors.go#L18

Here is the output: Screenshot from 2019-11-04 17-21-19

neolit123 commented 5 years ago

ok, i'm surprised that these errors are formatted like so on the side of docker.

neolit123 commented 5 years ago

/lgtm /approve

k8s-ci-robot commented 5 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: neolit123, odinuge

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes/system-validators/blob/master/OWNERS)~~ [neolit123] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment