Skip to content

Conversation

wallrj-cyberark
Copy link
Member

@wallrj-cyberark wallrj-cyberark commented Aug 13, 2025

Stacked on #684

The problem with the first approach to getting the cluster ID (#670), -- the UID of the kube-system namespace -- is that it requires the agent to have a connection to a target Kubernetes cluster at startup.
But this breaks one of operating modes of the agent; it is designed so data can be collected and stored to a file by one instance, (--one-shot --output-file) and then the data read from a file and uploaded to Venafi TLSPK (or CyberArk Discovery) by another separate instance (--one-shot --input-file).

In this alternative approach, we use a dynamic data-gatherer to get all the namespaces, and extract the UID from the kube-system namespace before uploading to CyberArk.

  • Added extractClusterUIDFromReading to derive the cluster UID from
    ark/namespaces data readings.
  • Updated ConvertDataReadingsToCyberarkSnapshot to include the cluster UID
    in the snapshot.
  • Modified tests to validate cluster UID extraction logic.
  • Updated example test data to include ark/namespaces data gatherer.
  • Removed pkg/clusteruid package as its functionality is now integrated
    into the client logic.

Part of: https://venafi.atlassian.net/browse/VC-43753

Followup PRs

  1. [VC-43403] CyberArk(helm): add Disco Agent Helm chart #678

@wallrj-cyberark wallrj-cyberark changed the title Use a namespaces datagatherer to get the cluster ID [VC-43753] Use a namespaces datagatherer to get the cluster ID Aug 13, 2025
@wallrj-cyberark wallrj-cyberark force-pushed the VC-43403-inventory-api-2 branch 2 times, most recently from 88c1cc7 to 8b9a233 Compare August 13, 2025 21:34
@wallrj-cyberark wallrj-cyberark force-pushed the VC-43403-inventory-api-3 branch from 6e029d7 to 4c3cbe5 Compare August 13, 2025 21:57
@wallrj-cyberark wallrj-cyberark changed the title [VC-43753] Use a namespaces datagatherer to get the cluster ID [VC-43753] CyberArk Discovery and Context: Use a namespaces datagatherer to get the cluster ID Aug 14, 2025
@wallrj-cyberark wallrj-cyberark force-pushed the VC-43403-inventory-api-2 branch from 8b9a233 to 5196fc9 Compare August 14, 2025 14:16
@wallrj-cyberark wallrj-cyberark force-pushed the VC-43403-inventory-api-3 branch from 4c3cbe5 to 919c73d Compare August 14, 2025 17:05
@wallrj-cyberark wallrj-cyberark force-pushed the VC-43403-inventory-api-2 branch 2 times, most recently from 59dbac7 to 2d44e46 Compare August 20, 2025 14:59
@wallrj-cyberark wallrj-cyberark force-pushed the VC-43403-inventory-api-2 branch 3 times, most recently from caadaf0 to e8f50da Compare August 22, 2025 17:01
- Introduced a new `MachineHub` output mode in the agent configuration.
- Added `--machine-hub` flag to enable the `MachineHub` mode.
- Implemented `CyberArkClient` for publishing data readings to CyberArk's API.
- Created `LoadClientConfigFromEnvironment` to load CyberArk client configuration from environment variables.
- Updated tests to cover `MachineHub` mode and CyberArk client functionality.
- Modified mock data and discovery logic to support CyberArk integration.

Signed-off-by: Richard Wall <[email protected]>
- Introduced `ConvertDataReadingsToCyberarkSnapshot` to transform data readings into CyberArk snapshot format.
- Enhanced `PostDataReadingsWithOptions` to utilize the new snapshot conversion.
- Added `DynamicData` and `DiscoveryData` types for structured data handling.
- Updated `DataGathererDynamic` and `DataGathererDiscovery` to return strongly typed data.
- Implemented `ParseDataReadings` in `testutil` for decoding and testing data readings.
- Added test data and golden file support for snapshot conversion validation.

Signed-off-by: Richard Wall <[email protected]>
@wallrj-cyberark wallrj-cyberark force-pushed the VC-43403-inventory-api-2 branch from e8f50da to 7686607 Compare August 29, 2025 03:38
- Added `extractClusterUIDFromReading` to derive the cluster UID from
  `ark/namespaces` data readings.
- Updated `ConvertDataReadingsToCyberarkSnapshot` to include the cluster UID
  in the snapshot.
- Modified tests to validate cluster UID extraction logic.
- Updated example test data to include `ark/namespaces` data gatherer.
- Removed `pkg/clusteruid` package as its functionality is now integrated
  into the client logic.

Signed-off-by: Richard Wall <[email protected]>
@wallrj-cyberark wallrj-cyberark force-pushed the VC-43403-inventory-api-3 branch from 919c73d to 339f991 Compare August 29, 2025 04:10
@wallrj-cyberark wallrj-cyberark changed the title [VC-43753] CyberArk Discovery and Context: Use a namespaces datagatherer to get the cluster ID [VC-43753] CyberArk(client): extract cluster UID from data readings Aug 29, 2025
@wallrj-cyberark wallrj-cyberark force-pushed the VC-43403-inventory-api-2 branch 3 times, most recently from ee3d84d to a04cdad Compare August 31, 2025 06:52
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