Skip to content

Conversation

wallrj-cyberark
Copy link
Member

Followup to #714

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

- 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>
Base automatically changed from client-secrets-only-2 to master September 17, 2025 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant