func podConstraint()

in internal/utils/controller/appdeployment_validate.go [107:127]


func podConstraint(pt corev1.PodTemplateSpec) error {
	if len(pt.Name) > 0 {
		return fmt.Errorf("name is not allowed")
	}
	if len(pt.Namespace) > 0 {
		return fmt.Errorf("namespace is not allowed")
	}
	if len(pt.Spec.Volumes) > 0 {
		return fmt.Errorf("volumes are not allowed")
	}
	if len(pt.Spec.InitContainers) > 0 {
		return fmt.Errorf("initContainers are not allowed")
	}
	if len(pt.Spec.Containers) != 1 {
		return fmt.Errorf("container count should be 1")
	}
	if containerConstraint(pt.Spec.Containers[0]) != nil {
		return fmt.Errorf("container: %w", containerConstraint(pt.Spec.Containers[0]))
	}
	return nil
}