Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Env valueFrom function #743

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mayooot
Copy link

@mayooot mayooot commented Jun 7, 2024

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.

mayooot added 2 commits June 4, 2024 18:29
- Change Env field in NvidiaDriver spec from []EnvVar to []corev1.EnvVar to ensure consistency with Kubernetes core API types.
- Regenerate deepcopy code to reflect the changes in the API type.

This change improves integration and compatibility with Kubernetes environments and tooling.
…tests

Updated internal/state/driver_test.go and controllers/object_controls_test.go to use corev1.EnvVar instead of nvidiav1alpha1.EnvVar for environment variables.

- Changed Env: []nvidiav1alpha1.EnvVar{...} to Env: []corev1.EnvVar{...}.

This refactoring aligns with the use of standard corev1.EnvVar across the project.
@mayooot mayooot force-pushed the feat/support-envfrom branch from 6021879 to 952510a Compare June 7, 2024 06:34
@shivamerla
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants