Sitelet https://github.com/kubernetes/kops/commit/7aeacd52d09e4cd88a15f139d764f490058e9381
Skip to content

Commit 7aeacd5

Browse files
committed
[aiconformance]: Add accelerator metrics validator test
1 parent 2642ecd commit 7aeacd5

2 files changed

Lines changed: 81 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
Copyright The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package ai_inference
18+
19+
import (
20+
"fmt"
21+
"strings"
22+
"testing"
23+
24+
"k8s.io/kops/tests/e2e/scenarios/ai-conformance/validators"
25+
)
26+
27+
// TestObservability_AcceleratorMetrics corresponds to the observability/accelerator_metrics conformance requirement.
28+
func TestObservability_AcceleratorMetrics(t *testing.T) {
29+
// Description:
30+
// For supported accelerator types, the platform must allow for the installation and successful operation of at least one accelerator metrics solution
31+
// that exposes fine-grained performance metrics via a standardized, machine-readable metrics endpoint.
32+
// This must include a core set of metrics for per-accelerator utilization and memory usage.
33+
// Additionally, other relevant metrics such as temperature, power draw, and interconnect bandwidth should be exposed
34+
// if the underlying hardware or virtualization layer makes them available.
35+
// The list of metrics should align with emerging standards, such as OpenTelemetry metrics, to ensure interoperability.
36+
// The platform may provide a managed solution, but this is not required for conformance."
37+
38+
h := validators.NewValidatorHarness(t)
39+
40+
h.Logf("# Observability: Accelerator Metrics")
41+
42+
h.Run("nvidia-metrics", func(h *validators.ValidatorHarness) {
43+
h.Logf("## Verify NVIDIA Metrics")
44+
45+
h.ShellExec("kubectl get service -n gpu-operator")
46+
47+
ns := h.TestNamespace()
48+
49+
objects := h.ApplyManifest("testdata/scrape-metrics.yaml", ns)
50+
for _, obj := range objects {
51+
obj.KubectlWait()
52+
}
53+
54+
logs := h.ShellExec(fmt.Sprintf("kubectl logs -n %s -l=job-name=scrape-metrics", ns))
55+
56+
t.Logf("Received metrics:\n%s", string(logs.Stdout()))
57+
if !strings.Contains(string(logs.Stdout()), "DCGM_FI_DEV_GPU_UTIL") {
58+
h.Fatalf("Did not find expected GPU utilization metric in output: %s", logs.Stdout())
59+
} else {
60+
h.Success("Found expected GPU utilization metric in output, indicating that accelerator metrics are being exposed correctly.")
61+
}
62+
63+
})
64+
65+
if h.AllPassed() {
66+
h.RecordConformance("observability/accelerator_metrics")
67+
}
68+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
kind: Job
2+
apiVersion: batch/v1
3+
metadata:
4+
name: scrape-accelerator-metrics
5+
spec:
6+
template:
7+
spec:
8+
restartPolicy: Never
9+
containers:
10+
- name: scraper
11+
image: curlimages/curl:7.85.0
12+
command: ["bash", "-c"]
13+
args: ["curl -sS http://gpu-metrics-exporter.gpu-operator.svc.cluster.local:9400/metrics"]

0 commit comments

Comments
 (0)