Added stronghold auto-discovery from kube API#371
Merged
Conversation
8c9e8aa to
3910871
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an auto-discovery mechanism for Stronghold connection parameters by querying the current Kubernetes cluster context when the user hasn’t provided configuration explicitly, and wires this discovery into the stronghold command execution path.
Changes:
- Added Kubernetes-based discovery logic to derive Stronghold address, token, and CA cert bytes and apply them via environment variables.
- Added unit tests for helper functions and the “skip when already configured” path.
- Updated
strongholdcommand routing so all Stronghold command entrypoints run the discovery step before delegating to the Stronghold/Vault CLI.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| internal/stronghold/discovery.go | Implements kube API discovery and applies discovered Stronghold env vars before running CLI. |
| internal/stronghold/discovery_test.go | Adds unit tests for discovery helpers and configured-skip behavior. |
| cmd/commands/stronghold.go | Wraps Stronghold command execution to run discovery before vaultcommand.Run. |
| cmd/commands/stronghold_commands.go | Routes generated subcommands through the new Stronghold runner (with discovery). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Maksim Kiselev <maksim.kiselev@flant.com>
3910871 to
4d89128
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.
If the user has not specified Stronghold access parameters via environment variables or command-line arguments, an attempt will be made to retrieve parameters from the Kubernetes cluster using the current kubconfig context.