func disallowUsingLegacyAPIInNewCluster(old, tc *v1alpha1.TikvCluster) field.ErrorList {
	allErrs := field.ErrorList{}
	path := field.NewPath("spec")
	if old.Spec.Version != "" && tc.Spec.Version == "" {
		allErrs = append(allErrs, field.Invalid(path.Child("version"), tc.Spec.Version, "version must not be empty"))
	}
	if old.Spec.PD.BaseImage != "" && tc.Spec.PD.BaseImage == "" {
		allErrs = append(allErrs, field.Invalid(path.Child("pd.baseImage"), tc.Spec.PD.BaseImage, "baseImage of PD must not be empty"))
	}
	if old.Spec.TiKV.BaseImage != "" && tc.Spec.TiKV.BaseImage == "" {
		allErrs = append(allErrs, field.Invalid(path.Child("tikv.baseImage"), tc.Spec.TiKV.BaseImage, "baseImage of TiKV must not be empty"))
	}
	if old.Spec.TiKV.Config != nil && tc.Spec.TiKV.Config == nil {
		allErrs = append(allErrs, field.Invalid(path.Child("tikv.config"), tc.Spec.TiKV.Config, "TiKV.config must not be nil"))
	}
	if old.Spec.PD.Config != nil && tc.Spec.PD.Config == nil {
		allErrs = append(allErrs, field.Invalid(path.Child("pd.config"), tc.Spec.PD.Config, "PD.config must not be nil"))
	}
	return allErrs
}
// disallowUsingLegacyAPIInNewCluster checks if user use the legacy API in newly create cluster during update
// TODO(aylei): this could be removed after we enable validateTikvCluster() in update, which is more strict
disallowUsingLegacyAPIInNewCluster checks if user use the legacy API in newly create cluster during update
TODO(aylei): this could be removed after we enable validateTikvCluster() in update, which is more strict
// disallowUsingLegacyAPIInNewCluster checks if user use the legacy API in newly create cluster during update // TODO ( aylei ) : this could be removed after we enable validateTikvCluster () in update which is more strict
func disallowUsingLegacyAPIInNewCluster(old, tc *v1alpha1.TikvCluster) field.ErrorList {
	allErrs := field.ErrorList{}
	path := field.NewPath("spec")
	if old.Spec.Version != "" && tc.Spec.Version == "" {
		allErrs = append(allErrs, field.Invalid(path.Child("version"), tc.Spec.Version, "version must not be empty"))
	}
	if old.Spec.PD.BaseImage != "" && tc.Spec.PD.BaseImage == "" {
		allErrs = append(allErrs, field.Invalid(path.Child("pd.baseImage"), tc.Spec.PD.BaseImage, "baseImage of PD must not be empty"))
	}
	if old.Spec.TiKV.BaseImage != "" && tc.Spec.TiKV.BaseImage == "" {
		allErrs = append(allErrs, field.Invalid(path.Child("tikv.baseImage"), tc.Spec.TiKV.BaseImage, "baseImage of TiKV must not be empty"))
	}
	if old.Spec.TiKV.Config != nil && tc.Spec.TiKV.Config == nil {
		allErrs = append(allErrs, field.Invalid(path.Child("tikv.config"), tc.Spec.TiKV.Config, "TiKV.config must not be nil"))
	}
	if old.Spec.PD.Config != nil && tc.Spec.PD.Config == nil {
		allErrs = append(allErrs, field.Invalid(path.Child("pd.config"), tc.Spec.PD.Config, "PD.config must not be nil"))
	}
	return allErrs
}
func disallowUsingLegacyAPIInNewCluster ( old , tc * v1alpha1 . TikvCluster ) field . ErrorList { allErrs := field . ErrorList { } path := field . NewPath ( " " ) if old . Spec . Version != " " && tc . Spec . Version == " " { allErrs = append ( allErrs , field . Invalid ( path . Child ( " " ) , tc . Spec . Version , " " ) ) } if old . Spec . PD . BaseImage != " " && tc . Spec . PD . BaseImage == " " { allErrs = append ( allErrs , field . Invalid ( path . Child ( " " ) , tc . Spec . PD . BaseImage , " " ) ) } if old . Spec . TiKV . BaseImage != " " && tc . Spec . TiKV . BaseImage == " " { allErrs = append ( allErrs , field . Invalid ( path . Child ( " " ) , tc . Spec . TiKV . BaseImage , " " ) ) } if old . Spec . TiKV . Config != nil && tc . Spec . TiKV . Config == nil { allErrs = append ( allErrs , field . Invalid ( path . Child ( " " ) , tc . Spec . TiKV . Config , " " ) ) } if old . Spec . PD . Config != nil && tc . Spec . PD . Config == nil { allErrs = append ( allErrs , field . Invalid ( path . Child ( " " ) , tc . Spec . PD . Config , " " ) ) } return allErrs }
disallowUsingLegacyAPIInNewCluster checks if user use the legacy API in newly create cluster during update
TODO(aylei): this could be removed after we enable validateTikvCluster() in update, which is more strict
disallowUsingLegacyAPIInNewCluster checks if user use the legacy API in newly create cluster during update TODO ( aylei ) : this could be removed after we enable validateTikvCluster () in update which is more strict