Add interval field to BackgroundConfiguration for per-policy background scan interval#91
Open
VarshaUN wants to merge 1 commit into
Open
Conversation
…ckground scan interval Signed-off-by: Varsha U N <varshaun58@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
This PR adds an interval field to the BackgroundConfiguration struct in the Kyverno API. Currently, background scanning in Kyverno runs on a single global interval configured at the controller level, meaning all policies are scanned at the same frequency regardless of their individual needs. This addition allows users to override the global background scan interval on a per-policy basis by setting spec.evaluation.background.interval on ValidatingPolicy, MutatingPolicy, and other CEL-based policy types. This is an addition of new API behavior.
Related issue
Part of kyverno/KDP#89 , Per-Policy Background Scan Interval proposal, discussed and approved by maintainers.
Proposed Changes
After this change, users can configure per-policy background scan intervals like:
If interval is not set, the policy falls back to the global background scan interval as before , fully backward compatible.
Checklist
Further Comments
This PR covers only the API type change. A follow-up PR in
kyverno/kyvernowill implement the actual background controller behavior readingspec.evaluation.background.intervalper policy and scheduling scans accordingly, along with annotation support for Kubernetes-nativeValidatingAdmissionPolicyandMutatingAdmissionPolicytypes as agreed in the KDP discussion.Signed-off-by:Varsha U N varshaun58@gmail.com
cc: @aerosouund @JimBugwadia @realshuting