Skip to content

crictl inspect fails with multiple container-id input #1871

@hassenius

Description

@hassenius

What happened:

When inputing multiple id's in crictl inspect the command fails

Example

crictl inspect -o go-template --template  '{{.status.id}} {{.info.pid}} {{index .info.runtimeSpec.annotations "io.kubernetes.pod.name"}}'  642733a12d491aff97dd225daf727019ad0d1431231514b9d34739cad4c372f9 1f7eae95409637b1b71d0d38a30ad13a7b7044638e6dc38cb6e2aefc53a9ef9f
FATA[0000] get the status of containers: execute template: failed to template data: template: tmplExecuteRawJSON:1:9: executing "tmplExecuteRawJSON" at <.status.id>: can't evaluate field status in type []interface {}

But individually they work just fine, showing that the issue arrises when doing mutiple ids

crictl inspect -o go-template --template  '{{.status.id}} {{.info.pid}} {{index .info.runtimeSpec.annotations "io.kubernetes.pod.name"}}'  642733a12d491aff97dd225daf727019ad0d1431231514b9d34739cad4c372f9
642733a12d491aff97dd225daf727019ad0d1431231514b9d34739cad4c372f9 996921 tracee-7csvb

crictl inspect -o go-template --template  '{{.status.id}} {{.info.pid}} {{index .info.runtimeSpec.annotations "io.kubernetes.pod.name"}}'  1f7eae95409637b1b71d0d38a30ad13a7b7044638e6dc38cb6e2aefc53a9ef9f
1f7eae95409637b1b71d0d38a30ad13a7b7044638e6dc38cb6e2aefc53a9ef9f 585179 nfd-node-feature-discovery-worker-jwtpx

What you expected to happen:

For it to succeed as command suggests

crictl inspect -h
NAME:
   crictl inspect - Display the status of one or more containers

USAGE:
   crictl inspect [command options] CONTAINER-ID [CONTAINER-ID...]

How to reproduce it (as minimally and precisely as possible):

Try crictl inspect with multiple IDs

Anything else we need to know?:

Environment:

  • Container runtime or hardware configuration: crictl version v1.31.1
  • OS (e.g: cat /etc/os-release):
 NAME="Red Hat Enterprise Linux"
VERSION="8.10 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.10"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.10 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8"
BUG_REPORT_URL="https://issues.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.10
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.10"
  • Kernel (e.g. uname -a): Linux k8s-test 4.18.0-553.40.1.el8_10.x86_64 SMP Thu Feb 6 21:20:51 EST 2025 x86_64 x86_64 x86_64 GNU/Linux
  • Others:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.sig/nodeCategorizes an issue or PR as relevant to SIG Node.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions