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.yaml
file defining a KyvernoClusterPolicy
that 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.yaml
to 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.yaml
to define policy test results, ensuring the policy behaves as expected under different conditions.Artifact Hub Integration
artifacthub-pkg.yml
to provide metadata for publishing the policy on Artifact Hub, including installation instructions, keywords, and annotations.Additional Test Assertions
chainsaw-step-01-assert-1.yaml
andchainsaw-step-02-assert-1.yaml
to validate the policy's behavior during the test steps. [1] [2]Checklist