Skip to content

📝 Consolidated compositional agent platform design proposal - #770

Merged
pdettori merged 7 commits into
rossoctl:mainfrom
cwiklik:docs/consolidated-design-proposal
Apr 13, 2026
Merged

pdettori merged 7 commits into
rossoctl:mainfrom
cwiklik:docs/consolidated-design-proposal

Conversation

@cwiklik

@cwiklik cwiklik commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds consolidated design proposal for the Kagenti compositional agent platform architecture (docs/design-proposals/consolidated-compositional-agent-platform-design.md)
  • Defines the two-CR model (AgentRuntime + AgentCard) atop a label-and-webhook foundation with layered defaults
  • Documents workload-level explicit opt-in injection (kagenti.io/inject: enabled) replacing namespace-level injection
  • Clearly separates admission-time configuration concerns from reconfiguration of running workloads
  • Establishes ownership model: platform engineers own defaults (ConfigMaps), developers own AgentRuntime and AgentCard CRs
  • Documents two independent pods: Kagenti Webhook Pod (kagenti-webhook-system) and Kagenti Operator Pod
  • Captures open questions, risks, implementation horizons (short-term vs long-term), and unresolved design decisions

Key Design Decisions

  • Injection trigger: workload label kagenti.io/inject: enabled (current); CR-trigger alternative is an open question requiring further discussion
  • Defaults storage: kagenti-webhook-feature-gates and kagenti-webhook-defaults ConfigMaps (short-term); AgentRuntimeClusterConfig / AgentRuntimeConfig CRDs planned for long-term
  • Webhook targeting: Deployment/StatefulSet objects (current); pod-level targeting planned long-term for GitOps/CD compatibility
  • Dynamic reconfiguration: supported where possible; sidecar image and init container changes require pod restarts

Test plan

  • Review document for accuracy against current implementation
  • Verify open questions are correctly framed
  • Confirm ownership model (developer vs platform engineer) is consistent throughout


- The CR is the single authoritative declaration of "this is an agent" or "this is a tool"
- The label becomes a derived artifact managed by the controller (useful for selectors, UI queries, AgentCard discovery)
- If Argo CD's self-heal removes the label, the operator re-applies it on next reconcile -- no conflict because the operator is the owner

