NVIDIA / gpu-operator

NVIDIA GPU Operator creates/configures/manages GPUs atop Kubernetes
Apache License 2.0
1.77k stars 286 forks source link

Add Env valueFrom function #743

Open mayooot opened 3 months ago

mayooot commented 3 months ago

The purpose of this pr is to provide valueFrom functionality for CRD, like: environment-variable-expose-pod-information

The main change is to the CRD definition under api/nvidia/xxx_types.go, from the custom struct EnvVar to corev1.EnvVar.

Why did you add this feature?

We modified the k8s-device-plugin code to support multiple gpu spec via valueFrom. And for the gpu-operator modification, we've tested it ourselves to make sure it's not a problem.

The main reason for this is that we believe that the EnvVar struct should be consistent with the K8s API instead of using a custom struct.

shivamerla commented 3 months ago

@mayooot one of the primary reason was that ClusterPolicy CRD is already overloaded with many operands and close to 256KB limit. We cannot upgrade operator anymore after this limit. We need to get this information by other means and handle the translation in the code while updating the spec.