Repository navigation
feat!: improve support for multi-hub setups #673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
LSchu
wants to merge
4
commits into
main
Choose a base branch
from
feat/multi-hub-repo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
64 changes: 64 additions & 0 deletions
64
docs/content/10_decisions/ADR-0005-multi-hub-improvements.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| | status | date | decision-makers | consulted | informed | | ||
| |--------------|------------|-----------------|--------------------|--------------------| | ||
| | | | | | | | ||
|
|
||
| # Directory-Scoped Execution Context for Multi-Hub GitOps Repositories | ||
|
|
||
| ## Context and Problem Statement | ||
|
|
||
| Following feedback and bugreports from our community around the handling and documentation of multi-hub setups, | ||
| we decided to improve kubaras support for multi-hub setups. | ||
|
|
||
| Previously, `kubara generate` hardcoded its output paths to `./platform-components` and `./platform-configs/<cluster>` | ||
| relative to the current working directory, and wiped `./platform-components` before every generate run. | ||
| When multiple configuration files coexisted in a repository: | ||
| 1. Running generation for one config would wipe or overwrite the shared `platform-components` of another config, possibly resulting in the deletion of required files. | ||
| 2. If different configs referenced different catalog versions or customized services, conflicts occurred. | ||
| 3. Argo CD Application manifests need accurate repository-relative subpaths to locate charts and values overlays within the Git repository. | ||
| 4. Relative paths in Terraform templates (e.g. `../../../../platform-components/...`) depend on a consistent relative depth between `platform-configs` and `platform-components`. | ||
|
|
||
| Kubara needs an ergonomic, deterministic way to support multiple hub-and-spoke configurations within the same repository without cross-configuration interference. | ||
|
|
||
| ## Decision Drivers | ||
|
|
||
| - Different configurations may use different catalog versions and platform stacks. | ||
| - Templating for one configuration must never mutate, wipe or overwrite another configuration's manifests. | ||
| - Zero breaking changes to existing single-configuration repositories. | ||
| - Keep Terraform relative module paths (`../../../../platform-components/...`) working without requiring modifications to catalog templates. | ||
| - Git repository subpaths must be computed automatically to simplify Argo CD GitOps workflows. | ||
| - Developer experience must be intuitive: Easily target individual hubs, a set of hubs or run batch generation across all. | ||
| - Minimize sources of mixups in execution context around .env file and config.yaml | ||
|
|
||
| ## Decision Outcome | ||
|
|
||
| **One Hub per Config, one Folder per Hub**. | ||
|
|
||
| ### Folder Layout | ||
| Hubs exist in isolated directories, at the root level or nested (e.g. `prod`, `project-a/staging`) containing: | ||
| - `config.yaml` | ||
| - `.env` | ||
| - `platform-components/` (isolated generated Helm charts and Terraform modules) | ||
| - `platform-configs/` (cluster-specific overlays) | ||
|
|
||
| Because `platform-configs` and `platform-components` remain siblings inside each hub directory, existing Terraform relative source paths (`../../../../platform-components/...`) remain valid. | ||
|
|
||
| ### Automatic GitOps Path Computation | ||
| When executing within a hub folder, `kubara generate` automatically: | ||
| 1. Traverses up the directory tree to discover the Git repository root (`.git`). | ||
| 1. Calculates the Git-relative subpath from the Git root to the hub (e.g. `setups/dev-fleet`). | ||
| 1. Injects computed repository paths into `argocd.repo`: | ||
| - `components.path`: `<git-rel-path>/platform-components/helm` | ||
| - `configs.path`: `<git-rel-path>/platform-configs` | ||
|
|
||
| ### CLI Ergonomics | ||
| 1. **Targeting**: `generate --hub <path>` sets the target hub directory, accepting a list of hubs to generate. | ||
| 1. **Directory Scoping**: Commands execute within the hub directory or target hubs via `--hub`. Legacy flags (`--work-dir`, `--config-file`, and `--env-file`) are removed in favor of directory-scoped context. | ||
| 1. **Batch Generation**: `kubara generate --all` (alias `-A`) discovers all configurations in the current directory and generates each hub in its own isolated context. | ||
| 1. **Removal of old Flags**: `--work-dir`, `--config-file` and `--env-file` have been removed and are replaced by `--hub` | ||
|
Comment on lines
+55
to
+57
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to be discussed and duplication |
||
|
|
||
| ## Consequences | ||
|
|
||
| - **Good**, because multiple hub-and-spoke setups can live in the same Git repository without file collisions. | ||
| - **Good**, because setups can independently upgrade catalog versions and dependencies. | ||
| - **Good**, because Argo CD path calculation requires zero manual configuration. | ||
| - **Good**, because single-config repositories at root remain completely unaffected (zero breaking changes). | ||
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which wouldn't be true if we remove --config-file and/or --env-file