Skip to content
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

ensure kind command outputs are available #435

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

nabuskey
Copy link
Collaborator

@nabuskey nabuskey commented Nov 5, 2024

Currently, when kind cluster creation fails, the only feedback users get is the status code. It's really not useful for end users and it's very difficult to troubleshoot cluster creation problems.

This PR ensures we log kind errors.

Current:

Nov  5 16:14:44 INFO Creating kind cluster logger=setup cluster=my-konflux
Nov  5 16:14:45 ERROR Error starting kind cluster logger=setup err=command "podman run --name my-konflux-control-plane --hostname my-konflux-control-plane --label io.x-k8s.kind.role=control-plane --privileged --tmpfs /tmp --tmpfs /run --volume 3b99d6c3e2675118c358c91abcd4a44c0734c822a60fd0c7b504ad916ef036b7:/var:suid,exec,dev --volume /lib/modules:/lib/modules:ro -e KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER --detach --tty --net kind --label io.x-k8s.kind.cluster=my-konflux -e container=podman --cgroupns=private --volume /dev/mapper:/dev/mapper --device /dev/fuse --volume=/run/user/1000/containers/auth.json:/var/lib/kubelet/config.json --publish=0.0.0.0:8443:443/tcp --publish=127.0.0.1:38407:6443/tcp -e KUBECONFIG=/etc/kubernetes/admin.conf docker.io/kindest/
node@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e" failed with error: exit status 125

With this PR:

Nov  5 22:03:13 INFO Creating kind cluster logger=setup cluster=localdev
Nov  5 22:03:17 ERROR Error starting kind cluster logger=setup err=command "podman run --name localdev-control-plane --hostname localdev-control-plane --label io.x-k8s.kind.role=control-plane --privileged --tmpfs /tmp --tmpfs /run --volume d669c46978e2d99f883685b44964d50e030f36a227fbd4339269455752f99abc:/var:suid,exec,dev --volume /lib/modules:/lib/modules:ro -e KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER --detach --tty --net kind --label io.x-k8s.kind.cluster=localdev -e container=podman --cgroupns=private --device /dev/fuse --publish=0.0.0.0:8443:443/tcp --publish=127.0.0.1:40945:6443/tcp -e KUBECONFIG=/etc/kubernetes/admin.conf docker.io/kindest/node:v1.30.3" failed with error: exit status 127: time="2024-11-05T22:03:15Z" level=warning msg="Error validating CNI config file /home/ubuntu/.config/cni/net.d/kind.conflist: [plugin bridge does not support config version \"1.0.0\" plugin portmap does not support config version \"1.0.0\" plugin firewall does not support config version \"1.0.0\" plugin tuning does not support config version \"1.0.0\"]"
time="2024-11-05T22:03:15Z" level=warning msg="Error validating CNI config file /home/ubuntu/.config/cni/net.d/kind.conflist: [plugin bridge does not support config version \"1.0.0\" plugin portmap does not support config version \"1.0.0\" plugin firewall does not support config version \"1.0.0\" plugin tuning does not support config version \"1.0.0\"]"
time="2024-11-05T22:03:15Z" level=error msg="error loading cached network config: network \"kind\" not found in CNI cache"
time="2024-11-05T22:03:15Z" level=warning msg="falling back to loading from existing plugins on disk"
time="2024-11-05T22:03:15Z" level=warning msg="Error validating CNI config file /home/ubuntu/.config/cni/net.d/kind.conflist: [plugin bridge does not support config version \"1.0.0\" plugin portmap does not support config version \"1.0.0\" plugin firewall does not support config version \"1.0.0\" plugin tuning does not support config version \"1.0.0\"]"
time="2024-11-05T22:03:15Z" level=error msg="Error tearing down partially created network namespace for container 552c1c3662ab3daf02cdec6c152de0552267e140e433c43cf62065f416f1d810: CNI network \"kind\" not found"
Error: error configuring network namespace for container 552c1c3662ab3daf02cdec6c152de0552267e140e433c43cf62065f416f1d810: CNI network "kind" not found

In addition, this PR makes kind output available in debug logs:

Nov  5 22:03:06 INFO Creating kind cluster logger=setup cluster=localdev
Nov  5 22:03:06 DEBUG+3 Creating cluster "localdev" ...
 logger=setup
Nov  5 22:03:06 DEBUG+3  • Ensuring node image (kindest/node:v1.30.3) 🖼  ...
 logger=setup
Nov  5 22:03:06 DEBUG+2 Image: docker.io/kindest/node:v1.30.3 present locally logger=setup
Nov  5 22:03:07 DEBUG+3  ✓ Ensuring node image (kindest/node:v1.30.3) 🖼
 logger=setup
Nov  5 22:03:07 DEBUG+3  • Preparing nodes 📦   ...
 logger=setup
Nov  5 22:03:09 DEBUG+3  ✗ Preparing nodes 📦

fixes: #432
fixes: #357

@mouuii
Copy link

mouuii commented Nov 6, 2024

/lgtm

@cmoulliard
Copy link
Contributor

This PR will help a lot. Many thanks :-)

@nabuskey nabuskey merged commit c90dbd8 into cnoe-io:main Nov 6, 2024
5 checks passed
@nabuskey nabuskey deleted the kind-logger branch November 6, 2024 12:56
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.

Feature: Improve the error message that we got: exit 125 [Bug]: log cluster related errors
4 participants