func (r *Storage) ValidateCreate() error {
	storagelog.Info("validate create", "name", r.Name)
	return r.valid()
}
ValidateCreate implements webhook.Validator so a webhook will be registered for the type
package v1alpha1
import (
	apierrors "k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/apimachinery/pkg/util/validation/field"
	ctrl "sigs.k8s.io/controller-runtime"
	logf "sigs.k8s.io/controller-runtime/pkg/log"
	"sigs.k8s.io/controller-runtime/pkg/webhook"
)
var storagelog = logf.Log.WithName("storage-resource")
func (r *Storage) SetupWebhookWithManager(mgr ctrl.Manager) error {
	return ctrl.NewWebhookManagedBy(mgr).
		For(r).
		Complete()
}
var _ webhook.Defaulter = &Storage{}
func (r *Storage) Default() {
	storagelog.Info("default", "name", r.Name)
	if r.Spec.ConnectType == "internal" {
		if r.Spec.Image == "" {
			r.Spec.Image = "docker.elastic.co/elasticsearch/elasticsearch:7.5.1"
		}
		if r.Spec.Instances == 0 {
			r.Spec.Instances = 3
		}
	}
}
var _ webhook.Validator = &Storage{}