Commit Graph

13 Commits

Author SHA1 Message Date
benvin 8322c5480e Merge pull request 'ci: fetch vault from artifactapi instead of dnf install' (#6) from benvin/vault-via-artifactapi into main
ci/woodpecker/push/apply Pipeline was successful
Reviewed-on: #6
2026-08-23 22:42:40 +10:00
unkin-agent 11260a81a4 ci: fetch vault from artifactapi instead of dnf install
ci/woodpecker/pr/plan Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
dnf install reads metadata for every enabled repo and downloads the
vendored vault RPM on every pipeline run. Fetch the pinned upstream zip
from the artifactapi hashicorp-releases remote instead, matching
terraform-vault and terraform-artifactapi.

- Replace dnf install vault with a pinned curl of the vault zip from the
  artifactapi hashicorp-releases remote, extracted to /usr/local/bin.
2026-08-23 22:38:04 +10:00
benvin 420ccd4cfd Merge pull request 'Run plan without acquiring the Consul state lock' (#5) from benvin/lockfree-plan into main
ci/woodpecker/push/apply Pipeline was successful
Reviewed-on: #5
2026-08-23 22:30:44 +10:00
unkin-agent 0ff9f6bf7d Run plan without acquiring the Consul state lock
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/plan Pipeline was successful
PR plan pipelines were failing with "Error acquiring the state lock"
when they collided with a concurrent apply (or another plan) holding
the lock on the same Consul-backed state.

- plan: pass -lock=false to terragrunt plan; apply keeps locking
2026-08-23 22:21:18 +10:00
benvin 7be6a3e6e4 Merge pull request 'Trust internal CA for Rancher OIDC discovery' (#4) from benvin/rancher-oidc-ca into main
ci/woodpecker/push/apply Pipeline was successful
Reviewed-on: #4
2026-07-31 21:20:25 +10:00
unkinben dbd1f6db8a Trust internal CA for Rancher OIDC discovery
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/plan Pipeline was successful
Rancher's server-side OIDC discovery call to the Authentik issuer
(https://identity.unkin.net) fails with x509 "certificate signed by
unknown authority" because Rancher does not trust the internal unkin.net
PKI. The keycloak_oidc auth config never set a CA certificate.

- Read the internal PKI ca_chain (intermediate + root) from Vault via a
  vault_generic_secret data source (pki_int/cert/ca_chain).
- Set certificate on rancher2_auth_config_keycloak_oidc, defaulting to the
  Vault-sourced chain so trust cannot go stale on rotation; add an optional
  keycloakoidc.certificate override for an explicit value.

Issuer, client, scopes and role bindings are unchanged.

Claude-Session: https://claude.ai/code/session_015ur3i7D2azsMAWTSVABApv
2026-07-31 20:30:55 +10:00
benvin 08fbc9b8ab Merge pull request 'Fix global role binding name to be RFC 1123 compliant' (#3) from benvin/rancher-grb-name into main
ci/woodpecker/push/apply Pipeline was successful
Reviewed-on: #3
2026-07-18 22:59:02 +10:00
unkinben f2f41fc1c0 Fix global role binding name to be RFC 1123 compliant
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/plan Pipeline was successful
rancher2_global_role_binding.name must be a lowercase RFC 1123 label, but the
akP-* group keys are mixed-case, so apply failed with InvalidFormat 422.
Lowercase the name; keep the group principal id in original case to match the
Authentik group.
2026-07-18 22:55:38 +10:00
benvin 1dc43580f6 Merge pull request 'Wire Rancher to Authentik ak_groups + akP-rancher global roles' (#2) from benvin/rancher-akgroups into main
ci/woodpecker/push/apply Pipeline failed
Reviewed-on: #2
2026-07-18 20:53:18 +10:00
unkinben 80fa1b2844 Wire Rancher to Authentik ak_groups + akP-rancher global roles
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/plan Pipeline was successful
Consume the two-tier Authentik RBAC (terraform-authentik): read the hierarchical
`ak_groups` claim and grant Rancher global roles to the akP-rancher permission
groups. Members of akR-global-admin/akR-standard-user inherit these.

- keycloakoidc: scopes += ak_groups; groups_field = ak_groups
- global_role_bindings: akP-rancher-admin -> admin, akP-rancher-user -> user
  (group principal keycloakoidc_group://<name>)
2026-07-18 16:25:18 +10:00
benvin 5b6a0527ee Merge pull request 'Scaffold terraform-rancher: Authentik OIDC auth config' (#1) from benvin/scaffold into main
ci/woodpecker/push/apply Pipeline was successful
Reviewed-on: #1
2026-07-16 22:26:13 +10:00
unkinben 90a01563dc Scaffold terraform-rancher: Authentik OIDC auth config
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/plan Pipeline was successful
Manages Rancher's Keycloak(OIDC) auth provider via the rancher2 provider,
pointed at Authentik. Mirrors the terraform-authentik layout (terragrunt +
Vault-sourced secrets + Woodpecker plan/apply/pre-commit pipelines).

- modules/rancher: rancher2_auth_config_keycloak_oidc, client_secret read from
  Vault (kv/kubernetes/namespace/cattle-system/default/oauth-credentials);
  access_mode unrestricted to avoid admin lockout on enable.
- config/keycloakoidc.yaml: issuer/auth_endpoint at identity.unkin.net,
  client_id rancher, /verify-auth redirect, openid/profile/email scopes.
- environments/rancher.k8s.syd1.au.unkin.net: consul state at
  infra/terraform/rancher/, rancher2 provider api_url from the env name.
- rancher2 admin token read from kv/service/terraform/rancher (Makefile);
  to migrate to a dedicated Vault Rancher secrets engine (90-day token cap).

Validated with `tofu validate` (config valid against the rancher2 provider).
A live `plan` needs the Rancher admin API token seeded in Vault first.
2026-07-16 22:21:00 +10:00
gitadmin e21699ede9 Initial commit 2026-07-15 21:24:52 +10:00