Make NVProxy and TPUProxy annotations public.

PiperOrigin-RevId: 630500333
This commit is contained in:
Etienne Perot
2024-05-03 14:41:14 -07:00
committed by gVisor bot
parent 640a42e63c
commit 18509eb02f
2 changed files with 9 additions and 5 deletions
+3 -3
View File
@@ -26,15 +26,15 @@ import (
const nvdEnvVar = "NVIDIA_VISIBLE_DEVICES"
// annotationNVProxy enables nvproxy.
const annotationNVProxy = "dev.gvisor.internal.nvproxy"
// AnnotationNVProxy enables nvproxy.
const AnnotationNVProxy = "dev.gvisor.internal.nvproxy"
// NVProxyEnabled checks both the nvproxy annotation and conf.NVProxy to see if nvproxy is enabled.
func NVProxyEnabled(spec *specs.Spec, conf *config.Config) bool {
if conf.NVProxy {
return true
}
val, ok := spec.Annotations[annotationNVProxy]
val, ok := spec.Annotations[AnnotationNVProxy]
if !ok {
return false
}
+6 -2
View File
@@ -44,12 +44,16 @@ import (
const (
annotationFlagPrefix = "dev.gvisor.flag."
annotationSeccomp = "dev.gvisor.internal.seccomp."
annotationTPU = "dev.gvisor.internal.tpuproxy"
annotationSeccompRuntimeDefault = "RuntimeDefault"
annotationContainerName = "io.kubernetes.cri.container-name"
)
const (
// AnnotationTPU is the annotation used to enable TPU proxy on a pod.
AnnotationTPU = "dev.gvisor.internal.tpuproxy"
)
// ExePath must point to runsc binary, which is normally the same binary. It's
// changed in tests that aren't linked in the same binary.
var ExePath = "/proc/self/exe"
@@ -567,7 +571,7 @@ func TPUProxyIsEnabled(spec *specs.Spec, conf *config.Config) bool {
if conf.TPUProxy {
return true
}
val, ok := spec.Annotations[annotationTPU]
val, ok := spec.Annotations[AnnotationTPU]
if !ok {
return false
}