[go: up one dir, main page]

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

fix(kubectl-kyverno): dump error validation response message #7758

Merged
merged 2 commits into from
Jul 5, 2023

Conversation

raffis
Copy link
Contributor
@raffis raffis commented Jul 5, 2023

Explanation

kyverno apply can fail (exit code > 0) without dumping any information for the user (without the report flag).

If apply exits > 0 I would expect that I get the reason why the command failed. The error is also not visible with an increased verbosity. That said the errors are visible in the reports mode.
However I would expect to see errors immediately if a command exits > 0 without the need of supplying flags to actually see the problem. (Also reports contain a lot more information while I only want to see errors.)

For failed policies the errors are actually dumped to stdout but that's not the case for errors.

Related issue

Milestone of this PR

What type of PR is this

Proposed Changes

  1. kyverno apply does not dump errors to stdout but apply actually exits > 0 if error count is > 0.
    Its' pretty hard to find the cause with this behavior.
cat resources | kyverno apply ./policies -r /dev/stdin

Applying 10 policy rules to 532 resources...

pass: 353, fail: 0, warn: 0, error: 44, skip: 9185 
  1. This pr simply makes apply dumping errors to stdout. Similar to how failures are dumped.
  2. Errors are now dumped to stdout as well:
Applying 24 policy rule(s) to 532 resource(s)...

policy interval -> resource production/HelmRelease/auth-load-tester error: failed to check deny conditions: failed to substitute variables in condition key: failed to resolve request.object.spec.chart.spec.interval at path : JMESPath query failed: Unknown key "interval" in path 

policy interval -> resource production/HelmRelease/example-svc error: failed to check deny conditions: failed to substitute variables in condition key: failed to resolve request.object.spec.chart.spec.interval at path : JMESPath query failed: Unknown key "interval" in path

pass: 706, fail: 0, warn: 0, error: 88, skip: 9699

Proof Manifests

Checklist

  • I have read the contributing guidelines.
  • I have read the PR documentation guide and followed the process including adding proof manifests to this PR.
  • This is a bug fix and I have added unit tests that prove my fix is effective.
  • This is a feature and I have added CLI tests that are applicable.
  • My PR needs to be cherry picked to a specific release branch which is .
  • My PR contains new or altered behavior to Kyverno and
    • CLI support should be added and my PR doesn't contain that functionality.
    • I have added or changed the documentation myself in an existing PR and the link is:
    • I have raised an issue in kyverno/website to track the documentation update and the link is:

Further Comments

@welcome
Copy link
welcome bot commented Jul 5, 2023

Thanks for opening your first Pull Request here! Please check out our Contributing guidelines and confirm that you Signed off.

Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>
@eddycharly eddycharly enabled auto-merge (squash) July 5, 2023 14:42
@codecov
Copy link
codecov bot commented Jul 5, 2023

Codecov Report

Merging #7758 (fc89498) into main (4068b42) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #7758      +/-   ##
==========================================
- Coverage   32.96%   32.96%   -0.01%     
==========================================
  Files         235      235              
  Lines       22388    22389       +1     
==========================================
  Hits         7380     7380              
- Misses      14250    14251       +1     
  Partials      758      758              
Impacted Files Coverage Δ
cmd/cli/kubectl-kyverno/utils/common/common.go 8.84% <0.00%> (-0.02%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@eddycharly eddycharly merged commit a411825 into kyverno:main Jul 5, 2023
@welcome
Copy link
welcome bot commented Jul 5, 2023

Congratulations! 🎉

Great job merging your first Pull Request here! How awesome! If you are new to this project, feel free to join our Slack community
200w

prady0t pushed a commit to prady0t/kyverno that referenced this pull request Jul 14, 2023
…#7758)

Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants