Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#17787·kyverno

[Bug] [CLI] kyverno test output missing namespace in resource table

Author: Sashang-debugCreated Sep 30, 2026Updated Sep 30, 2026

Description

When running kyverno test via the CLI, the result table fails to correctly parse and display the namespace of the tested resources.

The Resource column is intended to print the resource in distinct colors. However, currently, the namespace is swallowed into the "Kind" string and passed as an empty string to the output formatting function.

As seen in cmd/cli/kubectl-kyverno/commands/test/output.go:

go
Resource:  color.Resource(strings.Join(resourceParts[:len(resourceParts)-1], "/"), "", resourceParts[len(resourceParts)-1]), // todo: handle namespace

Because "" is explicitly passed as the namespace argument, the color.Resource utility doesn't format the Namespace distinctively from the Kind.

Steps to reproduce

  1. Run a CLI test where the tested resources contain namespaces, for example: ./cmd/cli/kubectl-kyverno/kubectl-kyverno test test/cli/test-mutate.
  2. Observe the CLI output table under the RESOURCE column. The output merges the namespace into the Kind string (e.g. v1/Secret/staging/secret-1 where staging is the namespace) instead of being colorized correctly.

Expected behavior

The CLI test output should correctly isolate the Kind, Namespace, and Name from the parsed resource string and pass them distinctively to the output formatter, honoring the todo: handle namespace comment.

Source: kyverno/kyverno

View original on GitHubView discussion on GitHub