func validateNewTikvClusterSpec(spec *v1alpha1.TikvClusterSpec, path *field.Path) field.ErrorList {
	allErrs := field.ErrorList{}
	if spec.Version == "" {
		allErrs = append(allErrs, field.Invalid(path.Child("version"), spec.Version, "version must not be empty"))
	}
	if spec.PD.BaseImage == "" {
		allErrs = append(allErrs, field.Invalid(path.Child("pd.baseImage"), spec.PD.BaseImage, "baseImage of PD must not be empty"))
	}
	if spec.TiKV.BaseImage == "" {
		allErrs = append(allErrs, field.Invalid(path.Child("tikv.baseImage"), spec.TiKV.BaseImage, "baseImage of TiKV must not be empty"))
	}
	if spec.TiKV.Image != "" {
		allErrs = append(allErrs, field.Invalid(path.Child("tikv.image"), spec.TiKV.Image, "image has been deprecated, use baseImage instead"))
	}
	if spec.PD.Image != "" {
		allErrs = append(allErrs, field.Invalid(path.Child("pd.image"), spec.PD.Image, "image has been deprecated, use baseImage instead"))
	}
	return allErrs
}
// For now we limit some validations only in Create phase to keep backward compatibility
For now we limit some validations only in Create phase to keep backward compatibility
// For now we limit some validations only in Create phase to keep backward compatibility
func validateNewTikvClusterSpec(spec *v1alpha1.TikvClusterSpec, path *field.Path) field.ErrorList {
	allErrs := field.ErrorList{}
	if spec.Version == "" {
		allErrs = append(allErrs, field.Invalid(path.Child("version"), spec.Version, "version must not be empty"))
	}
	if spec.PD.BaseImage == "" {
		allErrs = append(allErrs, field.Invalid(path.Child("pd.baseImage"), spec.PD.BaseImage, "baseImage of PD must not be empty"))
	}
	if spec.TiKV.BaseImage == "" {
		allErrs = append(allErrs, field.Invalid(path.Child("tikv.baseImage"), spec.TiKV.BaseImage, "baseImage of TiKV must not be empty"))
	}
	if spec.TiKV.Image != "" {
		allErrs = append(allErrs, field.Invalid(path.Child("tikv.image"), spec.TiKV.Image, "image has been deprecated, use baseImage instead"))
	}
	if spec.PD.Image != "" {
		allErrs = append(allErrs, field.Invalid(path.Child("pd.image"), spec.PD.Image, "image has been deprecated, use baseImage instead"))
	}
	return allErrs
}
func validateNewTikvClusterSpec ( spec * v1alpha1 . TikvClusterSpec , path * field . Path ) field . ErrorList { allErrs := field . ErrorList { } if spec . Version == " " { allErrs = append ( allErrs , field . Invalid ( path . Child ( " " ) , spec . Version , " " ) ) } if spec . PD . BaseImage == " " { allErrs = append ( allErrs , field . Invalid ( path . Child ( " " ) , spec . PD . BaseImage , " " ) ) } if spec . TiKV . BaseImage == " " { allErrs = append ( allErrs , field . Invalid ( path . Child ( " " ) , spec . TiKV . BaseImage , " " ) ) } if spec . TiKV . Image != " " { allErrs = append ( allErrs , field . Invalid ( path . Child ( " " ) , spec . TiKV . Image , " " ) ) } if spec . PD . Image != " " { allErrs = append ( allErrs , field . Invalid ( path . Child ( " " ) , spec . PD . Image , " " ) ) } return allErrs }
For now we limit some validations only in Create phase to keep backward compatibility
For now we limit some validations only in Create phase to keep backward compatibility