cnoe-io / idpbuilder

Spin up a complete internal developer platform with only Docker required as a dependency.
https://cloud-native.slack.com/archives/C05TN9WFN5S
Apache License 2.0
173 stars 54 forks source link

[suggestion] Show a more user friendly message when docker/podman is not running #71

Open cmoulliard opened 10 months ago

cmoulliard commented 10 months ago

[suggestion]

Show a more user friendly message when docker/podman is not running instead of what I copy/paste hereafter

Remark: This is not logic that when such issue happens we also log the usage. To be reviewed !

1.698653935506318e+09   ERROR   setup   Error starting kind cluster {"error": "failed to list clusters: command \"docker ps -a --filter label=io.x-k8s.kind.cluster --format '{{.Label \"io.x-k8s.kind.cluster\"}}'\" failed with error: exit status 1", "errorVerbose": "command \"docker ps -a --filter label=io.x-k8s.kind.cluster --format '{{.Label \"io.x-k8s.kind.cluster\"}}'\" failed with error: exit status 1\nsigs.k8s.io/kind/pkg/errors.WithStack\n\t/home/runner/go/pkg/mod/sigs.k8s.io/kind@v0.20.0/pkg/errors/errors.go:59\nsigs.k8s.io/kind/pkg/exec.(*LocalCmd).Run\n\t/home/runner/go/pkg/mod/sigs.k8s.io/kind@v0.20.0/pkg/exec/local.go:124\nsigs.k8s.io/kind/pkg/exec.OutputLines\n\t/home/runner/go/pkg/mod/sigs.k8s.io/kind@v0.20.0/pkg/exec/helpers.go:81\nsigs.k8s.io/kind/pkg/cluster/internal/providers/docker.(*provider).ListClusters\n\t/home/runner/go/pkg/mod/sigs.k8s.io/kind@v0.20.0/pkg/cluster/internal/providers/docker/provider.go:107\nsigs.k8s.io/kind/pkg/cluster.(*Provider).List\n\t/home/runner/go/pkg/mod/sigs.k8s.io/kind@v0.20.0/pkg/cluster/provider.go:191\ngithub.com/cnoe-io/idpbuilder/pkg/kind.(*Cluster).Exists\n\t/home/runner/work/idpbuilder/idpbuilder/pkg/kind/cluster.go:107\ngithub.com/cnoe-io/idpbuilder/pkg/kind.(*Cluster).Reconcile\n\t/home/runner/work/idpbuilder/idpbuilder/pkg/kind/cluster.go:121\ngithub.com/cnoe-io/idpbuilder/pkg/build.(*Build).ReconcileKindCluster\n\t/home/runner/work/idpbuilder/idpbuilder/pkg/build/build.go:54\ngithub.com/cnoe-io/idpbuilder/pkg/build.(*Build).Run\n\t/home/runner/work/idpbuilder/idpbuilder/pkg/build/build.go:102\ngithub.com/cnoe-io/idpbuilder/pkg/cmd/create.create\n\t/home/runner/work/idpbuilder/idpbuilder/pkg/cmd/create/root.go:65\ngithub.com/spf13/cobra.(*Command).execute\n\t/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068\ngithub.com/spf13/cobra.(*Command).Execute\n\t/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992\ngithub.com/cnoe-io/idpbuilder/pkg/cmd.Execute\n\t/home/runner/work/idpbuilder/idpbuilder/pkg/cmd/root.go:24\nmain.main\n\t/home/runner/work/idpbuilder/idpbuilder/main.go:6\nruntime.main\n\t/opt/hostedtoolcache/go/1.20.0/x64/src/runtime/proc.go:250\nruntime.goexit\n\t/opt/hostedtoolcache/go/1.20.0/x64/src/runtime/asm_arm64.s:1172\nfailed to list clusters\nsigs.k8s.io/kind/pkg/errors.Wrap\n\t/home/runner/go/pkg/mod/sigs.k8s.io/kind@v0.20.0/pkg/errors/errors.go:47\nsigs.k8s.io/kind/pkg/cluster/internal/providers/docker.(*provider).ListClusters\n\t/home/runner/go/pkg/mod/sigs.k8s.io/kind@v0.20.0/pkg/cluster/internal/providers/docker/provider.go:109\nsigs.k8s.io/kind/pkg/cluster.(*Provider).List\n\t/home/runner/go/pkg/mod/sigs.k8s.io/kind@v0.20.0/pkg/cluster/provider.go:191\ngithub.com/cnoe-io/idpbuilder/pkg/kind.(*Cluster).Exists\n\t/home/runner/work/idpbuilder/idpbuilder/pkg/kind/cluster.go:107\ngithub.com/cnoe-io/idpbuilder/pkg/kind.(*Cluster).Reconcile\n\t/home/runner/work/idpbuilder/idpbuilder/pkg/kind/cluster.go:121\ngithub.com/cnoe-io/idpbuilder/pkg/build.(*Build).ReconcileKindCluster\n\t/home/runner/work/idpbuilder/idpbuilder/pkg/build/build.go:54\ngithub.com/cnoe-io/idpbuilder/pkg/build.(*Build).Run\n\t/home/runner/work/idpbuilder/idpbuilder/pkg/build/build.go:102\ngithub.com/cnoe-io/idpbuilder/pkg/cmd/create.create\n\t/home/runner/work/idpbuilder/idpbuilder/pkg/cmd/create/root.go:65\ngithub.com/spf13/cobra.(*Command).execute\n\t/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068\ngithub.com/spf13/cobra.(*Command).Execute\n\t/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992\ngithub.com/cnoe-io/idpbuilder/pkg/cmd.Execute\n\t/home/runner/work/idpbuilder/idpbuilder/pkg/cmd/root.go:24\nmain.main\n\t/home/runner/work/idpbuilder/idpbuilder/main.go:6\nruntime.main\n\t/opt/hostedtoolcache/go/1.20.0/x64/src/runtime/proc.go:250\nruntime.goexit\n\t/opt/hostedtoolcache/go/1.20.0/x64/src/runtime/asm_arm64.s:1172"}
github.com/cnoe-io/idpbuilder/pkg/build.(*Build).ReconcileKindCluster
    /home/runner/work/idpbuilder/idpbuilder/pkg/build/build.go:55
