Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions go/api/v1alpha2/agent_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ type SharedDeploymentSpec struct {
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
// +optional
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty"`
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
}

// ToolProviderType represents the tool provider type
Expand Down
19 changes: 19 additions & 0 deletions go/api/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2,912 changes: 2,422 additions & 490 deletions go/config/crd/bases/kagent.dev_agents.yaml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ require (
github.com/gorilla/mux v1.8.1
github.com/hashicorp/go-multierror v1.1.1
github.com/jedib0t/go-pretty/v6 v6.6.8
github.com/kagent-dev/kmcp v0.1.8
github.com/kagent-dev/mockllm v0.0.2
github.com/mark3labs/mcp-go v0.40.0
github.com/muesli/reflow v0.3.0
github.com/prometheus/client_golang v1.23.2
github.com/spf13/cobra v1.10.1
github.com/spf13/pflag v1.0.10
Expand Down Expand Up @@ -52,12 +54,10 @@ require (
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
github.com/invopop/jsonschema v0.13.0 // indirect
github.com/kagent-dev/kmcp v0.1.8 // indirect
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
github.com/mattn/go-localereader v0.0.2-0.20220822084749-2491eb6c1c75 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/openai/openai-go v1.12.0 // indirect
Expand Down Expand Up @@ -155,7 +155,7 @@ require (
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
go.opentelemetry.io/otel/trace v1.38.0 // indirect
go.opentelemetry.io/proto/otlp v1.8.0 // indirect
go.uber.org/multierr v1.11.0
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
golang.org/x/crypto v0.42.0 // indirect
Expand All @@ -177,7 +177,7 @@ require (
k8s.io/apiextensions-apiserver v0.34.1 // indirect
k8s.io/apiserver v0.34.1 // indirect
k8s.io/component-base v0.34.1 // indirect
k8s.io/klog/v2 v2.130.1
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
modernc.org/libc v1.66.9 // indirect
modernc.org/mathutil v1.7.1 // indirect
Expand Down
1 change: 1 addition & 0 deletions go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-localereader v0.0.2-0.20220822084749-2491eb6c1c75 h1:P8UmIzZMYDR+NGImiFvErt6VWfIRPuGM+vyjiEdkmIw=
github.com/mattn/go-localereader v0.0.2-0.20220822084749-2491eb6c1c75/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.17 h1:78v8ZlW0bP43XfmAfPsdXcoNCelfMHsDmd/pkENfrjQ=
github.com/mattn/go-runewidth v0.0.17/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand Down
14 changes: 13 additions & 1 deletion go/internal/controller/translator/agent/adk_api_translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,10 @@ func (a *adkApiTranslator) buildManifest(
SecurityContext: securityContext,
VolumeMounts: volumeMounts,
}},
Volumes: volumes,
Volumes: volumes,
Tolerations: dep.Tolerations,
Affinity: dep.Affinity,
NodeSelector: dep.NodeSelector,
},
},
},
Expand Down Expand Up @@ -1106,6 +1109,9 @@ type resolvedDeployment struct {
Annotations map[string]string
Env []corev1.EnvVar
Resources corev1.ResourceRequirements
Tolerations []corev1.Toleration
Affinity *corev1.Affinity
NodeSelector map[string]string
}

// getDefaultResources sets default resource requirements if not specified
Expand Down Expand Up @@ -1185,6 +1191,9 @@ func (a *adkApiTranslator) resolveInlineDeployment(agent *v1alpha2.Agent, mdd *m
Annotations: maps.Clone(spec.Annotations),
Env: append(slices.Clone(spec.Env), mdd.EnvVars...),
Resources: getDefaultResources(spec.Resources), // Set default resources if not specified
Tolerations: slices.Clone(spec.Tolerations),
Affinity: spec.Affinity,
NodeSelector: maps.Clone(spec.NodeSelector),
}

return dep, nil
Expand Down Expand Up @@ -1250,6 +1259,9 @@ func (a *adkApiTranslator) resolveByoDeployment(agent *v1alpha2.Agent) (*resolve
Annotations: maps.Clone(spec.Annotations),
Env: slices.Clone(spec.Env),
Resources: getDefaultResources(spec.Resources), // Set default resources if not specified
Tolerations: slices.Clone(spec.Tolerations),
Affinity: spec.Affinity,
NodeSelector: maps.Clone(spec.NodeSelector),
}

return dep, nil
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
operation: translateAgent
targetObject: agent-with-scheduling-attributes
namespace: test
objects:
- apiVersion: v1
kind: Secret
metadata:
name: openai-secret
namespace: test
data:
api-key: c2stdGVzdC1hcGkta2V5 # base64 encoded "sk-test-api-key"
- apiVersion: kagent.dev/v1alpha2
kind: ModelConfig
metadata:
name: basic-model
namespace: test
spec:
provider: OpenAI
model: gpt-4o
apiKeySecret: openai-secret
apiKeySecretKey: api-key
openAI:
temperature: "0.7"
maxTokens: 1024
topP: "0.95"
reasoningEffort: "low"
defaultHeaders:
User-Agent: "kagent/1.0"
- apiVersion: kagent.dev/v1alpha2
kind: Agent
metadata:
name: agent-with-scheduling-attributes
namespace: test
spec:
type: Declarative
declarative:
description: A basic test agent with scheduling attributes added.
systemMessage: You are a helpful assistant.
modelConfig: basic-model
deployment:
nodeSelector:
kubernetes.io/os: linux
tolerations:
- operator: Exists
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
resources:
requests:
cpu: 200m
memory: 684Mi
limits:
cpu: 3000m
memory: 2Gi
tools: []
Loading
Loading