Skip to content

feat: krbctl CLI — interactive compose.yaml and config.json generators - #244

Merged
maansaake merged 14 commits into
mainfrom
copilot/kerberos-cli-foundation
Aug 22, 2026
Merged

feat: krbctl CLI — interactive compose.yaml and config.json generators#244
maansaake merged 14 commits into
mainfrom
copilot/kerberos-cli-foundation

Conversation

Copilot AI commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Adds krbctl, a Cobra-based CLI for scaffolding a Kerberos production deployment, with two interactive commands that prompt for the sections relevant to each operator's setup.

krbctl compose [-o compose.yaml]

Generates a compose.yaml via four yes/no prompts. kerberos is always included; everything else is optional:

  • echo — test backend service
  • observability stack — Prometheus, Grafana, Jaeger; wires OTEL env vars across all services automatically; sets exporters to none when excluded
  • postgres — with health-check; kerberos gains a depends_on condition
  • admin-connector — connector service

krbctl config [-o config.json]

Generates a base config.json through guided prompts:

  • Backend targets (mandatory) — name / host / port, repeats until done; drives the gateway.router.backends array
  • auth (optional) — basic auth section with scheme mappings pre-wired to every declared backend
  • observability (optional) — observability block with runtime metrics enabled
  • persistence (optional) — switches from the SQLite default to a fully populated postgres config block

Structure

cmd/krbctl/
  main.go
  cmd/
    root.go    — Execute(), wires sub-commands
    compose.go — compose generator + promptYesNo helper
    config.go  — config generator + promptBackends/promptString helpers

Cobra was added as the only new dependency (github.com/spf13/cobra v1.9.1). Commands register flags in constructor functions rather than init() to comply with the project linter rules.

Copilot AI changed the title feat: add krbctl CLI with interactive compose and config commands feat: krbctl CLI — interactive compose.yaml and config.json generators Aug 17, 2026
Copilot AI requested a review from maansaake August 17, 2026 09:37
@maansaake
maansaake marked this pull request as ready for review August 17, 2026 19:55
Copilot AI and others added 6 commits August 18, 2026 05:28
Co-authored-by: maansaake <15028979+maansaake@users.noreply.github.com>
…neration

Replace raw bufio.Scanner stdin prompts in krbctl with charmbracelet/huh
interactive forms, providing a polished, navigable TUI experience.

Changes:
- Add charmbracelet/huh dependency
- compose: rewrite all prompts as huh Confirm form groups
- compose: update grafana service mounts to include grafana.ini and
  dashboard JSON files alongside existing provisioning YAMLs
- config: rewrite all prompts (Input, Select, Confirm, MultiSelect)
- config: add observability config section (after kerberos section):
  - MultiSelect for Prometheus scrape targets (kerberos/echo/connector/jaeger)
  - Select for Grafana database backend (postgres/sqlite)
  - Confirm for Grafana anonymous access
  - Generates prometheus.yml, grafana/grafana.ini (slim — [database] +
    [auth.anonymous] only), grafana/grafana-datasources.yml,
    grafana/grafana-dashboards.yml, grafana dashboard JSONs, jaeger.yml
- config: add admin-connector section generating connector.json
- Embed Grafana dashboard JSON files from test/config/grafana/ at build time
- Add unit tests for all new builder functions (12 tests)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The release-assets job in callable-cli.yaml requested contents: write, but
callers (pull-request.yaml, main.yaml) only grant contents: read. A reusable
workflow cannot request more permission than its caller grants, so GitHub
rejected the whole invocation at startup (startup_failure).

Move release asset building into a standalone release-cli.yaml triggered only on
release: published (contents: write), and add Go module + build caching to that
job. callable-cli.yaml now only builds and tests (contents: read).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mr-jeeves
mr-jeeves Bot force-pushed the copilot/kerberos-cli-foundation branch from fda945b to 12a4121 Compare August 18, 2026 05:28
maansaake and others added 3 commits August 22, 2026 11:11
Compose/config form and generation improvements:
- Left-align huh confirm buttons for consistent yes/no rows
- Combine config's fixed prompts into a single navigable multi-group form
  (shift+tab back/forth); keep the dynamic backend loop as its own step
- Replace plain-text "at least one backend" output with inline huh validation
- Offer echo as a router backend up front (echo:15000); allow finishing
  without manual backends when echo is registered
- Per-backend basic auth toggle instead of a single global auth section
- Always enable Kerberos observability; keep obs-STACK file generation as a
  separate, clearly-labeled optional section
- Split admin-connector on/off into its own section; drop the unused
  admin-target-URL prompt
- Replace connector origin input with an allow/deny-all CORS confirm
- Dynamic Prometheus scrape targets: kerberos + jaeger + registered backends
  (backends scraped at :9464), connector auto-added when included
- Hard-code compose ports/versions; drop all env-var injection; use the
  default Prometheus port 9464 for every service
- Trim compose host port publishing to kerberos gw/admin, grafana, jaeger
- Add a shared krbdata volume (/data/krb.db) for Kerberos and the connector
  when Postgres is disabled, with matching persistence config
- Set LOG_VERBOSITY=0 for services that configure it
- Update unit tests to cover the new behavior

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@maansaake
maansaake requested a balanced review from Copilot August 22, 2026 10:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds krbctl, an interactive deployment scaffolding CLI.

Changes:

  • Generates Kerberos configuration and Compose deployments.
  • Embeds observability and connector configuration assets.
  • Adds CLI build, test, install, and release automation.

Reviewed changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
Makefile Adds CLI build and release targets.
go.mod Adds CLI dependencies.
go.sum Records dependency checksums.
test/suites/go.sum Updates test dependency checksums.
cmd/krbctl/main.go Adds the CLI entry point.
cmd/krbctl/cmd/root.go Defines the root Cobra command.
cmd/krbctl/cmd/compose.go Implements Compose generation.
cmd/krbctl/cmd/config.go Implements interactive config generation.
cmd/krbctl/cmd/connectorconfig.go Generates connector configuration.
cmd/krbctl/cmd/obsconfig.go Generates observability configuration.
cmd/krbctl/cmd/assets/jaeger/config-ui.json Provides Jaeger UI settings.
cmd/krbctl/cmd/assets/grafana/prometheus.json Adds a Prometheus dashboard.
cmd/krbctl/cmd/assets/grafana/kerberos_runtime.json Adds a runtime dashboard.
cmd/krbctl/cmd/assets/grafana/kerberos_http.json Adds an HTTP dashboard.
cmd/admin-connector/main.go Logs the connector target.
.github/workflows/callable-cli.yaml Builds and tests the CLI.
.github/workflows/release-cli.yaml Publishes CLI release artifacts.
.github/workflows/pull-request.yaml Runs CLI checks on pull requests.
.github/workflows/main.yaml Runs CLI checks on the main branch.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/krbctl/cmd/config.go
Comment thread Makefile
Comment thread cmd/krbctl/cmd/config.go
Comment thread cmd/krbctl/cmd/config.go
Comment thread cmd/krbctl/cmd/assets/grafana/prometheus.json
Comment thread cmd/krbctl/cmd/compose.go
Comment thread cmd/krbctl/cmd/compose.go
Comment thread go.mod
Comment thread cmd/krbctl/cmd/config.go
@maansaake
maansaake merged commit 3ebee87 into main Aug 22, 2026
17 of 18 checks passed
@maansaake
maansaake deleted the copilot/kerberos-cli-foundation branch August 22, 2026 11:20
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.

3 participants