| 334 | } |
| 335 | |
| 336 | func validatePodSpecPatch(podSpec *corev1.PodSpec, allowCmdMod bool) error { |
| 337 | for idx, c := range podSpec.Containers { |
| 338 | if c.Image != strings.ToLower(c.Image) { |
| 339 | return fmt.Errorf("container image for container at index %d contains uppercase letters: %s", idx, c.Image) |
| 340 | } |
| 341 | |
| 342 | if !allowCmdMod && (len(c.Command) != 0 || len(c.Args) != 0) { |
| 343 | return fmt.Errorf("container at index %d (image: %s): %w", idx, c.Image, scheduler.ErrNoCommandModification) |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | return nil |
| 348 | } |