瀏覽代碼

fix(agent): substitute namespace in runtime environment

The lambdagent template references $(metadata.namespace), but the Agent controller did not expose that placeholder in component variables. Pods therefore received an invalid agent ID containing the literal placeholder, and Remote Service rejected runs with HTTP 422.

- Add metadata.namespace to Agent component template variables
- Preserve existing agent name and UID substitution behavior
KongLingTT 1 月之前
父節點
當前提交
408017c549
共有 1 個文件被更改,包括 4 次插入 和 3 次删除
  1. 4 3
      internal/controller/agent_controller.go

+ 4 - 3
internal/controller/agent_controller.go

@@ -148,9 +148,10 @@ func (r *AgentReconciler) reconcileComponent(ctx context.Context, agent *v1alpha
 		comp.Spec.Category = "Agent"
 		comp.Spec.Template = &tmpl
 		comp.Spec.Variables = map[string]string{
-			"systemPrompt": agent.Spec.SystemPrompt,
-			"agentName":    agent.Name,
-			"agentUid":     string(agent.UID),
+			"systemPrompt":       agent.Spec.SystemPrompt,
+			"agentName":          agent.Name,
+			"agentUid":           string(agent.UID),
+			"metadata.namespace": agent.Namespace,
 		}
 		comp.Spec.Dependencies = dependencies
 		if agent.Spec.StackRef != nil {