Skip to content

feat(installer): support templated install configs from vault#457

Merged
schrodit merged 6 commits into
mainfrom
config-template
Jun 3, 2026
Merged

feat(installer): support templated install configs from vault#457
schrodit merged 6 commits into
mainfrom
config-template

Conversation

@schrodit

@schrodit schrodit commented May 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Add Go template rendering for install configs with dynamic {{ secret "..." }} lookups backed by prod.vault.yaml
    • I decided to not use a simple struct like {{ vault.mySecret.password }} because using a function make it more generic to support other stores like vault ehre secrets are rather fetched async.
  • Add a generic configtemplating package and a vault-backed installer secret store
    • The current vault is in a separate package to be able to switch the store with a different one e.g. openbao.
  • Support explicit vault path handling via oms install codesphere --vault
  • Render install configs to temporary 0600 files and warn when secrets.baseDir differs from the passed vault directory

Example

Use the newly added oms config template command to test it out locally.

# Example config.yaml fragment using secrets from prod.vault.yaml.
#
# Rendered by:
#   oms install codesphere --config config.yaml --vault prod.vault.yaml --priv-key age_key.txt ...
#
# Secret values are read dynamically from prod.vault.yaml and are not stored in
# plaintext in config.yaml.

secrets:
  baseDir: ./secrets

codesphere:
  override:
    global:
      license:
        key: '{{ secret "codesphereLicenseKey" }}'

postgres:
  override:
    auth:
      username: '{{ secret "postgresAdmin" "fields.username" }}'
      password: '{{ secret "postgresAdmin" "fields.password" }}'

@schrodit
schrodit requested a review from joka134 May 27, 2026 20:29
@schrodit schrodit self-assigned this May 27, 2026
Render install config templates through a shared configtemplating package.

Add vault-backed secret lookup with explicit vault path handling for install and bootstrap flows.

Signed-off-by: Tim Schrodi <tim@codesphere.com>
Signed-off-by: schrodit <7979201+schrodit@users.noreply.github.com>

@joka134 joka134 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice feature! 🚀 Left some comments. Let's discuss it if you want

Comment thread cli/cmd/template_config.go
Comment thread cli/cmd/config.go Outdated
Comment thread internal/installer/vault_templating_secret_store.go Outdated
Comment thread internal/configtemplating/config_template.go
Comment thread internal/installer/vault_templating_secret_store.go
Comment thread internal/installer/vault_templating_secret_store.go Outdated
Comment thread internal/installer/vault_templating_secret_store.go
Comment thread internal/installer/config_template_test.go Outdated
Comment thread internal/configtemplating/config_template.go Outdated
Comment thread cli/cmd/install_codesphere.go
- rename `oms config template` -> `oms template config` for verb-first
  consistency with other commands
- rename RenderConfigFileToTempIfNeeded -> RenderConfigFileToTemp (always
  creates a temp file)
- extract lazy vault loading into ensureVault() with clearer error messages
  and drop the redundant nil-receiver check
- add doc comments to exported templating/secret-store APIs
- warn that `template config` prints secrets to stdout
- tidy config template test payload and regenerate docs

Signed-off-by: Tim Schrodi <tim@codesphere.com>
@schrodit
schrodit requested a review from joka134 June 1, 2026 16:16

@joka134 joka134 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice! added some optional comments. But adding some examples to the CLI would simplify the usage.

Comment thread internal/installer/vault_templating_secret_store.go Outdated
Comment thread internal/installer/config_template_test.go
Comment thread cli/cmd/template_config.go
Signed-off-by: Tim Schrodi <tim@codesphere.com>
@schrodit
schrodit requested a review from joka134 June 2, 2026 19:00
Signed-off-by: schrodit <7979201+schrodit@users.noreply.github.com>
Comment thread NOTICE

@joka134 joka134 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🚀 Nice!

@schrodit
schrodit merged commit a85bc5f into main Jun 3, 2026
6 checks passed
@schrodit
schrodit deleted the config-template branch June 3, 2026 06:57
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