Skip to content

feat(crossplane): let providers carry env and resources, and slow provider-opentofu down - #164

Merged
patrick-hermann-sva merged 2 commits into
mainfrom
feat/provider-runtime-tuning
Sep 20, 2026
Merged

patrick-hermann-sva merged 2 commits into
mainfrom
feat/provider-runtime-tuning

Conversation

@patrick-hermann-sva

@patrick-hermann-sva patrick-hermann-sva commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Why

Every reconcile of an OpenTofu Workspace is a full tofu init/plan/apply. At the image defaults — --poll=10m per resource, --sync=1h across all of them — the six Workspaces on u26-kind3 (vault-auth and kubeconfig entries for homerun2-test1, seed-labda-1 and schmetterpause-rehearsal1) kept that VM at load 8 on 8 cores, with tofu and the Proxmox provider binary together around 400% CPU, for Vault configuration nobody edits.

The cluster paid for it where it hurts: everything doing leader election lost its lease and restarted, over and over.

Pod Restarts in 39 days
crossplane-rbac-manager 3963
kube-controller-manager 3956
kube-scheduler 3951
openebs-localpv-provisioner 3927
cilium-operator (x2) ~2100

The visible damage was a machinery play failing on rollout gates at random points, and a sops-secrets-operator that reconciled only while it happened to be up (Error retrieving lease lock ... context deadline exceeded).

Change

  • The providers values template gains optional env and resources per provider. A DeploymentRuntimeConfig is now emitted when rbac, env or resources are set; providers that set none render exactly as before (checked: provider-helm's DRC is unchanged).
  • provider-opentofu gets CROSSPLANE_OPENTOFU_PROVIDER_POLL=1h, CROSSPLANE_OPENTOFU_PROVIDER_SYNC=6h and real limits (requests 100m/256Mi, limits 2/2Gi).

env, not args: args in a DeploymentRuntimeConfig replace the image defaults rather than adding to them, and every flag of this provider has an environment variable. The flags and their defaults were read from the running binary (crossplane-opentofu-provider --help), not guessed; --max-reconcile-rate is already 1, so frequency was the only lever.

Checked

helmfile diff against u26-kind3 shows exactly one changed object: the provider-opentofu DRC gains the env and resources block. Nothing else moves.

Not in this PR

The real fix is fewer Workspaces: stuttgart-things/crossplane-configurations#482 replaces the vault-auth ones with provider-vault, which keeps no state and needs no tofu run at all. This is the cheap half that helps today.

🤖 Generated with Claude Code

Update: provider-proxmox-bpg too

Measuring on the VM after the opentofu change showed the larger consumer is provider-proxmox-bpg, an upjet provider that shells out to terraform with the bpg/proxmox binary for every managed resource. Nine Proxmox resources at the default --poll=10m is a terraform run roughly every 70 seconds. It now gets the same treatment: PROVIDER_POLL=1h, PROVIDER_SYNC=6h and limits.

helmfile diff against u26-kind3 now shows two changes: the provider-opentofu DRC gains env and resources, and provider-proxmox-bpg gains a runtimeConfigRef plus its own DRC (it previously used default, so nothing it relies on is lost).

…vider-opentofu down

Every reconcile of a Workspace is a full tofu init/plan/apply. At the image
defaults - poll 10m per resource, sync 1h across all of them - six
Workspaces held u26-kind3 at load 8 on 8 cores, tofu and the Proxmox
provider binary together around 400% CPU, for Vault configuration that does
not change. The cluster paid for it in leader elections:
kube-controller-manager, kube-scheduler, crossplane-rbac-manager and openebs
each restarted ~3950 times in 39 days, and the machinery play failed
intermittently on rollout gates.

provider-opentofu now runs with poll 1h / sync 6h and real limits. The
values template gained optional env and resources for any provider; a
DeploymentRuntimeConfig is emitted when rbac, env or resources are set, so
nothing changes for the providers that set none.

env rather than args: args in a DeploymentRuntimeConfig replace the image
defaults instead of adding to them, and every flag has an env var.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
provider-proxmox-bpg is an upjet provider: every reconcile of a managed
resource shells out to terraform with the bpg/proxmox provider binary. At
the default poll of 10m and nine Proxmox resources on u26-kind3 that is a
terraform run roughly every 70 seconds, and measured on the VM it was the
LARGEST single CPU consumer - larger than provider-opentofu, which this
branch already slowed down.

Same treatment: PROVIDER_POLL 1h, PROVIDER_SYNC 6h and real limits. A VM
that Crossplane itself manages does not drift between polls.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@patrick-hermann-sva
patrick-hermann-sva merged commit 81eae01 into main Sep 20, 2026
3 checks passed
patrick-hermann-sva added a commit to stuttgart-things/ansible that referenced this pull request Sep 20, 2026
…vals) (#1240)

Picks up stuttgart-things/helm#164: provider-opentofu and
provider-proxmox-bpg run with poll 1h / sync 6h and real limits, instead
of the image defaults that kept u26-kind3 at load 8 on 8 cores and made
every leader-election component restart thousands of times.

The only files that differ from 4ba3965 are the crossplane-providers
helmfile and its values template.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
k8s — 33baed31 Deployed Sep 20, 2026 by patrick-hermann-sva via Analyze-Changed-Charts #262
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