Переглянути джерело

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 {