Skip to content

Convert service sidecar ctmpl to dynamic KV-backed templates#306

Merged
sehkone merged 1 commit into
mainfrom
sehkone/issue-300
Feb 22, 2026
Merged

Convert service sidecar ctmpl to dynamic KV-backed templates#306
sehkone merged 1 commit into
mainfrom
sehkone/issue-300

Conversation

@sehkone
Copy link
Copy Markdown
Contributor

@sehkone sehkone commented Feb 22, 2026

Summary

  • Transform service agent.toml.ctmpl from static copies into dynamic Go templates with {{ with secret }} directives for http_responder_hmac, trusted_ca_sha256 (via toJSON), and conditional EAB blocks
    - Add vault { address } and template_config { static_secret_render_interval = "30s" } to agent.hcl so OpenBao Agent can connect and periodically re-render
  • Write EAB KV unconditionally (empty strings when unconfigured) so template paths always exist

Test plan

  • cargo clippy --all-targets -- -D warnings passes
  • cargo fmt -- --check passes
  • 5 new unit tests for build_ctmpl_content pass (cargo test --bin bootroot -- service)
  • cargo test --test bootroot_service — 17/17 pass (ctmpl + agent.hcl content assertions added)
  • cargo test --test e2e_same_host_local_file — 4/4 pass (ctmpl + agent.hcl content assertions added)
  • cargo test --test bootroot_rotate — 14/14 pass (no regressions)
  • Docker E2E (./tests/docker/run-e2e.sh main-lifecycle, remote-lifecycle, rotation-recovery)

Closes #300

Service agent.toml.ctmpl files were static copies with no Go template
directives, so OpenBao Agent never picked up rotated secrets from KV.

Transform rendered agent.toml into a proper ctmpl with {{ with secret }}
directives for http_responder_hmac, trusted_ca_sha256 (via toJSON), and
a conditional EAB block guarded by {{ if .Data.data.kid }}.

Add vault { address } block to agent.hcl so OpenBao Agent can connect
to the OpenBao server.

Write EAB KV unconditionally (empty strings when unconfigured) so the
{{ with secret }} path always exists and never blocks.

Closes #300
@sehkone sehkone merged commit 6b43acd into main Feb 22, 2026
13 checks passed
@sehkone sehkone deleted the sehkone/issue-300 branch February 22, 2026 12:21
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.

Convert service sidecar ctmpl to dynamic KV-backed templates

1 participant