| 312 | } |
| 313 | |
| 314 | func validateAgentConfig(agentConfig *config.AgentConfig) error { |
| 315 | if agentConfig == nil { |
| 316 | return nil |
| 317 | } |
| 318 | |
| 319 | var errs []error |
| 320 | for i, h := range agentConfig.AdditionalHooks { |
| 321 | if h.Path == "" { |
| 322 | errs = append(errs, fmt.Errorf("agent-config.additional-hooks[%d].path is required", i)) |
| 323 | } |
| 324 | if h.Volume == nil { |
| 325 | errs = append(errs, fmt.Errorf("agent-config.additional-hooks[%d].volume is required", i)) |
| 326 | continue |
| 327 | } |
| 328 | if h.Volume.Name == "" { |
| 329 | errs = append(errs, fmt.Errorf("agent-config.additional-hooks[%d].volume.name is required", i)) |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | return errors.Join(errs...) |
| 334 | } |
| 335 | |
| 336 | func validatePodSpecPatch(podSpec *corev1.PodSpec, allowCmdMod bool) error { |
| 337 | for idx, c := range podSpec.Containers { |