Skip to content

fix(installer-agent): edit the Installer CR via apply, not strategic-merge patch#70

Merged
braghettos merged 1 commit into
mainfrom
fix/installer-agent-crd-apply
Jun 17, 2026
Merged

fix(installer-agent): edit the Installer CR via apply, not strategic-merge patch#70
braghettos merged 1 commit into
mainfrom
fix/installer-agent-crd-apply

Conversation

@braghettos

Copy link
Copy Markdown
Owner

Root cause

The autopilot/installer-agent install flow failed silently: every attempt to enable features on the live Installer CR returned only exit status 1. Traced to the agent prompt instructing CR edits via k8s_patch_resource, whose kagent tool emits a strategic-merge patch (no --type). The apiserver rejects strategic-merge for every CustomResource:

error: application/strategic-merge-patch+json is not supported by
composition.krateo.io/v0-2-105, Kind=Installer: the body of the request was in an
unknown format - accepted: application/json-patch+json, application/merge-patch+json,
application/apply-patch+yaml

RBAC, CR health, webhooks were all fine — the Installer CR even carries a last-applied-configuration annotation, confirming prior installs set features via helm/kubectl apply, never the agent's strategic-merge path. This was the first time the agent itself drove it end-to-end, exposing the documented-but-impossible mechanism.

Change

  • Prompt (eng + ita): rewrite the CR-edit mechanism to the CRD-safe path — k8s_get_resource_yaml → set field(s) → k8s_apply_manifest of the complete manifest (apply performs a merge the CRD accepts; full spec re-applied so no field is dropped). Soften conceptual "patch" verbs to "set"/"apply".
  • krateo-installer-agent chart 0.1.80.1.9, re-pinned in the umbrella.

Upstream fix

Root cause also fixed upstream in kagent-dev/tools#62 (adds a patch_type parameter so k8s_patch_resource can do --type=merge). Once that ships in the deployed tool server, the prompt can revert to a surgical merge patch.

🤖 Generated with Claude Code

…merge patch

The installer-agent prompt instructed editing the Installer CR with
k8s_patch_resource. kagent's k8s_patch_resource emits a strategic-merge
patch (no --type), which the apiserver rejects for every CustomResource:

  error: application/strategic-merge-patch+json is not supported by
  composition.krateo.io/v0-2-105, Kind=Installer ...

So the documented agent-driven install could never work through the
agent — it only ever worked via helm-apply or operator kubectl. Rewrite
the prompt (eng + ita) to the CRD-safe mechanism: k8s_get_resource_yaml
-> set field(s) -> k8s_apply_manifest of the COMPLETE manifest (apply
performs a merge the CRD accepts; full spec re-applied so no field is
dropped). Soften the conceptual "patch" verbs to "set"/"apply".

Bump krateo-installer-agent chart 0.1.8 -> 0.1.9 and re-pin in the
umbrella. Upstream root-cause fix tracked in kagent-dev/tools#62
(adds patch_type=merge); revert to a merge patch once that ships.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@braghettos
braghettos merged commit dcc7b19 into main Jun 17, 2026
1 check passed
@braghettos
braghettos deleted the fix/installer-agent-crd-apply branch June 17, 2026 21:27
braghettos added a commit that referenced this pull request Jul 24, 2026
…-ns types) (#215)

portal 1.5.80 -> 1.5.81: compositions-list adds a namespaced krateo-blueprints discovery step so a
namespace-scoped tenant's own composition lists. Widget-CR only, no frontend-crd bump. No-op on
non-tenant benches (crdsBlueprints 404s → continueOnError → union degrades to krateo-system).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
braghettos added a commit that referenced this pull request Jul 24, 2026
… UAF migration) (#216)

portal 1.5.81 -> 1.5.82: composition-detail/-resources/-events discover types via UAF'd CD list
(no more caller-token cluster-wide CRD list → blank detail for tenants); compositions-list migrated
to the same UAF pattern. Widget-CR only. No-op on non-tenant benches.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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