Skip to content

Commit

Permalink
Logs and tests for GPU pod tag
Browse files Browse the repository at this point in the history
  • Loading branch information
gabedos committed Oct 16, 2024
1 parent 01447f1 commit 61cf8cd
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
53 changes: 53 additions & 0 deletions comp/core/tagger/taggerimpl/collectors/workloadmeta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,59 @@ func TestHandleKubePod(t *testing.T) {
},
},
},
{
name: "pod with containers requesting gpu resources",
pod: workloadmeta.KubernetesPod{
EntityID: podEntityID,
EntityMeta: workloadmeta.EntityMeta{
Name: podName,
Namespace: podNamespace,
},
GPUType: "nvidia",
Containers: []workloadmeta.OrchestratorContainer{
{
ID: fullyFleshedContainerID,
Name: containerName,
Image: image,
},
},
},
expected: []*types.TagInfo{
{
Source: podSource,
EntityID: podTaggerEntityID,
HighCardTags: []string{},
OrchestratorCardTags: []string{
fmt.Sprintf("pod_name:%s", podName),
},
LowCardTags: []string{
fmt.Sprintf("kube_namespace:%s", podNamespace),
"kube_gpu_type:nvidia",
},
StandardTags: []string{},
},
{
Source: podSource,
EntityID: fullyFleshedContainerTaggerEntityID,
HighCardTags: []string{
fmt.Sprintf("container_id:%s", fullyFleshedContainerID),
fmt.Sprintf("display_container_name:%s_%s", runtimeContainerName, podName),
},
OrchestratorCardTags: []string{
fmt.Sprintf("pod_name:%s", podName),
},
LowCardTags: append([]string{
fmt.Sprintf("kube_namespace:%s", podNamespace),
fmt.Sprintf("kube_container_name:%s", containerName),
"image_id:datadog/agent@sha256:a63d3f66fb2f69d955d4f2ca0b229385537a77872ffc04290acae65aed5317d2",
"image_name:datadog/agent",
"image_tag:latest",
"short_image:agent",
}, standardTags...),
StandardTags: standardTags,
},
},
},
}

for _, tt := range tests {
Expand Down
1 change: 1 addition & 0 deletions comp/core/workloadmeta/def/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ func (p KubernetesPod) String(verbose bool) string {
if verbose {
_, _ = fmt.Fprintln(&sb, "Priority Class:", p.PriorityClass)
_, _ = fmt.Fprintln(&sb, "QOS Class:", p.QOSClass)
_, _ = fmt.Fprintln(&sb, "GPU Type:", p.GPUType)
_, _ = fmt.Fprintln(&sb, "Runtime Class:", p.RuntimeClass)
_, _ = fmt.Fprintln(&sb, "PVCs:", sliceToString(p.PersistentVolumeClaimNames))
_, _ = fmt.Fprintln(&sb, "Kube Services:", sliceToString(p.KubeServices))
Expand Down

0 comments on commit 61cf8cd

Please sign in to comment.