Conversation
Author
Local VerificationAll existing tests pass, 4 new test cases pass, build succeeds, flag registered on both |
…ction Add support for excluding specific resource types from cluster resource collection. This allows platforms like OpenShift to skip resources that embed sensitive data (e.g. MachineConfig with pull secrets) without needing to modify sonobuoy source code. Example usage: sonobuoy run --exclude-resources MachineConfig,ControllerConfig sonobuoy gen config | jq '.ExcludeResources = ["MachineConfig"]' Changes: - Add ExcludeResources field to Config struct (pkg/config/config.go) - Add exclusion check in filterResources() (pkg/discovery/query.go) - Add --exclude-resources CLI flag (cmd/sonobuoy/app/args.go, gen.go) - Add 4 test cases for exclude filtering (pkg/discovery/query_test.go) Fixes vmware-tanzu#2056 Signed-off-by: Bikash Shaw <bshaw@redhat.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bshaw7
force-pushed
the
feature/exclude-resources
branch
from
July 27, 2026 12:51
1caa80b to
4528cc9
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.
What this PR does / why we need it
Adds an
--exclude-resourcesflag that allows users to specify resource types to skip during cluster resource collection.Currently, sonobuoy skips only
secretsby default (#1539). Different Kubernetes distributions embed sensitive data in platform-specific custom resources — for example, OpenShift'sMachineConfigandControllerConfigembed pull secrets and JWTs in ignition configs. There is no way for users to exclude these resource types without modifying sonobuoy code.This PR adds a simple exclusion filter that keeps the decision with the user, requiring no content awareness from sonobuoy.
Example usage
Or via config file:
Which issue(s) this PR fixes
Fixes #2056
Changes
pkg/config/config.goExcludeResources []stringfield to Config structpkg/discovery/query.gofilterResources(), update callerscmd/sonobuoy/app/args.go--exclude-resourcesCLI flagcmd/sonobuoy/app/gen.goGenFlagSet()pkg/discovery/query_test.goSpecial notes for reviewers
ExcludeResources= exclude nothing (default behavior unchanged)Resources(include list) — this adds the inverse (exclude list)ExcludeResourcessliceContains()helper for the checkRelease note