Skip to content

fix(bootstrap): sync embedded CRDs from butler-api and guard against drift - #59

Merged
atbagan merged 1 commit into
mainfrom
fix/embedded-crd-drift
Jun 12, 2026
Merged

atbagan merged 1 commit into
mainfrom
fix/embedded-crd-drift

Conversation

@atbagan

@atbagan atbagan commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Problem

The CRDs embedded in butleradm bootstrap (internal/adm/bootstrap/manifests/crds/, go:embed) were a hand-maintained copy with no link to butler-api, the source of truth. Found during the local pull-mode e2e: the embedded providerconfig CRD lacked the credentialsRef CEL (the non-local-requires-creds regression fix from butler-api #46 / chart PR #141).

The cli was never wired into the sync-crds automation that keeps butler-charts current, so the drift was already 8 CRDs deep (networkpools, teams, users, butlerconfigs, identityproviders, tenantclusters, addondefinitions, providerconfigs) and clustercreationpolicies was missing entirely.

Root fix (single source of truth + two guards)

  • hack/sync-crds.sh + make sync-crds: copy CRDs from ../butler-api/config/crd/bases (same source butler-charts uses), prune removed ones.
  • CI crd-drift job: re-runs the sync against a fresh butler-api checkout and fails on any diff — mechanical guard against hand-edits / missed syncs.
  • Companion butlerdotdev/butler-api workflow (sync-crds-to-cli.yaml, separate PR) opens these sync PRs automatically on butler-api CRD changes, exactly like the charts flow.
  • Re-synced all CRDs: 18 total, zero drift vs canonical, CEL present.

Verification (fresh local cluster, the bootstrap path)

butleradm bootstrap local with the rebuilt cli installs the CEL'd providerconfig CRD. 3-direction admission test on the local cluster:

  • local + no creds -> admitted
  • harvester + no creds -> rejected (credentialsRef with a non-empty name is required ...)
  • harvester + creds -> admitted

The regression fix is now enforced on the local path, matching chart-installed clusters.

Note

The companion butler-api workflow needs a CLI_SYNC_PAT secret (write to butler-cli), like CHARTS_SYNC_PAT backs the charts sync.

…drift

The CRDs embedded in `butleradm bootstrap` were a hand-maintained copy with no
link to butler-api, the source of truth. They had drifted across 8 CRDs
(including the providerconfig credentialsRef CEL) and were missing
clustercreationpolicies entirely, because the cli was never wired into the
sync-crds automation that already keeps butler-charts current.

- hack/sync-crds.sh: copy CRDs from butler-api/config/crd/bases, prune removed
- make sync-crds target
- CI crd-drift job: re-sync against butler-api and fail on any diff
- re-sync all CRDs (now 18, zero drift vs canonical, CEL present)

The companion butler-api sync-crds-to-cli workflow opens these PRs automatically.
@atbagan
atbagan merged commit af35be8 into main Jun 12, 2026
2 checks passed
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