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

[Bug] [CLI] Regression Verbosity parameter has no effect for versions above 1.10.6 when running kyverno test #10256

Closed
2 tasks done
StanYago opened this issue May 18, 2024 · 7 comments
Labels
bug Something isn't working type:cli cli releated issue

Comments

@StanYago
Copy link

Kyverno CLI Version

1.11.0

Description

Up to version 1.10.6 kyverno test supported -v, --v Level option which at level 3 and above would produce additional debug output. There is no debug output generated in kyverno 1.11.x and 1.12.x

Steps to reproduce

kyverno-1.10.6/kyverno test src/policies/other/require-pdb/.kyverno-test -v3

Executing ...
I0518 13:59:22.394851 44501 common.go:289] "msg"="Defaulting request.operation to CREATE"
I0518 13:59:22.395489 44501 common.go:202] "msg"="read policies" "errors"=0 "policies"=1
applying 1 policy to 2 resources...
I0518 13:59:22.397478 44501 vars.go:376] "msg"="variable substituted" "path"="/validate/deny/conditions/any/0/key" "value"=null "variable"="{{pdb_count}}"
I0518 13:59:22.397669 44501 vars.go:376] "msg"="variable substituted" "path"="/context/0/apiCall/jmesPath" "value"=null "variable"="{{request.object.spec.template.metadata.labels}}"
I0518 13:59:22.397714 44501 vars.go:376] "msg"="variable substituted" "path"="/context/0/apiCall/urlPath" "value"=null "variable"="{{request.namespace}}"
I0518 13:59:22.397950 44501 vars.go:376] "msg"="variable substituted" "path"="/preconditions/all/0/key" "value"=null "variable"="{{request.operation || 'BACKGROUND'}}"
I0518 13:59:22.397992 44501 vars.go:376] "msg"="variable substituted" "path"="/preconditions/all/1/key" "value"=null "variable"="{{ request.object.spec.replicas }}"
I0518 13:59:22.398295 44501 common.go:425] "msg"="applying policy on resource" "policy"="require-pdb" "resource"="default/Deployment/nginx-deploy-pass"
I0518 13:59:22.398447 44501 infos.go:54] image "msg"="getting the image info" "defaultRegistry"="docker.io" "enableDefaultRegistryMutation"=true "image"="nginx:1.14.2"
I0518 13:59:22.398463 44501 infos.go:89] image "msg"="getting the image info" "digest"="" "image"="nginx:1.14.2" "name"="nginx" "path"="nginx" "registry"="docker.io" "tag"="1.14.2"
I0518 13:59:22.398617 44501 contextloaderfactory.go:108] DefaultContextLoaderFactory "msg"="disabled loading of APICall context entry %s" "pdb_count"="(MISSING)"
I0518 13:59:22.398695 44501 vars.go:376] engine.validate "msg"="variable substituted" "new.kind"="Deployment" "new.name"="nginx-deploy-pass" "new.namespace"="default" "path"="" "policy.apply"="All" "policy.name"="require-pdb" "policy.namespace"="" "rule.name"="require-pdb" "value"="CREATE" "variable"="{{request.operation || 'BACKGROUND'}}"
I0518 13:59:22.398785 44501 vars.go:376] engine.validate "msg"="variable substituted" "new.kind"="Deployment" "new.name"="nginx-deploy-pass" "new.namespace"="default" "path"="" "policy.apply"="All" "policy.name"="require-pdb" "policy.namespace"="" "rule.name"="require-pdb" "value"=4 "variable"="{{ request.object.spec.replicas }}"
I0518 13:59:22.398893 44501 vars.go:376] engine.validate "msg"="variable substituted" "new.kind"="Deployment" "new.name"="nginx-deploy-pass" "new.namespace"="default" "path"="" "policy.apply"="All" "policy.name"="require-pdb" "policy.namespace"="" "rule.name"="require-pdb" "value"="1" "variable"="{{pdb_count}}"
I0518 13:59:22.398908 44501 evaluate.go:79] engine.validate "msg"="no condition passed for 'any' block" "any"=[{"key":"{{pdb_count}}","operator":"LessThan","value":1}] "new.kind"="Deployment" "new.name"="nginx-deploy-pass" "new.namespace"="default" "policy.apply"="All" "policy.name"="require-pdb" "policy.namespace"="" "rule.name"="require-pdb"
I0518 13:59:22.399182 44501 common.go:425] "msg"="applying policy on resource" "policy"="require-pdb" "resource"="default/Deployment/nginx-deploy-skip"
I0518 13:59:22.399286 44501 infos.go:54] image "msg"="getting the image info" "defaultRegistry"="docker.io" "enableDefaultRegistryMutation"=true "image"="nginx:1.14.2"
I0518 13:59:22.399301 44501 infos.go:89] image "msg"="getting the image info" "digest"="" "image"="nginx:1.14.2" "name"="nginx" "path"="nginx" "registry"="docker.io" "tag"="1.14.2"
I0518 13:59:22.399397 44501 contextloaderfactory.go:108] DefaultContextLoaderFactory "msg"="disabled loading of APICall context entry %s" "pdb_count"="(MISSING)"
I0518 13:59:22.399464 44501 vars.go:376] engine.validate "msg"="variable substituted" "new.kind"="Deployment" "new.name"="nginx-deploy-skip" "new.namespace"="default" "path"="" "policy.apply"="All" "policy.name"="require-pdb" "policy.namespace"="" "rule.name"="require-pdb" "value"="CREATE" "variable"="{{request.operation || 'BACKGROUND'}}"
I0518 13:59:22.399538 44501 vars.go:376] engine.validate "msg"="variable substituted" "new.kind"="Deployment" "new.name"="nginx-deploy-skip" "new.namespace"="default" "path"="" "policy.apply"="All" "policy.name"="require-pdb" "policy.namespace"="" "rule.name"="require-pdb" "value"=1 "variable"="{{ request.object.spec.replicas }}"
I0518 13:59:22.399766 44501 evaluate.go:90] engine.validate "msg"="a condition failed in 'all' block" "condition"={"key":"{{ request.object.spec.replicas }}","operator":"GreaterThanOrEquals","value":3} "message"="" "new.kind"="Deployment" "new.name"="nginx-deploy-skip" "new.namespace"="default" "policy.apply"="All" "policy.name"="require-pdb" "policy.namespace"="" "rule.name"="require-pdb"

