diff --git a/runsc/specutils/nvidia.go b/runsc/specutils/nvidia.go index 36cedcc9e..261f1669c 100644 --- a/runsc/specutils/nvidia.go +++ b/runsc/specutils/nvidia.go @@ -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 } diff --git a/runsc/specutils/specutils.go b/runsc/specutils/specutils.go index 58609049b..b734ecf49 100644 --- a/runsc/specutils/specutils.go +++ b/runsc/specutils/specutils.go @@ -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 }