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

chore: policy report - improve logging #5941

Merged
merged 6 commits into from
Jan 9, 2023

Conversation

realshuting
Copy link
Member

@realshuting realshuting commented Jan 9, 2023

Signed-off-by: ShutingZhao shuting@nirmata.com

Explanation

This PR logs out a message for the current configured background scan interval.

It doesn't address item 1 from #5933 as we simply re-queue the report with the background scan interval. That means, we don't know how the reconciliation is triggered.

  1. that the background scan interval has been reached and a scan is taking place

Related issue

Closes #5933.

Milestone of this PR

/1.9.0

What type of PR is this

/enhancement

Proposed Changes

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

Signed-off-by: ShutingZhao <shuting@nirmata.com>
@realshuting
Copy link
Member Author

/cherry-pick release-1.9

@realshuting realshuting enabled auto-merge (squash) January 9, 2023 06:46
@codecov
Copy link

codecov bot commented Jan 9, 2023

Codecov Report

Merging #5941 (e69ff0d) into main (6ce8e16) will increase coverage by 0.01%.
The diff coverage is 0.00%.

❗ Current head e69ff0d differs from pull request most recent head e37974f. Consider uploading reports for the commit e37974f to get more accurate results

@@            Coverage Diff             @@
##             main    #5941      +/-   ##
==========================================
+ Coverage   35.71%   35.72%   +0.01%     
==========================================
  Files         188      188              
  Lines       21043    21031      -12     
==========================================
- Hits         7515     7513       -2     
+ Misses      12699    12691       -8     
+ Partials      829      827       -2     
Impacted Files Coverage Δ
pkg/config/config.go 0.00% <0.00%> (ø)
pkg/engine/jmespath/functions.go 71.81% <0.00%> (-1.41%) ⬇️
api/kyverno/v2alpha1/policy_exception_types.go 0.00% <0.00%> (ø)
api/kyverno/v2alpha1/cleanup_policy_types.go 53.84% <0.00%> (+4.69%) ⬆️
api/kyverno/v2beta1/match_resources_types.go 62.50% <0.00%> (+18.38%) ⬆️
api/kyverno/v1/user_info_types.go 64.28% <0.00%> (+19.28%) ⬆️

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

@eddycharly
Copy link
Member

Does it work ???

@realshuting
Copy link
Member Author

Does it work ???

Can you elaborate? What do you mean?

@eddycharly
Copy link
Member

Did you see the expected log ?

@realshuting
Copy link
Member Author

Did you see the expected log ?

Nope :(

@realshuting
Copy link
Member Author

I don't see any of these logs, why it doesn't work? @eddycharly

@eddycharly
Copy link
Member

Calls to V() are cumulative. You are not setting 2 but adding 2.

@realshuting
Copy link
Member Author

Calls to V() are cumulative. You are not setting 2 but adding 2.

@eddycharly - I found a bunch of other logs are not setting the verbosity level and directly uses it, for example, this message:

logger.V(6).Info("runtime error", "msg", err.Error())

Are they not printed?

@eddycharly
Copy link
Member

This is suspicious. It’s adding 6 to the current level.

Signed-off-by: ShutingZhao <shuting@nirmata.com>
@realshuting realshuting changed the title chore: improve logging chore: policy report - improve logging Jan 9, 2023
@realshuting
Copy link
Member Author

realshuting commented Jan 9, 2023

This is suspicious. It’s adding 6 to the current level.

Updated the PR, I also removed un-used paras. Please take a look @eddycharly .

@realshuting realshuting merged commit e323e69 into kyverno:main Jan 9, 2023
@gcp-cherry-pick-bot
Copy link

Cherry-pick failed with Merge error e323e693b267e5b51d893a55b11de415ce9a06ef into temp-cherry-pick-0cdb0e-release-1.9

realshuting added a commit to realshuting/kyverno that referenced this pull request Jan 9, 2023
Signed-off-by: ShutingZhao <shuting@nirmata.com>
@realshuting realshuting added the cherry-pick-completed The PR was cherry-picked (or merged) to required release branches label Jan 9, 2023
@chipzoller
Copy link
Member

chipzoller commented Jan 9, 2023

I'm not able to see in this PR what's being logged regarding the issue that it closes for background scans using that flag.

@realshuting realshuting deleted the bgscan-logging branch January 9, 2023 16:52
@realshuting
Copy link
Member Author

This PR logs out a message for the current configured background scan interval.

This PR logs out a message for the current configured background scan interval here which is configured via the backgroundScanInterval flag.

@chipzoller
Copy link
Member

I see. And is it logging that a background scan is occurring at all? That was the other portion.

@realshuting
Copy link
Member Author

No, please take a look at the PR explanation:

It doesn't address item 1 from #5933 as we simply re-queue the report with the background scan interval. That means, we don't know how the reconciliation is triggered.

  1. that the background scan interval has been reached and a scan is taking place

@chipzoller
Copy link
Member

So is there a plan to log this info? I feel it's pretty basic information.

@realshuting
Copy link
Member Author

So is there a plan to log this info? I feel it's pretty basic information.

The current logic doesn't work as before, we could only add a message when we re-queue it (with the delay) as I did here. But I found it quite noisy so removed it.

@chipzoller
Copy link
Member

Ok

realshuting added a commit that referenced this pull request Jan 9, 2023
Signed-off-by: ShutingZhao <shuting@nirmata.com>

Signed-off-by: ShutingZhao <shuting@nirmata.com>
MdSahil-oss pushed a commit to MdSahil-oss/kyverno that referenced this pull request Jan 11, 2023
Signed-off-by: ShutingZhao <shuting@nirmata.com>

Signed-off-by: ShutingZhao <shuting@nirmata.com>
Signed-off-by: MdSahil-oss <Mohdssahil1@gmail.com>
MdSahil-oss pushed a commit to MdSahil-oss/kyverno that referenced this pull request Jan 11, 2023
Signed-off-by: ShutingZhao <shuting@nirmata.com>

Signed-off-by: ShutingZhao <shuting@nirmata.com>
Signed-off-by: MdSahil-oss <Mohdssahil1@gmail.com>
MdSahil-oss pushed a commit to MdSahil-oss/kyverno that referenced this pull request Jan 13, 2023
Signed-off-by: ShutingZhao <shuting@nirmata.com>

Signed-off-by: ShutingZhao <shuting@nirmata.com>
Signed-off-by: MdSahil-oss <Mohdssahil1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-completed The PR was cherry-picked (or merged) to required release branches cherry-pick-required milestone 1.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Log a message when background scan occurs
3 participants