Repository navigation
feat(velero-vpol): add validate-cron-schedule ValidatingPolicy - #1752
Open
saksham869 wants to merge 1 commit into
Open
saksham869 wants to merge 1 commit into
saksham869 wants to merge 1 commit into
Conversation
Add the policies.kyverno.io/v1 replacement for the removed velero/ and velero-cel/ validate-cron-schedule samples. The cron regular expression is copied unchanged from velero-cel/, with Audit and background scanning as in legacy. velero-vpol is a new policy group, so add its job to the E2E workflow and list it in both e2e-required aggregates. Part of kyverno#1543, kyverno#1696 Signed-off-by: saksham869 <mishrasatyam3456@gmail.com> Assisted-by: Claude:claude-opus-5.5
There was a problem hiding this comment.
🟡 Changes recommended
The policy covers CREATE and UPDATE, but the test suite exercises only creation, leaving invalid updates to existing Schedules unverified.
1 open issue
What changed in this PR
Adds the velero-vpol/validate-cron-schedule policies.kyverno.io/v1 ValidatingPolicy for Velero Schedule cron expressions, replacing the legacy samples and integrating the new policy group into CI.
Changes:
- Adds CREATE and UPDATE validation with Audit mode and background scanning.
- Adds CLI and Chainsaw fixtures, readiness checks, CRD assertions, and aggregated RBAC.
- Publishes Artifact Hub metadata and registers the
velero-vpoltest group in required CI jobs.
| File | Description |
|---|---|
| velero-vpol/validate-cron-schedule/validate-cron-schedule.yaml | Defines the Velero Schedule cron-expression ValidatingPolicy for CREATE and UPDATE operations. |
| velero-vpol/validate-cron-schedule/artifacthub-pkg.yml | Provides Artifact Hub package metadata and installation instructions. |
| velero-vpol/validate-cron-schedule/.kyverno-test/kyverno-test.yaml | Defines CLI positive and negative policy test cases. |
| velero-vpol/validate-cron-schedule/.chainsaw-test/rbac.yaml | Grants the required controllers read access to Velero Schedules during Chainsaw tests. |
| velero-vpol/validate-cron-schedule/.chainsaw-test/policy-ready.yaml | Asserts that the policy reaches the expected ready state. |
| velero-vpol/validate-cron-schedule/.chainsaw-test/good-schedule.yaml | Provides valid Velero Schedule fixtures for integration testing. |
| velero-vpol/validate-cron-schedule/.chainsaw-test/crd-assert.yaml | Verifies that the Velero Schedule CRD is available. |
| velero-vpol/validate-cron-schedule/.chainsaw-test/chainsaw-test.yaml | Configures the end-to-end policy installation and Schedule validation test. |
| velero-vpol/validate-cron-schedule/.chainsaw-test/bad-schedule.yaml | Provides invalid Velero Schedule fixtures for rejection testing. |
| .github/workflows/test.yml | Adds the velero-vpol test job and required CI aggregate dependencies. |
Review effort: Lite
| resourceRules: | ||
| - apiGroups: ["velero.io"] | ||
| apiVersions: [v1] | ||
| operations: [CREATE, UPDATE] |
|
@saksham869 this PR needs a bit more before it can be reviewed:
|
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.

Related Issue(s)
Part of #1543, #1696
Description
Adds
velero-vpol/validate-cron-schedule, thepolicies.kyverno.io/v1replacement for the removedvelero/andvelero-cel/samples.velero.io/v1schedulesonCREATEandUPDATE.velero-cel/regular expression unchanged.validationActions: [Audit]and background scanning on, as in legacy. The Chainsaw test patches to[Deny].schedulesin.chainsaw-test/rbac.yaml.velero-vpolis a new group, so this adds its job to.github/workflows/test.ymland lists it in bothe2e-requiredaggregates.Tests
goodschedule01(0 7 * * *) andgoodschedule02(*/15 0-6 1,15 * 1-5) pass.badschedule01(0 7 * * * *),badschedule02(0 7 * */ *) andbadschedule03(0 24 * * *) fail.Note: the regex is unchanged, as the issue asks. It rejects Velero's documented
@every 6hform, so such a Schedule would be reported. Happy to send a follow-up if you'd like that allowed.Checklist
AI-assisted (Claude). I reviewed every file and ran both tests locally.