Add --resource-names flag to customize monitored resources#1919
Open
0xiso wants to merge 1 commit intosigstore:mainfrom
Open
Add --resource-names flag to customize monitored resources#19190xiso wants to merge 1 commit intosigstore:mainfrom
0xiso wants to merge 1 commit intosigstore:mainfrom
Conversation
ab6201c to
2443af0
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1919 +/- ##
===========================================
- Coverage 42.78% 29.78% -13.01%
===========================================
Files 121 122 +1
Lines 8994 7374 -1620
===========================================
- Hits 3848 2196 -1652
- Misses 4791 4945 +154
+ Partials 355 233 -122 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c6b8253 to
af577ea
Compare
593862d to
3d79360
Compare
This commit adds the ability to selectively monitor specific Kubernetes resource types using the --resource-names flag. This addresses issue sigstore#1388. Changes: - Add --resource-names flag with default value covering all resource types - Implement dynamic types map construction based on specified resources - Add validation and logging for resource names configuration - Add warning when using custom resource names (poor UX if parent resources like Deployments are not monitored) - Fail fast if no valid resources are specified Testing: - Add comprehensive E2E test (test/e2e_test_resource_names_flag.sh) - Add kustomize configuration example (test/kustomize-resource-names/) - Add GitHub Actions workflow for CI testing (.github/workflows/kind-cluster-resource-names.yaml) - Workflow properly deploys policy-controller before running tests The default behavior remains unchanged (all resources monitored), ensuring backward compatibility. Signed-off-by: 0xiso <6024009+0xiso@users.noreply.github.com>
3d79360 to
7141bdc
Compare
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.
Summary
This PR adds the
--resource-namesflag to allow operators to selectively monitor specific Kubernetes resource types. This addresses issue #1388.Background
This PR is an updated version of #1687, which has become outdated and requires rebasing. This PR provides the same functionality with an updated implementation.
Changes
Core Implementation
--resource-nameswith default value covering all resource types (pods, replicasets, deployments, statefulsets, daemonsets, jobs, cronjobs)Testing
test/e2e_test_resource_names_flag.shvalidates selective monitoringtest/kustomize-resource-names/demonstrates configuration.github/workflows/kind-cluster-resource-names.yamlfor automated testingBehavior
Default (unchanged)
./webhook # Monitors: pods, replicasets, deployments, statefulsets, daemonsets, jobs, cronjobsCustom resources
Warning Rationale
When parent resources (e.g., Deployments, ReplicaSets) are not monitored, users will not receive policy violation feedback when creating them, even though the Pods they create may violate policies. This can lead to poor user experience.
Testing
Run the E2E test:
Deploy with specific resources:
Backward Compatibility
✅ Default behavior unchanged - all resources monitored by default
✅ Existing deployments continue to work without modification
✅ No breaking changes
CI Note
The CI failure in
ClusterImagePolicy e2e tests with TrustRoot - Bring Your Own Keys (v1.32.x, repository)appears to be unrelated to this PR:mainbranch (#17047096031)Related Issues and PRs