Skip to content

Commit b15d184

Browse files
authored
Add hard coded container resource settings (#6136)
Signed-off-by: trangevi <[email protected]>
1 parent e47edb8 commit b15d184

File tree

3 files changed

+64
-20
lines changed

3 files changed

+64
-20
lines changed

cli/azd/extensions/azure.ai.agents/internal/cmd/init.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,20 @@ func (a *InitAction) addToProject(ctx context.Context, targetDir string, agentMa
879879
// Skip the resource if the cast fails
880880
}
881881
}
882+
883+
// Hard code for now
884+
// TODO: Add env var handling in the future
885+
containerSettings := &project.ContainerSettings{
886+
Resources: &project.ResourceSettings{
887+
Memory: "2Gi",
888+
Cpu: "1",
889+
},
890+
Scale: &project.ScaleSettings{
891+
MinReplicas: 1,
892+
MaxReplicas: 3,
893+
},
894+
}
895+
agentConfig.Container = containerSettings
882896
}
883897

884898
agentConfig.Deployments = deploymentDetails

cli/azd/extensions/azure.ai.agents/internal/project/config.go

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,28 @@ import (
1313

1414
// ServiceTargetAgentConfig provides custom configuration for the Azure AI Service target
1515
type ServiceTargetAgentConfig struct {
16-
Environment map[string]string `json:"env,omitempty"`
17-
Scale *ScaleSettings `json:"scale,omitempty"`
18-
Deployments []Deployment `json:"deployments,omitempty"`
19-
Resources []Resource `json:"resources,omitempty"`
16+
Environment map[string]string `json:"env,omitempty"`
17+
Container *ContainerSettings `json:"container,omitempty"`
18+
Deployments []Deployment `json:"deployments,omitempty"`
19+
Resources []Resource `json:"resources,omitempty"`
20+
}
21+
22+
// ContainerSettings provides container configuration for the Azure AI Service target
23+
type ContainerSettings struct {
24+
Resources *ResourceSettings `json:"resources,omitempty"`
25+
Scale *ScaleSettings `json:"scale,omitempty"`
26+
}
27+
28+
// ResourceSettings provides resource configuration for the Azure AI Service target
29+
type ResourceSettings struct {
30+
Memory string `json:"memory,omitempty"`
31+
Cpu string `json:"cpu,omitempty"`
2032
}
2133

2234
// ScaleSettings provides scaling configuration for the Azure AI Service target
2335
type ScaleSettings struct {
24-
MinReplicas int `json:"minReplicas,omitempty"`
25-
MaxReplicas int `json:"maxReplicas,omitempty"`
26-
Memory string `json:"memory,omitempty"`
27-
Cpu string `json:"cpu,omitempty"`
36+
MinReplicas int `json:"minReplicas,omitempty"`
37+
MaxReplicas int `json:"maxReplicas,omitempty"`
2838
}
2939

3040
// Deployment represents a single model deployment

cli/azd/extensions/azure.ai.agents/schemas/azure.ai.agent.json

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"type": "string"
1212
}
1313
},
14-
"scale": {
15-
"$ref": "#/definitions/ScaleSettings"
14+
"container": {
15+
"$ref": "#/definitions/ContainerSettings"
1616
},
1717
"deployments": {
1818
"type": "array",
@@ -27,6 +27,36 @@
2727
},
2828
"additionalProperties": false,
2929
"definitions": {
30+
"ContainerSettings": {
31+
"type": "object",
32+
"description": "Container configuration for the Azure AI Agent Service target",
33+
"properties": {
34+
"resources": {
35+
"$ref": "#/definitions/ResourceSettings"
36+
},
37+
"scale": {
38+
"$ref": "#/definitions/ScaleSettings"
39+
}
40+
},
41+
"additionalProperties": false
42+
},
43+
"ResourceSettings": {
44+
"type": "object",
45+
"description": "Resource configuration for the Azure AI Agent Service target",
46+
"properties": {
47+
"memory": {
48+
"type": "string",
49+
"description": "Memory allocation (e.g., '1Gi', '512Mi')",
50+
"pattern": "^[0-9]+(\\.[0-9]+)?(Ki|Mi|Gi|Ti|Pi|Ei|k|M|G|T|P|E)?$"
51+
},
52+
"cpu": {
53+
"type": "string",
54+
"description": "CPU allocation (e.g., '1', '500m')",
55+
"pattern": "^[0-9]+(\\.[0-9]+)?m?$"
56+
}
57+
},
58+
"additionalProperties": false
59+
},
3060
"ScaleSettings": {
3161
"type": "object",
3262
"description": "Scaling configuration for the Azure AI Agent Service target",
@@ -40,16 +70,6 @@
4070
"type": "integer",
4171
"description": "Maximum number of replicas",
4272
"minimum": 1
43-
},
44-
"memory": {
45-
"type": "string",
46-
"description": "Memory allocation (e.g., '1Gi', '512Mi')",
47-
"pattern": "^[0-9]+(\\.[0-9]+)?(Ki|Mi|Gi|Ti|Pi|Ei|k|M|G|T|P|E)?$"
48-
},
49-
"cpu": {
50-
"type": "string",
51-
"description": "CPU allocation (e.g., '1', '500m')",
52-
"pattern": "^[0-9]+(\\.[0-9]+)?m?$"
5373
}
5474
},
5575
"additionalProperties": false

0 commit comments

Comments
 (0)