func validatePod(pod *kube.Pod, ignoreContainers bool) error { errList := validation.ValidatePod(pod) // remove error for no containers if requested if ignoreContainers { errList = errList.Filter(func(e error) bool { return e.Error() == "spec.containers: Required value" }) } meta := pod.GetObjectMeta() if len(meta.GetName()) == 0 && len(meta.GetGenerateName()) > 0 { errList = errList.Filter(func(e error) bool { return e.Error() == "metadata.name: Required value: name or generateName is required" }) } return errList.ToAggregate() }