│───│─────────────│─────────────│──────────────────────────────────────│────────│
│ # │ POLICY │ RULE │ RESOURCE │ RESULT │
│───│─────────────│─────────────│──────────────────────────────────────│────────│
│ 1 │ require-pdb │ require-pdb │ default/Deployment/nginx-deploy-pass │ Pass │
│ 2 │ require-pdb │ require-pdb │ default/Deployment/nginx-deploy-skip │ Pass │
│───│─────────────│─────────────│──────────────────────────────────────│────────│

Test Summary: 2 tests passed and 0 tests failed

kyverno-1.11.5/kyverno test src/policies/other/require-pdb/.kyverno-test -v3

Loading test ( src/policies/other/require-pdb/.kyverno-test/kyverno-test.yaml ) ...
Loading values/variables ...
Loading policies ...
Loading resources ...
Applying 1 policy to 2 resources ...
Checking results ...

│────│─────────────│─────────────│──────────────────────────────│────────│────────│
│ ID │ POLICY │ RULE │ RESOURCE │ RESULT │ REASON │
│────│─────────────│─────────────│──────────────────────────────│────────│────────│
│ 1 │ require-pdb │ require-pdb │ Deployment/nginx-deploy-pass │ Pass │ Ok │
│ 2 │ require-pdb │ require-pdb │ Deployment/nginx-deploy-skip │ Pass │ Ok │
│────│─────────────│─────────────│──────────────────────────────│────────│────────│

Test Summary: 2 tests passed and 0 tests failed

Expected behavior

Expect to see debug output with verbosity level set to 3 or above in version 1.11.x and up

Screenshots

No response

Kyverno logs

No response

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.
@StanYago StanYago added bug Something isn't working triage Default label assigned to all new issues indicating label curation is needed to fully organize. type:cli cli releated issue labels May 18, 2024
@realshuting
Copy link
Member

realshuting commented May 20, 2024

This should be fixed via #10216.

@realshuting realshuting removed the triage Default label assigned to all new issues indicating label curation is needed to fully organize. label May 20, 2024
@realshuting realshuting added this to the Kyverno Release 1.12.2 milestone May 20, 2024
@realshuting
Copy link
Member

v1.12.2-rc.1 is available, closing.

@StanYago
Copy link
Author

StanYago commented Jun 6, 2024

@realshuting Still no debug output available in latest releases v1.12.2 and v1.12.3

@StanYago
Copy link
Author

StanYago commented Jun 6, 2024

Oh, I see the option is now --v=6 instead of the old -v6

@chipzoller
Copy link
Member

chipzoller commented Jun 6, 2024

It works with either one.

@StanYago
Copy link
Author

StanYago commented Jun 6, 2024

It works with either one.

Only --v=# works, -v# option does nothing

@chipzoller
Copy link
Member

Then that's a mistake. cc @anushkamittal2001 @realshuting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working type:cli cli releated issue
Projects
None yet
Development

No branches or pull requests

3 participants