feat: Implement add-configmap-ownerreference policy #1298
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