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 filter plugin validate container #587

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions controllers/object_controls.go
Original file line number Diff line number Diff line change
Expand Up @@ -1963,16 +1963,6 @@ func TransformValidatorComponent(config *gpuv1.ClusterPolicySpec, podSpec *corev
if !strings.Contains(initContainer.Name, fmt.Sprintf("%s-validation", component)) {
continue
}
if component == "nvidia-fs" && (config.GPUDirectStorage == nil || !config.GPUDirectStorage.IsEnabled()) {
// remove nvidia-fs init container from validator Daemonset if GDS is not enabled
podSpec.InitContainers = append(podSpec.InitContainers[:i], podSpec.InitContainers[i+1:]...)
return nil
}
if component == "cc-manager" && !config.CCManager.IsEnabled() {
// remove cc-manager init container from validator Daemonset if it is not enabled
podSpec.InitContainers = append(podSpec.InitContainers[:i], podSpec.InitContainers[i+1:]...)
return nil
}
// update validation image
image, err := gpuv1.ImagePath(&config.Validator)
if err != nil {
Expand Down Expand Up @@ -2003,6 +1993,11 @@ func TransformValidatorComponent(config *gpuv1.ClusterPolicySpec, podSpec *corev
setContainerEnv(&(podSpec.InitContainers[i]), ValidatorRuntimeClassEnvName, *podSpec.RuntimeClassName)
}
case "plugin":
// remove plugin init container from validator Daemonset if it is not enabled
if !config.DevicePlugin.IsEnabled() {
podSpec.InitContainers = append(podSpec.InitContainers[:i], podSpec.InitContainers[i+1:]...)
return nil
}
// set/append environment variables for plugin-validation container
if len(config.Validator.Plugin.Env) > 0 {
for _, env := range config.Validator.Plugin.Env {
Expand Down Expand Up @@ -2030,9 +2025,18 @@ func TransformValidatorComponent(config *gpuv1.ClusterPolicySpec, podSpec *corev
}
}
case "nvidia-fs":
// no additional config required for nvidia-fs validation
if config.GPUDirectStorage == nil || !config.GPUDirectStorage.IsEnabled() {
// remove nvidia-fs init container from validator Daemonset if GDS is not enabled
podSpec.InitContainers = append(podSpec.InitContainers[:i], podSpec.InitContainers[i+1:]...)
return nil
}
case "cc-manager":
// no additional config required for cc-manager validation
if !config.CCManager.IsEnabled() {
// remove cc-manager init container from validator Daemonset if it is not enabled
podSpec.InitContainers = append(podSpec.InitContainers[:i], podSpec.InitContainers[i+1:]...)
return nil
}
case "toolkit":
// set/append environment variables for toolkit-validation container
if len(config.Validator.Toolkit.Env) > 0 {
Expand Down