feat: add help, init, completion and conf-file URL resolution #6

Merged
benvin merged 5 commits from benvin/encapic-init-help into main 2026-11-08 17:54:07 +11:00
Member

encapic only reads ENCAPI_URL from the environment or the shim, so operators have no per-user config, help or completion, and a set-testing host stays in testing until the next terragrunt-enc apply.

  • add help, init (writes the user conf, defaulting to https://encapi.k8s.syd1.au.unkin.net, offers completion) and completion bash|zsh [--install]
  • add unset-testing <certname> restoring the pre-testing environment
  • resolve the URL from env > ~/.config/encapi > /etc/encapi > /etc/encapic conf > compiled default
  • keep the RPM conf at /etc/encapic/encapic.conf (config|noreplace); ship completion scripts
  • print a no-config hint only when stderr is a TTY

unset-testing requires unkin/encapi#11 deployed.

encapic only reads `ENCAPI_URL` from the environment or the shim, so operators have no per-user config, help or completion, and a set-testing host stays in `testing` until the next terragrunt-enc apply. - add `help`, `init` (writes the user conf, defaulting to `https://encapi.k8s.syd1.au.unkin.net`, offers completion) and `completion bash|zsh [--install]` - add `unset-testing <certname>` restoring the pre-testing environment - resolve the URL from env > `~/.config/encapi` > `/etc/encapi` > `/etc/encapic` conf > compiled default - keep the RPM conf at `/etc/encapic/encapic.conf` (`config|noreplace`); ship completion scripts - print a no-config hint only when stderr is a TTY unset-testing requires unkin/encapi#11 deployed.
unkin-agent added 1 commit 2026-11-08 17:19:48 +11:00
feat: add help, init, completion and conf-file URL resolution
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was canceled
70fe2858d0
Author
Member
  • packaging/encapic-enc:6, config.go:18 — the RPM always installs /etc/encapi/encapic.conf (packaged default), and it outranks the puppet-managed /etc/encapic/encapic.conf in both the shim (sourced last) and the binary (checked first). The hiera URL gets silently ignored on every upgraded host, so the legacy fallback never takes effect → drop the conf move from this PR, or give the legacy path precedence until puppet manages the new path.
  • .goreleaser.yaml:53 — moving the config|noreplace dst orphans the old file on upgrade: rpm renames a modified /etc/encapic/encapic.conf to .rpmsave, or deletes it if unmodified, so masters fall back to the packaged default until puppet runs again → keep dst /etc/encapic/encapic.conf, or move it in its own PR after the puppet change lands.
  • config.go:56 — nothing tests the TTY stderr hint, and it is the only new output on the ENC path → add a test that runs the ENC path with no config and a non-TTY stderr and asserts stderr is empty.
  • scope — split into:
    • shared URL resolution + user conf + --help/unknown-flag rejection (the stated why)
    • encapic init
    • encapic completion + RPM completion files
    • /etc/encapic → /etc/encapi path move (not in the why; needs puppet coordination)
  • nit: config.go:14 — initDefaultURL = "https://encapi" differs from the packaged https://encapi.k8s.syd1.au.unkin.net → use the packaged URL.
- packaging/encapic-enc:6, config.go:18 — the RPM always installs `/etc/encapi/encapic.conf` (packaged default), and it outranks the puppet-managed `/etc/encapic/encapic.conf` in both the shim (sourced last) and the binary (checked first). The hiera URL gets silently ignored on every upgraded host, so the legacy fallback never takes effect → drop the conf move from this PR, or give the legacy path precedence until puppet manages the new path. - .goreleaser.yaml:53 — moving the `config|noreplace` dst orphans the old file on upgrade: rpm renames a modified `/etc/encapic/encapic.conf` to `.rpmsave`, or deletes it if unmodified, so masters fall back to the packaged default until puppet runs again → keep dst `/etc/encapic/encapic.conf`, or move it in its own PR after the puppet change lands. - config.go:56 — nothing tests the TTY stderr hint, and it is the only new output on the ENC path → add a test that runs the ENC path with no config and a non-TTY stderr and asserts stderr is empty. - scope — split into: - shared URL resolution + user conf + `--help`/unknown-flag rejection (the stated why) - `encapic init` - `encapic completion` + RPM completion files - `/etc/encapic` → `/etc/encapi` path move (not in the why; needs puppet coordination) - nit: config.go:14 — `initDefaultURL = "https://encapi"` differs from the packaged `https://encapi.k8s.syd1.au.unkin.net` → use the packaged URL.
unkin-agent added 1 commit 2026-11-08 17:22:41 +11:00
fix: keep rpm conf at /etc/encapic and test silent no-config hint
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
9a36da3174
Author
Member
  • config.go:14 — initDefaultURL = "https://encapi" fails TLS (curl: (60) no alternative certificate subject name matches target hostname 'encapi'), so accepting the init default writes a broken conf → default to https://encapi.k8s.syd1.au.unkin.net (update config_test.go:74,97)
  • nit: PR body — "env > … in the binary and the shim" is wrong for the shim: packaging/encapic-enc reads only the two /etc confs, and a sourced conf overrides an inherited ENCAPI_URL → reword to describe what the shim actually does
- config.go:14 — `initDefaultURL = "https://encapi"` fails TLS (`curl: (60) no alternative certificate subject name matches target hostname 'encapi'`), so accepting the `init` default writes a broken conf → default to `https://encapi.k8s.syd1.au.unkin.net` (update config_test.go:74,97) - nit: PR body — "env > … in the binary and the shim" is wrong for the shim: packaging/encapic-enc reads only the two /etc confs, and a sourced conf overrides an inherited `ENCAPI_URL` → reword to describe what the shim actually does
unkin-agent added 1 commit 2026-11-08 17:34:58 +11:00
fix: default init URL to the encapi FQDN the cert covers
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
612874a0c7
Author
Member

No findings.

No findings.
benvin added 2 commits 2026-11-08 17:38:00 +11:00
feat: add unset-testing to restore a node's pre-testing environment
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
d2e9e42e20
Merge pull request 'feat: add unset-testing subcommand' (#7) from benvin/encapic-unset-testing into benvin/encapic-init-help
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
6e7073a830
Reviewed-on: #7
benvin merged commit 027f1453d7 into main 2026-11-08 17:54:07 +11:00
benvin deleted branch benvin/encapic-init-help 2026-11-08 17:54:07 +11:00
This repo is archived. You cannot comment on pull requests.