Skip to content

feat!: improve support for multi-hub setups - #673

Draft
LSchu wants to merge 2 commits into
mainfrom
feat/multi-hub-repo
Draft

LSchu wants to merge 2 commits into
mainfrom
feat/multi-hub-repo

Conversation

@LSchu

@LSchu LSchu commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Improve support for multi-hub setups

  • (!) BREAKING: only one cluster of type "hub" is allowed per config. This is generated by default when running kubara init.
  • (!) BREAKING: remove --work-dir, --config-file and --env-file flags. This is done in order to make it impossible to run kubara commands with configuration which does not belong to the current hub.
  • added automated workspace resolution to detect config.yaml and .env inside of hub folders
  • workspace resolution is directory aware (templates folder path into ArgoCD config) and exposes workspace variables for catalog templates
  • add --hub flag to kubara generate to generate multiple hubs at once
  • add --all flag to kubara generate to generate all hubs at once
  • added documentation for multi-hub setups

Change type

  • CLI or Go code
  • Documentation
  • Tests or CI
  • Refactor or cleanup

Breaking change

  • This changes existing behavior. I explained the migration or impact above.

How I tested it

Notes for reviewers

solves #600
docs/content/10_decisions/ADR-0005-multi-hub-improvements.md WIP and subject to discussions and extensions, for example --hub support for more subcommands.
still need to do a bit of testing and verification for edge cases

@LSchu
LSchu requested a review from a team October 5, 2026 16:09
Comment thread src/internal/utils/git.go

// FindGitRepoRoot traverses upwards from startDir looking for a .git directory or file
// (supporting standard repositories, worktrees, and git submodules).
// If no git repository root is found, it returns an empty string and an error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Add error handling

@LSchu
LSchu marked this pull request as draft October 6, 2026 08:32
@LSchu LSchu changed the title feat: improve support for multi-hub setups feat!: improve support for multi-hub setups Oct 6, 2026
@LSchu LSchu added this to the 1.0.0 milestone Oct 6, 2026

@tuunit tuunit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(!) BREAKING: remove --work-dir, --config-file and --env-file flags. This is done in order to make it impossible to run kubara commands with configuration which does not belong to the current hub.

I think that is a no go. We know of users who are using those flags explicitely. This would force the file names .env and config.yaml, right?

Even our CI would break I think

@tuunit tuunit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ADR review comments

|--------------|------------|-----------------|--------------------|--------------------|
| | | | | |

# Directory-Scoped Workspaces for Multi-Hub GitOps Repositories

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats a workspace in this context?

Maybe without introducing a "new" word and needing a definition what we mean in the context fo GitOps/kubara. Something simplified like:

Suggested change
# Directory-Scoped Workspaces for Multi-Hub GitOps Repositories
# Directory-Scoped Multi-Hub GitOps Repositories

## 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 artifacts.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Templating for one configuration must never mutate, wipe, or overwrite another configuration's artifacts.
- Templating for one configuration must never mutate, wipe or overwrite another configuration's manifests.


- Different configurations may use different catalog versions and platform stacks.
- Templating for one configuration must never mutate, wipe, or overwrite another configuration's artifacts.
- Zero breaking changes to existing single-configuration repositories.

Copy link
Copy Markdown
Contributor

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

- 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 setups or run batch generation across all setups.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Developer experience must be intuitive: easily target individual setups or run batch generation across all setups.
- Developer experience must be intuitive: Easily target individual multi-hub directories or run batch generation across all.


## Decision Outcome

Chosen option: **One Hub per Config, one Folder per Hub**.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Chosen option: **One Hub per Config, one Folder per Hub**.
**One Hub per Config, one Folder per Hub**.

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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When executing within a hub folder, kubara generate automatically:
When executing within a hub folder, `kubara generate` automatically:

Comment on lines +55 to +57
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`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be discussed and duplication

This branch has not been deployed

No deployments
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.

2 participants