github.com/cnoe-io/idpbuilder/pkg/build.(*Build).Run
    /home/runner/work/idpbuilder/idpbuilder/pkg/build/build.go:102
github.com/cnoe-io/idpbuilder/pkg/cmd/create.create
    /home/runner/work/idpbuilder/idpbuilder/pkg/cmd/create/root.go:65
github.com/spf13/cobra.(*Command).execute
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940
github.com/spf13/cobra.(*Command).ExecuteC
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068
github.com/spf13/cobra.(*Command).Execute
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
github.com/cnoe-io/idpbuilder/pkg/cmd.Execute
    /home/runner/work/idpbuilder/idpbuilder/pkg/cmd/root.go:24
main.main
    /home/runner/work/idpbuilder/idpbuilder/main.go:6
runtime.main
    /opt/hostedtoolcache/go/1.20.0/x64/src/runtime/proc.go:250
Error: failed to list clusters: command "docker ps -a --filter label=io.x-k8s.kind.cluster --format '{{.Label "io.x-k8s.kind.cluster"}}'" failed with error: exit status 1
Usage:
  idpbuilder create [flags]

Flags:
      --buildName string                  Name for build (Prefix for kind cluster name, pod names, etc). (default "localdev")
      --extraPorts string                 List of extra ports to expose on the docker container and kubernetes cluster as nodePort (e.g. "22:32222,9090:39090,etc").
  -h, --help                              help for create
      --kindConfig string                 Path of the kind config file to be used instead of the default.
      --kubeVersion string                Version of the kind kubernetes cluster to create. (default "v1.26.3")
      --recreate                          Delete cluster first if it already exists.
      --zap-devel                         Development Mode defaults(encoder=consoleEncoder,logLevel=Debug,stackTraceLevel=Warn). Production Mode defaults(encoder=jsonEncoder,logLevel=Info,stackTraceLevel=Error) (default true)
      --zap-encoder encoder               Zap log encoding (one of 'json' or 'console')
      --zap-log-level level               Zap Level to configure the verbosity of logging. Can be one of 'debug', 'info', 'error', or any integer value > 0 which corresponds to custom debug levels of increasing verbosity
      --zap-stacktrace-level level        Zap Level at and above which stacktraces are captured (one of 'info', 'error', 'panic').
      --zap-time-encoding time-encoding   Zap time encoding (one of 'epoch', 'millis', 'nano', 'iso8601', 'rfc3339' or 'rfc3339nano'). Defaults to 'epoch'.

failed to list clusters: command "docker ps -a --filter label=io.x-k8s.kind.cluster --format '{{.Label "io.x-k8s.kind.cluster"}}'" failed with error: exit status 1
cmoulliard commented 4 months ago

As we released 0.4, the ticket should be updated to become part of a next release milestone