Skip to content

feat(vault-auth): migrate to crossplane v2 + opentofu via fn-kcl#65

Merged
patrick-hermann-sva merged 1 commit intomainfrom
feat/vault-auth-v2-opentofu
Apr 13, 2026
Merged

feat(vault-auth): migrate to crossplane v2 + opentofu via fn-kcl#65
patrick-hermann-sva merged 1 commit intomainfrom
feat/vault-auth-v2-opentofu

Conversation

@patrick-hermann-sva
Copy link
Copy Markdown
Contributor

Summary

Replaces the legacy tf.upbound.io + function-go-templating implementation of bootstrap/vault-auth with a Crossplane v2 namespaced composition that delegates rendering to the xplane-vault-auth KCL module (pulled from OCI by function-kcl).

Source pinned: oci://ghcr.io/stuttgart-things/xplane-vault-auth:0.3.1

Changes

  • XRD (apis/definition.yaml): apiextensions.crossplane.io/v1v2, scope: Namespaced, all fields camelCase, new backendConfig / kubernetesHost / boundServiceAccountNames fields.
  • Composition (apis/composition.yaml): single function-kcl step + function-auto-ready. No more inline HCL.
  • Provider: provider-terraformupbound/provider-opentofu:v1.0.3.
  • ProviderConfig: tf.upbound.io/v1beta1 ProviderConfigopentofu.m.upbound.io/v1beta1 ClusterProviderConfig.
  • Vault token Secret: plain HCL terraform.tfvars, co-located with the XR namespace (v2 secretKeyRef is namespace-local; previous JSON + cross-namespace ref is gone).
  • examples/function.yaml: function-go-templatingfunction-kcl + function-auto-ready.
  • README rewritten with new spec table + migration notes.
  • Removed stale claim variants and tf.upbound.io-era test workspaces.

Breaking changes (claim shape)

  • cluster_nameclusterName, vault_addrvaultAddr, k8s_authsk8sAuths, token_policiestokenPolicies, token_ttltokenTtl
  • per-auth namespace field replaced by boundServiceAccountNamespaces[]
  • cross-namespace secretRef removed; Vault token Secret must live in the XR's namespace
  • providerConfigRef split into providerConfigName + providerConfigKind

See examples/claim.yaml for the new shape.

Test plan

  • KCL module renders correctly for both plain + backendConfig shapes (verified in the kcl repo)
  • Apply XRD + Composition against a Crossplane v2 cluster with provider-opentofu installed
  • Apply examples/claim.yaml and confirm Workspaces reach Ready
  • Verify the Vault auth backend is reachable (e.g. vault login -method=kubernetes ...)

Generated with Claude Code

Replaces the v1 / provider-terraform / go-templating implementation with
a Crossplane v2 namespaced composition that delegates rendering to the
xplane-vault-auth KCL module (pulled from OCI by function-kcl):

  source: oci://ghcr.io/stuttgart-things/xplane-vault-auth:0.3.1

Changes:
- XRD: apiextensions.crossplane.io/v1 -> v2, scope: Namespaced, all
  fields renamed to camelCase, new backendConfig + kubernetesHost +
  boundServiceAccountNames fields.
- Composition: single fn-kcl step + fn-auto-ready, no more inline HCL.
- Provider: provider-terraform -> upbound/provider-opentofu:v1.0.3.
- ProviderConfig: tf.upbound.io/v1beta1 -> opentofu.m.upbound.io/v1beta1
  ClusterProviderConfig.
- Vault token Secret: plain HCL terraform.tfvars, co-located with the
  XR namespace (v2 secretKeyRef is namespace-local).
- function.yaml: replaced function-go-templating with function-kcl +
  function-auto-ready.
- README rewritten, stale examples + tests removed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@patrick-hermann-sva patrick-hermann-sva merged commit ae7ba48 into main Apr 13, 2026
@patrick-hermann-sva patrick-hermann-sva deleted the feat/vault-auth-v2-opentofu branch April 13, 2026 17:51
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.

1 participant