Migration from Anvil Primaris
The standalone controller preserves
control.anvil.hazyforge.io/v1alpha1. Existing resources, status, Jobs,
ConfigMaps, PVCs, labels, and owner references do not require conversion.
Safety rule
Never run the embedded and standalone agent reconcilers at the same time. They use the same watches and child-object names. Leader election does not protect against two deployments that use different election IDs.
Handoff
- Back up the twelve agent CRDs and all agent custom resources.
- Record the embedded controller replica count and confirm there are no unexpected terminating runs.
- Stage the standalone release with
crds.install=trueand zero replicas while the old chart still renders the legacy CRDs. This applies the schema superset and the chart's Helm and Argo retention annotations without starting a second reconciler. - Verify the seven existing CRD UIDs did not change, the three composition
CRDs,
AdverseSignal, andAgentAuthSessionCRDs exist, and all twelve CRDs carryhelm.sh/resource-policy: keepandargocd.argoproj.io/sync-options: Prune=false. - Deploy the Anvil Primaris version where the embedded agent registrations and legacy CRD templates are removed. Do not delete the CRDs first.
- Confirm that rollout is complete, then start
anvil-agentswith one replica and leader election enabled. - Verify existing runs, schedules, controls, profiles, adverse streams, and data volumes reconcile without child duplication.
- Keep the standalone chart as the sole CRD delivery source after handoff.
Profile composition migration
Existing inline AgentRunProfile.spec.harness fields remain valid in v1alpha1.
Migrate incrementally rather than rewriting every run at cutover:
- Create an
AgentHarnessProfilein each consuming namespace with the profile's backend, image, ServiceAccount, credential refs, data volumes, placement, and resource settings. - Create one or more
AgentSkillSetobjects for reusable skills and delegated personas. CreateAgentToolSetobjects for independently owned tools. Keep role intent and standing policy in the run profile. - Add
harnessProfileRef,skillSets.refs, andtoolSets.refsto the existing run profile. - Remove migrated inline runtime and capability fields after a canary run
reports the expected
status.resolvedCompositionrefs and digests. - Test a run-local harness swap. Verify the replacement Job contains only the new harness profile's provider credentials, storage, and identity.
Profile-inline runtime fields overlay the profile-selected harness for
compatibility. They are skipped during a run-local harness swap to prevent old
provider credentials from leaking into the replacement. Legacy inline skills,
tools, and subagents remain a final overlay even with skillSets.mode: Replace
or toolSets.mode: Replace; remove them when a clean replacement is required.
Client and stream migration
The read-only anvil-agents-api can be enabled before the reconciler handoff.
It has a separate ServiceAccount and cannot mutate runs, Jobs, or other cluster
objects. This lets browsers, mobile clients, and operator tools move away from
Hub AgentRun projections and direct kubectl logs independently of the
controller cutover.
- Register a distinct
anvil-agentsAPI audience with the existing OIDC issuer. Keep the existing login client if it can request that audience, but ensure the audience is not the login client's own client ID. - Add explicit authorization bindings for the existing read role. A temporary
anvil_primaris_adminbinding can preserve administrative access, but it must still list permissions and namespaces explicitly. - Enable the API while the standalone controller remains at zero replicas if the embedded reconciler is still active.
- Expose the API on its own HTTPS hostname. The optional HTTPRoute expects TLS at its parent Gateway; never send access tokens over plaintext HTTP.
- Obtain a newly minted signed JWT access token. For ZITADEL, configure Access Token Type as JWT first; opaque and JWE tokens are unsupported. Verify list, detail, and live SSE access with a read-only user and confirm a user outside the configured namespace binding receives a denial.
- Move
anvilctl, browser, and mobile consumers to the standalone endpoint. Token acquisition remains in the existing OIDC client; the API only validates access tokens. - Retire the old AgentRun projection after clients are migrated. Leave unrelated Hub build, release, and mutation-policy surfaces intact.
The streaming API does not authorize run creation, approval, cancellation, repository mutation, or delivery. Those operations remain behind the existing policy broker. See live-agent-run-stream.md for the full provider-neutral configuration and access-token contract.
Keep the initial safe stage in the consumer deployment: replicaCount: 0,
crds.install: true, and immutable references for the controller plus six
runner images before scaling the controller. This repository retains Hazy
Forge's optional consumer values and manifests under
.hazyforge/clusters/anvil-primaris/. The Anvil Primaris repository owns the
supporting remote ApplicationSet discovery under
manifests/bases/argocd-remote-apps and its cluster instance configuration.
Neither layer is a portable runtime prerequisite. Other consumers should keep identity,
credentials, routes, storage, placement, image pins, and application policy in
their own deployment layer.
Storage compatibility
Do not delete AgentDataVolume resources or their PVCs during migration. The
standalone controller adopts existing claims. When a legacy resource did not
declare storageClassName, its existing PVC class remains authoritative.
Archive compatibility
Point ANVIL_AGENTS_ARCHIVE_DATABASE_URL at the existing Postgres database to
continue using historical terminal archives. The table name remains
anvilhub_agent_run_archives for data compatibility; no Hub package or service
is required. New archive status also retains the historical
store: anvilhub-postgres identifier for client compatibility; the identifier
does not imply a runtime dependency on Anvil Hub.
Rollback
Stop anvil-agents before restoring an embedded controller version. Keep the
CRDs and custom resources installed. A controller rollback must never be
implemented by deleting CRDs, runs, or PVCs.