@amfred amfred Mar 4, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to avoid reconciliation loops completely?
I thought I heard that if the label is on the Pod instead of the Deployment, for example?
(NB: I'm not an expert in this. But I do know that infinite reconcile loops are a problem. Otherwise Argo will never show the agent as fully "deployed".)


### 4. Make `kagenti.io/type` Label Operator-Managed

**Current design**: Developer must set `kagenti.io/type: agent|tool` on the workload.

@amfred amfred Mar 4, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, if we want to have multiple A2A agents within a single pod, would it really be the Route that we need to key off of for the AgentCard creation?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those agents would end up with one SPIFFE identity too...

You can resolve this comment, just something to think about.

@rhuss

rhuss commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for the consolidation, this is a solid piece of work. I'm supportive of the overall direction and don't want to block the PR. Two CRs (AgentRuntime + AgentCard), composition over inheritance, layered defaults, all good. A few things that I would still address though:

Label-based injection: acknowledged, one remaining concern

I've shared my perspective on label-triggered vs. CR-triggered injection previously. We've agreed to move forward with labels, so I won't rehash the full argument. One thing worth noting for the record: the label approach does require developers to modify their Deployment for what is fundamentally a platform concern (identity injection). That's the ownership inversion we originally wanted to avoid. Not a blocker, but something to keep in mind as the design evolves.

Namespace gating deserves a second look

The original proposal and @pdettori consolidated summary both included a namespace label (kagenti.io/injection: enabled) as a prerequisite. This PR drops it. The practical consequence: the webhook's objectSelector now matches across all namespaces, meaning the API server evaluates every Deployment, StatefulSet, Job, and CronJob creation against the webhook selector, cluster-wide.

That's a non-trivial compute cost on busy clusters. With a namespace label, the webhook configuration can use namespaceSelector to limit which namespaces even trigger the webhook call. Without it, every workload admission in every namespace hits the selector check, even if that namespace has nothing to do with agents. On clusters with hundreds of namespaces and frequent workload churn, this adds up.

Beyond performance, there's an access control angle: without namespace gating, any developer in any namespace can trigger SPIFFE identity provisioning and IdP registration by adding a label. A namespace opt-in gives platform engineers explicit control over where agent infrastructure is available.

I'd suggest reconsidering the namespace label, at least as an optional optimization that the webhook respects when present.

CRD spec: what ships in v1alpha1?

The full AgentRuntime spec covers a lot of ground (SPIFFE, Keycloak-specific client registration, destination rules, GenAI capture, MLflow integration). Can we mark which sections are "Phase 1" vs. aspirational? A lean v1alpha1 reduces the validation surface and keeps the CRD well within etcd limits.

Webhook should target Pods, not workload objects

Targeting Deployments/StatefulSets causes GitOps drift (Argo CD sees injected sidecars as configuration changes). Istio, Linkerd, and Vault Agent Injector all target Pods at CREATE time for this reason. The document lists this as "long-term" but for Summit demos with GitOps users, this will cause friction. Worth prioritizing.

I really would recommend to reconsider this from the very beginning as this is a crucial aspect to ensure that the original workload is not modified.

AgentRuntime deletion should revert to defaults

For Open Question #3: deleting the CR should mean "revert to platform defaults," not "remove identity infrastructure." The sidecars are already injected. Removing identity should require removing the type label and restarting the workload.

Future enhancements belong in a separate document

The long-term section (mandatory AgentRuntime CR, CR-triggered injection, operator-managed labels, pod-level targeting) is substantial enough to warrant its own design doc. Bundling it here blurs what's being proposed now vs. what's planned later. A separate document would also be the right place to spell out concrete migration paths, since each of those changes affects every deployed agent.

One question on the future plans: if the direction is to make AgentRuntime mandatory and switch the injection trigger to CR existence, what's the reasoning for not starting there now? The CR-aware webhook approach preserves admission-time guarantees while avoiding the migration. If we're confident that's where we're heading, building the intermediate label-based system adds a migration step we could skip.

Minor points

  • reinvocationPolicy: Risks section says IfNeeded, webhook YAML says Never. Should be consistent.
  • Sidecar count: 4 injected containers per Pod is visible in demos. Worth tracking the consolidation plan explicitly.
  • Config propagation: xDS for Envoy is clear. Mechanism for other sidecars (spiffe-helper, client-registration) is TBD and should be flagged as a gap.

@cwiklik

cwiklik commented Mar 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @rhuss for the thorough review, and @amfred for the questions on reconciliation loops, multi-agent pods, and SPIFFE identity sharing. All valid points.

I'd like to propose scoping an MVP (Minimum Viable Product) — implementation complete by early April. The goal is to get sign-off on what we build now vs. what we defer to a separate design doc.

MVP scope (early April)

# Feature Status Notes
1 Webhook targets Pods at CREATE time NEW Adopting @rhuss's recommendation to do this from the start rather than building Deployment-level targeting and migrating later. Istio, Linkerd, and Vault Agent Injector all target Pods for exactly the reasons raised — no GitOps drift, original workload manifests stay clean. This also addresses @amfred's reconciliation loop concern with Argo CD.
2 CR-triggered injection via controller-managed labels NEW AgentRuntime CR is mandatory. The developer deploys a standard workload without kagenti labels. The developer creates an AgentRuntime CR with targetRef pointing to the workload. The controller sees the CR and applies kagenti.io/type: agent|tool to the Deployment's PodTemplateSpec. This label change triggers a rolling update — new Pods are created, and the admission webhook injects sidecars at Pod CREATE time. Developer workloads stay completely clean. objectSelector on the webhook means only labeled workloads hit the webhook — no cluster-wide performance cost.
3 Opt-out via kagenti.io/inject: disabled Existing Developer can suppress injection while keeping type classification.
4 Optional namespace gating NEW Add namespaceSelector support so platform engineers can require kagenti.io/injection: enabled on namespaces. Off by default (current behavior preserved), but available as an access control mechanism — addresses the concern that any developer in any namespace can trigger SPIFFE provisioning by adding a label.
5 ConfigMap-based defaults Existing kagenti-webhook-feature-gates + kagenti-webhook-defaults. No CRD hierarchy.
6 Lean AgentRuntime v1alpha1 CRD NEW Scoped to: targetRef, identity (SPIFFE + client registration basics), trace (OTEL endpoint + sampling). Defers: MLflow integration, Prometheus metrics, GenAI capture, destination rules, per-exporter compression. Keeps the validation surface small and well within etcd limits per @rhuss's recommendation.
7 AgentCard CR Existing Unchanged from current implementation.
8 AgentRuntime deletion reverts to defaults NEW Per @rhuss: deleting the CR means "revert to platform defaults," not "remove identity infrastructure." The controller uses a finalizer to handle deletion: preserves the kagenti.io/type label, updates the kagenti.io/config-hash annotation (now reflecting defaults only), which triggers a rolling update. New pods get sidecars injected with platform defaults.

CR-triggered injection — how it works

The design uses both the controller and the admission webhook together:

The sequence

  1. Developer deploys a standard workload — no kagenti labels in the manifest
  2. Developer creates an AgentRuntime CR with targetRef pointing to the workload
  3. Controller sees the AgentRuntime CR → applies kagenti.io/type: agent|tool label and a kagenti.io/config-hash annotation (hash of CR + platform defaults) to the Deployment's PodTemplateSpec. May also apply labels to the Deployment itself for UI/TUI/API discovery.
  4. PodTemplateSpec change triggers a rolling update — Kubernetes admission control fires for both the Deployment update and the resulting Pod creates
  5. Webhook intercepts Pod CREATE → injects sidecars with configuration from the AgentRuntime CR + platform defaults

Config hash — one mechanism for create, update, and delete

The controller maintains a kagenti.io/config-hash annotation on the PodTemplateSpec, computed from the resolved configuration (AgentRuntime CR merged with platform defaults). Any configuration change updates the hash, which triggers a rolling update:

Event What controller does Rolling update? Webhook behavior
AgentRuntime created Adds label + config-hash Yes Injects with CR config
AgentRuntime updated Updates config-hash Yes Injects with updated config
AgentRuntime deleted Finalizer fires: preserves label, updates config-hash to defaults-only Yes Injects with platform defaults

On deletion, the AgentRuntime CR carries a finalizer (kagenti.io/cleanup). The controller preserves the kagenti.io/type label, updates the config-hash to reflect defaults only, then removes the finalizer. The workload stays classified as an agent and continues to receive identity infrastructure — just with default configuration.

Kubernetes admission mechanics

Adding a label to a PodTemplateSpec within a Deployment triggers admission control at two levels:

  • Deployment admission: The API request to update the Deployment is intercepted by admission webhooks configured for deployments
  • Pod admission: The PodTemplateSpec change triggers a rolling update — as the Deployment controller creates new Pods, each Pod creation request is intercepted by admission webhooks configured for pods

GitOps compatibility (Argo CD)

The controller modifies the Deployment's PodTemplateSpec (adding labels and config-hash annotation). Argo CD will detect this as drift from the Git-stored manifest and may attempt to revert it. This is a known pattern — any operator that manages labels on workloads it doesn't own faces the same issue (Istio, KEDA, etc.).

Mitigation: Server-Side Diff (Argo CD v2.5+)

Argo CD's server-side diff feature uses structured merge patch (SSA) semantics to distinguish between fields owned by different managers. When enabled, Argo CD recognizes that the kagenti.io/type label and kagenti.io/config-hash annotation are owned by the Kagenti controller, not by the Git manifest, and excludes them from drift detection.

Configuration:

apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
  ignoreDifferences:
    - group: apps
      kind: Deployment
      jqPathExpressions:
        - .spec.template.metadata.labels."kagenti.io/type"
        - .spec.template.metadata.annotations."kagenti.io/config-hash"

Or cluster-wide via argocd-cm ConfigMap:

data:
  resource.customizations.ignoreDifferences.apps_Deployment: |
    jqPathExpressions:
      - .spec.template.metadata.labels."kagenti.io/type"
      - .spec.template.metadata.annotations."kagenti.io/config-hash"

This is the same approach used for Istio sidecar injection labels and Vault Agent annotations. Documentation for this Argo CD configuration will be included in the install guide.

What this gives us

  • Developer workloads stay clean — no kagenti labels required from developers (addresses @rhuss's ownership inversion concern)
  • AgentRuntime CR is the single source of truth — for both injection trigger and configuration
  • Admission-time security guarantee — sidecars are injected at Pod CREATE, no race window
  • Auditability — kubectl get agentruntime -A shows all enrolled workloads
  • AgentRuntime CR deleted → controller preserves label, updates config-hash → rolling update redeploys with platform defaults
  • Works with GitOps — webhook targets Pods (not Deployments), so no drift in the Deployment manifest stored in Git

Deferred to separate design doc

Per @rhuss's suggestion, the long-term enhancements are substantial enough to warrant their own document. This includes:

  • Layered CRD defaults (AgentRuntimeClusterConfig / AgentRuntimeConfig) — ConfigMaps are sufficient for now
  • xDS config propagation — ConfigMap volume mounts sufficient for MVP
  • Sidecar consolidation (4 containers → fewer)

Note: mandatory AgentRuntime CR and operator-managed labels are now in the MVP scope (see #2 above), not deferred.

Doc fixes (will update in this PR)

  • Fix reinvocationPolicy inconsistency (Risks section says IfNeeded, webhook YAML says Never)
  • Move pod-level webhook targeting from "long-term" to "short-term/MVP"
  • Add namespace gating as optional feature
  • Trim AgentRuntime CRD spec to v1alpha1 scope
  • Rewrite injection model: CR-triggered via controller-managed labels, mandatory AgentRuntime CR
  • Document the admission mechanics (PodTemplateSpec label → rolling update → Pod CREATE → webhook)
  • Flag config propagation mechanism for non-Envoy sidecars as an open gap
  • Track sidecar consolidation plan explicitly

@rhuss @amfred — does this MVP scope look right to you? Any features missing or items that should move between MVP and deferred?

@pdettori pdettori left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Document vs Comments Alignment Check

The latest commit (6db115d, March 10) substantially addresses the review feedback from @rhuss and @amfred. The document has been rewritten to reflect the MVP scope proposed in the March 6 comment.

Feedback Incorporation Summary

# Reviewer Feedback Status
1 @rhuss reinvocationPolicy inconsistency ✅ Fixed — both YAML and Risks now say IfNeeded
2 @rhuss Namespace gating ✅ Fixed — optional kagenti-enabled: "true" namespaceSelector
3 @rhuss Webhook should target Pods ✅ Fixed — moved to short-term, Pod CREATE targeting throughout
4 @rhuss Lean v1alpha1 CRD ✅ Fixed — scoped to targetRef, identity, trace
5 @rhuss AgentRuntime deletion reverts to defaults ✅ Fixed — finalizer-based, reverts to platform defaults
6 @rhuss Future enhancements in separate doc ⚠️ Partial — long-term section trimmed, items moved to short-term, but not fully separated
7 @rhuss Sidecar count tracking ✅ Fixed — new "Sidecar Consolidation Plan" section
8 @rhuss Config propagation for non-Envoy sidecars ✅ Fixed — explicitly flagged as open gap
9 @amfred Reconciliation loops ✅ Fixed — Pod-level targeting eliminates the concern
10 @amfred Multiple A2A agents in single pod / Route-based AgentCard ⚠️ Not addressed (noted as "just something to think about")
11 @amfred Shared SPIFFE identity for multi-agent pods ⚠️ Not addressed (noted as "just something to think about")

Overall the document is in good shape. See inline comments for remaining suggestions.

cwiklik and others added 7 commits March 13, 2026 10:06
…nership

- Change short-term injection model: agents injected by default via
  kagenti.io/type: agent label; tools require feature gate; opt-out
  via kagenti.io/inject: disabled; no namespace label needed
- Rewrite Long-Term section with 5 numbered directions from design
  review: mandatory AgentRuntime CR, CR-trigger injection, drop layered
  CRD hierarchy, operator-managed type label, pod-level webhook targeting
- Clarify AgentRuntime is developer-owned (not platform engineer)
- Separate webhook pod from operator pod in Controller Architecture
- Add Two Distinct Configuration Concerns section (admission-time vs
  reconfiguration of running workloads)
- Add Open Question rossoctl#5: label vs CR injection trigger with YAML examples
- Add Risk 5: multiple webhook ordering conflicts
- Qualify pod-restart claims throughout document
- Update ConfigMap defaults with actual kagenti-webhook-feature-gates
  and kagenti-webhook-defaults content

Co-authored-by: Claude <[email protected]>
Signed-off-by: cwiklik <[email protected]>
Replace all references to kagenti.io/inject: enabled as the injection
trigger with the current model: kagenti.io/type: agent triggers injection
by default; kagenti.io/inject: disabled to opt out.

Changes across the document:
- Summary/Abstract, Architecture at a Glance, Two-Layer diagram
- Background (Prior Proposals, Key Disagreements table)
- User Stories, Goals, Non-Goals
- Labels table and section (single label model, opt-out pattern,
  updated YAML example, rewritten ownership rationale)
- Cardinality scenarios table (added opt-out row)
- Webhook objectSelector YAML (type:agent + inject:disabled exclusion)
- Webhook decision logic tree, behavior steps, note
- Migration YAML example
- Pattern comparison table
- Pros/Cons (rossoctl#1 in each updated)
- Open Question rossoctl#4 (type-label-trigger vs CR-trigger)
- Long-Term section item 2 and migration table

Co-authored-by: Claude <[email protected]>
Signed-off-by: cwiklik <[email protected]>
The platform engineer story referenced kagenti.io/type: agent label
which is set by developers, not platform engineers. Reworded to express
the policy outcome: any workload classified as an agent should be
automatically secured, without developers needing to understand the
injection mechanism.

Co-authored-by: Claude <[email protected]>
Signed-off-by: cwiklik <[email protected]>
- Fix reinvocationPolicy inconsistency (Never → IfNeeded in webhook YAML)
- Move pod-level webhook targeting from long-term to short-term/MVP
- Add optional namespace gating (kagenti-enabled: "true" namespaceSelector)
- Trim AgentRuntime CRD spec to v1alpha1 scope (targetRef, identity, trace)
- Rewrite injection model: CR-triggered via controller-managed labels
- Document admission mechanics (PodTemplateSpec label → rolling update → webhook)
- Flag non-Envoy config propagation as open gap
- Add explicit sidecar consolidation plan
- Update checklist with completed implementation items
- Update examples, diagrams, and tables throughout

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: cwiklik <[email protected]>
- Add future consideration note for multi-agent-per-pod scenario and
  Route-based AgentCard keying (raised by @amfred)
- Note that long-term items may move to a separate design doc per
  @rhuss suggestion

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: cwiklik <[email protected]>
@cwiklik
cwiklik force-pushed the docs/consolidated-design-proposal branch from 9dc35f4 to 832f777 Compare March 13, 2026 14:06
@grs

grs commented Mar 16, 2026

Copy link
Copy Markdown

To me, if the creation of the CR triggers injection, I would expect the deletion of the CR to undo that.

Having deletion of the CR revert to default configuration makes sense to me only if the CR itself is merely configuring and not triggering injection.

@grs

grs commented Mar 16, 2026

Copy link
Copy Markdown

To me, if the creation of the CR triggers injection, I would expect the deletion of the CR to undo that.

A possible solution that would be more intuitive in my view would be to not have the CR trigger rollout. The webhook would inject based on whether a CR exists that covers the pod being created. Existing pods would not be affected either by creation or deletion of the CR. Rather, an explicit rollout would be required after any CR change in order for it to take effect.

@grs

grs commented Mar 16, 2026

Copy link
Copy Markdown

To me, if the creation of the CR triggers injection, I would expect the deletion of the CR to undo that.

A possible solution that would be more intuitive in my view would be to not have the CR trigger rollout. The webhook would inject based on whether a CR exists that covers the pod being created. Existing pods would not be affected either by creation or deletion of the CR. Rather, an explicit rollout would be required after any CR change in order for it to take effect.

This would also avoid any conflict with gitops controllers over the original workload.

@cwiklik

cwiklik commented Mar 16, 2026 •

Copy link
Copy Markdown
Contributor Author

To me, if the creation of the CR triggers injection, I would expect the deletion of the CR to undo that.

Having deletion of the CR revert to default configuration makes sense to me only if the CR itself is merely configuring and not triggering injection.

The default is to inject AuthBridge with default configuration. The override is AgentRuntime. If that gets deleted, the pod reverts to defaults.

@grs

grs commented Mar 16, 2026

Copy link
Copy Markdown

The default is to inject AuthBridge with default configuration. The override is AgentRuntime. If that gets deleted, the pod reverts to defaults.

The second item in the MVP is described as 'CR-triggered injection via controller-managed labels' and the notes state 'AgentRuntime CR is mandatory', then describe how the creation of the CR causes a chain of events that results in the injection of additional containers by the webhook.

@cwiklik

cwiklik commented Mar 16, 2026

Copy link
Copy Markdown
Contributor Author

The default is to inject AuthBridge with default configuration. The override is AgentRuntime. If that gets deleted, the pod reverts to defaults.

The second item in the MVP is described as 'CR-triggered injection via controller-managed labels' and the notes state 'AgentRuntime CR is mandatory', then describe how the creation of the CR causes a chain of events that results in the injection of additional containers by the webhook.


Here is the End-to-End Flow

  1. Developer deploys a standard Deployment (no kagenti labels). Pods run normally without sidecars.
  2. Developer creates an AgentRuntime CR with targetRef pointing to the Deployment.
  3. The AgentRuntime controller reconciles: resolves the targetRef, computes a config-hash from the CR spec merged with ConfigMap defaults, and patches the Deployment's PodTemplateSpec with
    kagenti.io/type: agent and kagenti.io/config-hash: .
  4. The PodTemplateSpec change triggers a Kubernetes rolling update. Old Pods are terminated, new Pods are created.
  5. The mutating admission webhook intercepts each new Pod at CREATE time. It checks kagenti.io/type == agent, evaluates feature gates and per-sidecar precedence, then injects sidecar containers
    (proxy-init, envoy-proxy, spiffe-helper, client-registration) along with shared volumes and a dedicated ServiceAccount.
  6. The Pod starts with all sidecars. Traffic is transparently intercepted by Envoy, SPIFFE identity is obtained, and the workload is registered as a Keycloak client.
  7. On AgentRuntime update: the controller recomputes the config-hash, which triggers another rolling update. New Pods get re-injected with updated configuration.
  8. On AgentRuntime delete: the finalizer preserves the kagenti.io/type label but updates the config-hash to defaults-only, triggering a rolling update. The webhook re-injects sidecars using platform
    defaults (the workload keeps authentication but loses custom overrides).

when an AgentRuntime CR is deleted:

  1. Finalizer runs — the controller doesn't remove the kagenti.io/type label (so the workload remains an agent/tool)
  2. Config-hash updated — recomputed using only platform defaults (no CR overrides), which changes the PodTemplateSpec annotation
  3. Rolling update — Kubernetes sees the PodTemplateSpec changed, creates new Pods
  4. Webhook re-injects — the new Pods still have kagenti.io/type: agent, so the webhook injects sidecars using platform defaults only (no AgentRuntime overrides)

The net effect: the workload keeps its sidecars but falls back to platform-default configuration.

@grs

grs commented Mar 16, 2026

Copy link
Copy Markdown

Right, so creating the CR triggers injection, but deleting it does not undo that. My point was that to me this is not intuitive.

@cwiklik

cwiklik commented Mar 16, 2026

Copy link
Copy Markdown
Contributor Author

Right, so creating the CR triggers injection, but deleting it does not undo that. My point was that to me this is not intuitive.


@rhuss suggested this flow:

"AgentRuntime deletion should revert to defaults

For Open Question #3: deleting the CR should mean "revert to platform defaults," not "remove identity infrastructure." The sidecars are already injected. Removing identity should require removing the type label and restarting the workload."

@grs

grs commented Mar 17, 2026 •

Copy link
Copy Markdown

@rhuss suggested this flow:

Yes, and I think that flow made sense when the injection was triggered by labels on the workload or namespace, as in that case the CR merely changed the configuration but did not itself cause injection.

However if the CR does cause injection, then reverting to defaults on deletion of that CR is not in my view what the user would expect.

I do think that having injection controlled by the presence of the CR is better. It is clear and explicit and the status of the CR can be used to indicate the status of injection.

If the finalizer for the CR is triggering a rollout (though update of the PodTemplateSpec), then why not have the webhook ignore the new pods since the CR that triggered injection is no longer there? That seems more intuitive.

(It would be ideal if the controller could trigger pod recreation without changing the workload at all, e.g. by just deleting pods that are affected by the creation or deletion of a CR.)


@grs I think what you suggest makes sense. With CR-driven injection, the semantics should be:

  • CR present → webhook injects sidecars (using config from the CR + namespace defaults)
  • CR deleted → webhook does not inject into new pods for that workload

This is more intuitive than reverting to defaults — if the user explicitly created a CR to trigger injection, removing it should undo that decision.

I'll let this simmer for a bit (perhaps other people have a different opinion (@rhuss) and then update the design to reflect this direction.

@grs

grs commented Mar 17, 2026 •

Copy link
Copy Markdown

On a somewhat separate point, how is the case handled where more than on AgentRuntime CR targets the same workload, with conflicting settings in each?


@grs Good question.

Some options:

  1. Reject on conflict — if more than one CR matches, refuse injection and return an error in the admission response. Safest, but the user only discovers the problem at pod creation time.
  2. Deterministic winner — pick the oldest CR (by creationTimestamp) or alphabetically by name, and log a warning that others were ignored. Simple, but the user may not notice the warning.
  3. Validation webhook on the CRD — prevent the conflict at creation time by rejecting a new AgentRuntime if one already targets the same workload in that namespace. Best UX since the user gets
    immediate feedback, but requires work on the operator side.
  4. Merge with conflict detection — merge all matching CRs, error only if specific fields conflict across them. Most flexible, but adds complexity and may be hard to reason about.

These aren't mutually exclusive — for example, option 3 as the primary guard with option 1 as a defensive fallback in the webhook would give both good UX and safety.

@amfred

amfred commented Mar 18, 2026

Copy link
Copy Markdown

Just adding my 10 cents late in the game.

Overall I think the design changes are good. This should avoid infinite reconciliation loops. The objectselector on the webhook - to avoid a cluster-wide performance cost - is good. We may find some details that need to change once we actually get more hands-on experience with this, but I think it's close to correct and good enough for an MVP.

I have to defer to the people who are more hands-on with the code with respect to the implementation decisions that @grs and @cwiklik are discussing. I can't rule any of them out as a bad idea myself.

Ladas added a commit that referenced this pull request Mar 19, 2026
…gent CRs

Per PR #770 consolidated design: AgentRuntime CR targetRef points to
standard Deployments, not Agent CRs. Fixed all references and diagrams.

Added deployed structure diagram showing controller-managed namespace
layout (agent pod with AuthBridge sidecars, optional egress proxy,
per-namespace infra). Added database access model diagram showing
which component writes/reads which tables across the sessions and
llm_budget databases.

Refs: #820, #862

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
Ladas added a commit that referenced this pull request Apr 9, 2026
…gent CRs

Per PR #770 consolidated design: AgentRuntime CR targetRef points to
standard Deployments, not Agent CRs. Fixed all references and diagrams.

Added deployed structure diagram showing controller-managed namespace
layout (agent pod with AuthBridge sidecars, optional egress proxy,
per-namespace infra). Added database access model diagram showing
which component writes/reads which tables across the sessions and
llm_budget databases.

Refs: #820, #862

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>

@pdettori pdettori left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@pdettori

Copy link
Copy Markdown
Member

merging so we can update it to sync up with MVP implementation in a follow up PR.

@pdettori
pdettori merged commit a9839a4 into rossoctl:main Apr 13, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants