refactor(cyberark): update Snapshot resource types to client.Object#715
Draft
wallrj-cyberark wants to merge 2 commits intomasterfrom
Draft
refactor(cyberark): update Snapshot resource types to client.Object#715wallrj-cyberark wants to merge 2 commits intomasterfrom
wallrj-cyberark wants to merge 2 commits intomasterfrom
Conversation
- Add minimizeSnapshot to filter out TLS secrets lacking client certificates - Improve privacy and reduce snapshot size for CyberArk uploads - Implement isExcludableSecret and isExcludableTLSSecret helpers - Add unit tests for minimization and exclusion logic Signed-off-by: Richard Wall <richard.wall@cyberark.com>
This commit refactors the `Snapshot` resource types to use `client.Object` instead of `runtime.Object`, aiming to improve type safety. This reduces the amount of type casting and associated error handling in the minimizeSnapshot code and allows the logging of dropped secret name and namespace becasue the secret objects are known to satisfy both metav1.Object and runtime.Object. The extractResourceListFromReading function needed to be updated accordingly to handle generic types. - Replace runtime.Object with client.Object and *unstructured.Unstructured in Snapshot struct and related functions - Refactor minimizeSnapshot and isExcludableSecret to use new types - Update extractResourceListFromReading to use generics for resource type - Adjust tests to match new resource type signatures and expectations - Add "type" field to example Secret in input.json for clarity Signed-off-by: Richard Wall <richard.wall@cyberark.com>
56dbef5 to
ef50cec
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.
Followup to #714
This commit refactors the
Snapshotresource types to useclient.Objectinstead ofruntime.Object, aiming to improve type safety. This reduces the amount of type casting and associated error handling in the minimizeSnapshot code and allows the logging of dropped secret name and namespace becasue the secret objects are known to satisfy both metav1.Object and runtime.Object.The extractResourceListFromReading function needed to be updated accordingly to handle generic types.