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 cmd/aima/tooldeps_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ type deploymentOverview struct {
Name string `json:"name"`
Model string `json:"model"`
Engine string `json:"engine,omitempty"`
Image string `json:"image,omitempty"`
Slot string `json:"slot,omitempty"`
Phase string `json:"phase"`
Status string `json:"status"`
Expand All @@ -704,6 +705,8 @@ type deploymentOverview struct {
Message string `json:"message,omitempty"`
Restarts int `json:"restarts,omitempty"`
ExitCode *int `json:"exit_code,omitempty"`
GPUMemoryMiB int `json:"gpu_memory_mib,omitempty"`
GPUMemorySource string `json:"gpu_memory_source,omitempty"`
StartupPhase string `json:"startup_phase,omitempty"`
StartupProgress int `json:"startup_progress,omitempty"`
StartupMessage string `json:"startup_message,omitempty"`
Expand All @@ -724,6 +727,7 @@ func deploymentOverviewFromStatus(status *runtime.DeploymentStatus, cat *knowled
Name: status.Name,
Model: status.Model,
Engine: status.Engine,
Image: status.Image,
Slot: status.Slot,
Phase: status.Phase,
Status: status.Phase,
Expand All @@ -735,6 +739,8 @@ func deploymentOverviewFromStatus(status *runtime.DeploymentStatus, cat *knowled
Message: status.Message,
Restarts: status.Restarts,
ExitCode: status.ExitCode,
GPUMemoryMiB: status.GPUMemoryMiB,
GPUMemorySource: status.GPUMemorySource,
StartupPhase: status.StartupPhase,
StartupProgress: status.StartupProgress,
StartupMessage: status.StartupMessage,
Expand Down
17 changes: 13 additions & 4 deletions cmd/aima/tooldeps_deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,21 @@ func TestDeploymentOverviewIncludesCatalogModelType(t *testing.T) {
}},
}
overview := deploymentOverviewFromStatus(&runtime.DeploymentStatus{
Name: "qwen3-tts-0.6b-qwen-tts-fastapi",
Model: "qwen3-tts-0.6b",
Phase: "running",
Ready: true,
Name: "qwen3-tts-0.6b-qwen-tts-fastapi",
Model: "qwen3-tts-0.6b",
Image: "docker.1ms.run/example/qwen-tts:latest",
Phase: "running",
Ready: true,
GPUMemoryMiB: 1536,
GPUMemorySource: "nvidia-smi",
}, cat)
if overview.ModelType != "tts" {
t.Fatalf("ModelType = %q, want tts", overview.ModelType)
}
if overview.Image != "docker.1ms.run/example/qwen-tts:latest" {
t.Fatalf("Image = %q, want docker.1ms.run/example/qwen-tts:latest", overview.Image)
}
if overview.GPUMemoryMiB != 1536 || overview.GPUMemorySource != "nvidia-smi" {
t.Fatalf("GPU memory = %d/%q, want 1536/nvidia-smi", overview.GPUMemoryMiB, overview.GPUMemorySource)
}
}
7 changes: 7 additions & 0 deletions internal/k3s/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type PodStatus struct {
DeletionTimestamp string `json:"deletion_timestamp,omitempty"`
Message string `json:"message,omitempty"`
ContainerPort int `json:"container_port,omitempty"`
ContainerImage string `json:"container_image,omitempty"`
RestartCount int `json:"restart_count,omitempty"`
ExitCode *int `json:"exit_code,omitempty"` // from Terminated state
ContainerStarted string `json:"container_started,omitempty"` // when the current container instance started
Expand Down Expand Up @@ -270,6 +271,7 @@ type kubePod struct {
} `json:"metadata"`
Spec struct {
Containers []struct {
Image string `json:"image"`
Ports []struct {
ContainerPort int `json:"containerPort"`
} `json:"ports"`
Expand Down Expand Up @@ -357,8 +359,12 @@ func parsePodJSON(data []byte) (*PodStatus, error) {
}

containerPort := 0
containerImage := ""
if len(kp.Spec.Containers) > 0 && len(kp.Spec.Containers[0].Ports) > 0 {
containerImage = kp.Spec.Containers[0].Image
containerPort = kp.Spec.Containers[0].Ports[0].ContainerPort
} else if len(kp.Spec.Containers) > 0 {
containerImage = kp.Spec.Containers[0].Image
}

var conditions []PodCondition
Expand All @@ -376,6 +382,7 @@ func parsePodJSON(data []byte) (*PodStatus, error) {
DeletionTimestamp: kp.Metadata.DeletionTimestamp,
Message: msg,
ContainerPort: containerPort,
ContainerImage: containerImage,
RestartCount: restartCount,
ExitCode: exitCode,
ContainerStarted: containerStarted,
Expand Down
37 changes: 37 additions & 0 deletions internal/k3s/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,18 @@ const terminatingPodJSON = `{
"aima.dev/model": "qwen3-8b"
}
},
"spec": {
"containers": [
{
"image": "nvcr.io/nvidia/vllm:26.01-py3",
"ports": [
{
"containerPort": 8000
}
]
}
]
},
"status": {
"phase": "Running",
"podIP": "10.42.0.5",
Expand All @@ -217,6 +229,18 @@ const runningPodJSON = `{
"aima.dev/model": "qwen3-8b"
}
},
"spec": {
"containers": [
{
"image": "nvcr.io/nvidia/vllm:26.01-py3",
"ports": [
{
"containerPort": 8000
}
]
}
]
},
"status": {
"phase": "Running",
"podIP": "10.42.0.5",
Expand Down Expand Up @@ -621,3 +645,16 @@ func TestParsePodJSON_DeletionTimestamp(t *testing.T) {
t.Fatal("expected raw pod readiness to reflect container status before runtime mapping")
}
}

func TestParsePodJSON_ContainerImage(t *testing.T) {
pod, err := parsePodJSON([]byte(runningPodJSON))
if err != nil {
t.Fatal(err)
}
if pod.ContainerImage != "nvcr.io/nvidia/vllm:26.01-py3" {
t.Fatalf("ContainerImage = %q, want nvcr.io/nvidia/vllm:26.01-py3", pod.ContainerImage)
}
if pod.ContainerPort != 8000 {
t.Fatalf("ContainerPort = %d, want 8000", pod.ContainerPort)
}
}
Loading
Loading