@@ -206,7 +206,7 @@ func (a *adkApiTranslator) validateAgent(ctx context.Context, agent *v1alpha2.Ag
206206 }
207207
208208 toolAgent := & v1alpha2.Agent {}
209- err : = a .kube .Get (ctx , agentRef , toolAgent )
209+ err = a .kube .Get (ctx , agentRef , toolAgent )
210210 if err != nil {
211211 return err
212212 }
@@ -387,16 +387,7 @@ func (a *adkApiTranslator) buildManifest(
387387 Command : cmd ,
388388 Args : dep .Args ,
389389 Ports : []corev1.ContainerPort {{Name : "http" , ContainerPort : dep .Port }},
390- Resources : corev1.ResourceRequirements {
391- Requests : corev1.ResourceList {
392- corev1 .ResourceCPU : resource .MustParse ("100m" ),
393- corev1 .ResourceMemory : resource .MustParse ("384Mi" ),
394- },
395- Limits : corev1.ResourceList {
396- corev1 .ResourceCPU : resource .MustParse ("2000m" ),
397- corev1 .ResourceMemory : resource .MustParse ("1Gi" ),
398- },
399- },
390+ Resources : * dep .Resources ,
400391 Env : env ,
401392 ReadinessProbe : & corev1.Probe {
402393 ProbeHandler : corev1.ProbeHandler {
@@ -486,7 +477,6 @@ func (a *adkApiTranslator) translateInlineAgent(ctx context.Context, agent *v1al
486477 case tool .McpServer != nil :
487478 toolsByServer [tool .McpServer .TypedLocalReference ] = append (toolsByServer [tool .McpServer .TypedLocalReference ], tool .McpServer .ToolNames ... )
488479 case tool .Agent != nil :
489-
490480 agentRef := types.NamespacedName {
491481 Namespace : agent .Namespace ,
492482 Name : tool .Agent .Name ,
@@ -498,7 +488,7 @@ func (a *adkApiTranslator) translateInlineAgent(ctx context.Context, agent *v1al
498488
499489 // Translate a nested tool
500490 toolAgent := & v1alpha2.Agent {}
501- err : = a .kube .Get (ctx , agentRef , toolAgent )
491+ err = a .kube .Get (ctx , agentRef , toolAgent )
502492 if err != nil {
503493 return nil , nil , nil , err
504494 }
@@ -1003,6 +993,23 @@ type resolvedDeployment struct {
1003993 Labels map [string ]string
1004994 Annotations map [string ]string
1005995 Env []corev1.EnvVar
996+ Resources * corev1.ResourceRequirements
997+ }
998+
999+ // setDefaultResources sets default resource requirements if not specified
1000+ func setDefaultResources (dep * resolvedDeployment ) {
1001+ if dep .Resources == nil {
1002+ dep .Resources = & corev1.ResourceRequirements {
1003+ Requests : corev1.ResourceList {
1004+ corev1 .ResourceCPU : resource .MustParse ("100m" ),
1005+ corev1 .ResourceMemory : resource .MustParse ("384Mi" ),
1006+ },
1007+ Limits : corev1.ResourceList {
1008+ corev1 .ResourceCPU : resource .MustParse ("2000m" ),
1009+ corev1 .ResourceMemory : resource .MustParse ("1Gi" ),
1010+ },
1011+ }
1012+ }
10061013}
10071014
10081015func (a * adkApiTranslator ) resolveInlineDeployment (agent * v1alpha2.Agent , mdd * modelDeploymentData ) (* resolvedDeployment , error ) {
@@ -1049,8 +1056,12 @@ func (a *adkApiTranslator) resolveInlineDeployment(agent *v1alpha2.Agent, mdd *m
10491056 Labels : maps .Clone (spec .Labels ),
10501057 Annotations : maps .Clone (spec .Annotations ),
10511058 Env : append (slices .Clone (spec .Env ), mdd .EnvVars ... ),
1059+ Resources : spec .Resources ,
10521060 }
10531061
1062+ // Set default resources if not specified
1063+ setDefaultResources (dep )
1064+
10541065 // Set default replicas if not specified
10551066 if dep .Replicas == nil {
10561067 dep .Replicas = ptr .To (int32 (1 ))
@@ -1107,8 +1118,12 @@ func (a *adkApiTranslator) resolveByoDeployment(agent *v1alpha2.Agent) (*resolve
11071118 Labels : maps .Clone (spec .Labels ),
11081119 Annotations : maps .Clone (spec .Annotations ),
11091120 Env : slices .Clone (spec .Env ),
1121+ Resources : spec .Resources ,
11101122 }
11111123
1124+ // Set default resources if not specified
1125+ setDefaultResources (dep )
1126+
11121127 return dep , nil
11131128}
11141129
0 commit comments