func validateCustomPersistentVolumeClaim()

in api/v1beta1/teamcity_webhook.go [147:175]


func validateCustomPersistentVolumeClaim(objectPath string, claim CustomPersistentVolumeClaim) error {
	if len(claim.Name) <= 0 {
		return typed.ValidationError{
			Path:         fmt.Sprintf("%s.%s", objectPath, "name"),
			ErrorMessage: "Claim name is not set",
		}
	}
	if len(claim.VolumeMount.Name) <= 0 {
		return typed.ValidationError{
			Path:         fmt.Sprintf("%s.%s", objectPath, "volumeMount.name"),
			ErrorMessage: "Volume mount name is not set",
		}
	}
	if len(claim.VolumeMount.MountPath) <= 0 {
		return typed.ValidationError{
			Path:         fmt.Sprintf("%s.%s", objectPath, "volumeMount.mountPath"),
			ErrorMessage: "Volume mount path is not set",
		}
	}

	if len(claim.Spec.Resources.Requests.Storage().String()) <= 0 {
		return typed.ValidationError{
			Path:         fmt.Sprintf("%s.%s", objectPath, "spec.resources.requests.storage"),
			ErrorMessage: "Storage request is not set",
		}
	}

	return nil
}