feat: Implement add-configmap-ownerreference policy#1298
Open
matanbaruch wants to merge 8 commits intokyverno:mainfrom
Open
feat: Implement add-configmap-ownerreference policy#1298matanbaruch wants to merge 8 commits intokyverno:mainfrom
matanbaruch wants to merge 8 commits intokyverno:mainfrom
Conversation
…ner references for ConfigMaps used by ReplicaSets. Includes policy definition, test cases, and example resources for validation. Signed-off-by: matanbaruch <matan.baruch@unity3d.com>
Author
|
@fernferret @joebowbeer @mcs @poblahblahblah Can I get a review here? |
Contributor
|
I gave it a quick look and nothing jumped out that alarms me. But I'm not a contributor with write access. I suggest you ask @eddycharly @chipzoller |
Author
Does it mean it can be merged? |
JimBugwadia
approved these changes
Aug 17, 2025
Author
|
@JimBugwadia Can this be merged? |
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.
This pull request introduces a new Kyverno policy,
add-configmap-ownerreference, which automatically adds owner references to ConfigMaps used by ReplicaSets. The changes include the policy definition, supporting test files, and metadata for Artifact Hub integration.New Kyverno Policy: Add ConfigMap Owner Reference from ReplicaSet
add-configmap-ownerreference.yamlfile defining a KyvernoClusterPolicythat automatically adds owner references to ConfigMaps mounted by ReplicaSets. This ensures proper ownership relationships for garbage collection and dependency tracking. The policy includes annotations, RBAC requirements, and a mutation rule.Test Infrastructure for the Policy
chainsaw-test.yamlto define a multi-step test for the policy, including applying resources, patching, and asserting expected outcomes.configmap-good.yaml,replicaset-with-configmap.yaml, andreplicaset-without-configmap.yaml, to simulate various scenarios for the policy. [1] [2] [3]kyverno-test.yamlto define policy test results, ensuring the policy behaves as expected under different conditions.Artifact Hub Integration
artifacthub-pkg.ymlto provide metadata for publishing the policy on Artifact Hub, including installation instructions, keywords, and annotations.Additional Test Assertions
chainsaw-step-01-assert-1.yamlandchainsaw-step-02-assert-1.yamlto validate the policy's behavior during the test steps. [1] [2]Checklist