#17649·kyverno

[Bug] [CLI] Kyverno CLI test command ignores CONNECT operation and fails validation

Author: mohit-bhandari45Created Sep 20, 2026Updated Sep 20, 2026
Labelsbugtype:clitriage

Kyverno CLI Version

1.16.4

Description

Kubernetes Admission Webhooks and Kyverno's policy engine support CONNECT operations (e.g. for pods/exec, pods/attach, pods/portforward).

However, in kubectl-kyverno:

  1. NormalizeOperation in cmd/cli/kubectl-kyverno/processor/operation.go rejects "CONNECT" with an error: invalid operation "CONNECT", must be one of CREATE, UPDATE, DELETE
  2. makePolicyContext in cmd/cli/kubectl-kyverno/processor/policy_processor.go is missing case "CONNECT": in its operation switch statements. When request.operation: CONNECT is set in values files, policy_processor.go silently falls back to kyvernov1.Create.

As a result, offline CLI policy evaluations against CONNECT operations fail or skip rule execution.

Steps to reproduce

  1. Create policy.yaml: `yaml apiVersion: kyverno.io/v1 kind: ClusterPolicy metadata: name: block-connect spec: validationFailureAction: Enforce rules:
  • name: check-connect match: any:
    • resources: kinds:
      • Pod operations:
      • CONNECT validate: message: "CONNECT operation blocked" deny: {} `
  1. Create values.yaml: `yaml policies:
  • name: block-connect rules:
    • name: check-connect values: request.operation: CONNECT

`

  1. Create pod.yaml: yaml apiVersion: v1 kind: Pod metadata: name: test-pod namespace: default

  2. Run kubectl-kyverno apply: bash kubectl-kyverno apply policy.yaml --resource pod.yaml --values values.yaml

Expected behavior

The CLI should recognize CONNECT as a valid admission operation, map it to kyvernov1.Connect in the policy context, and evaluate rules matching operations: ["CONNECT"] (returning fail: 1 / pass: 1 rather than silently skipping as CREATE).

Screenshots

No response

Kyverno logs

bash

Slack discussion

No response

Troubleshooting

  • I have read and followed the troubleshooting guide.
  • I have searched other issues in this repository and mine is not recorded.