func (r *JavaAgent) ValidateUpdate(old runtime.Object) error {
	javaagentlog.Info("validate update", "name", r.Name)
	return r.validate()
}
ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
package v1alpha1
import (
	"fmt"
	"k8s.io/apimachinery/pkg/runtime"
	ctrl "sigs.k8s.io/controller-runtime"
	logf "sigs.k8s.io/controller-runtime/pkg/log"
	"sigs.k8s.io/controller-runtime/pkg/webhook"
	"github.com/apache/skywalking-swck/pkg/operator/injector"
)
var javaagentlog = logf.Log.WithName("javaagent-resource")
func (r *JavaAgent) SetupWebhookWithManager(mgr ctrl.Manager) error {
	return ctrl.NewWebhookManagedBy(mgr).
		For(r).
		Complete()
}
var _ webhook.Defaulter = &JavaAgent{}
func (r *JavaAgent) Default() {
	javaagentlog.Info("default", "name", r.Name)
	config := r.Spec.AgentConfiguration
	if config == nil {
		return
	}
	service := injector.GetServiceName(&config)
	backend := injector.GetBackendService(&config)
	if r.Spec.ServiceName == "" && service != "" {
		r.Spec.ServiceName = service
	}
	if r.Spec.BackendService == "" && backend != "" {
		r.Spec.BackendService = backend
	}
}
var _ webhook.Validator = &JavaAgent{}
func (r *JavaAgent) ValidateCreate() error {
	javaagentlog.Info("validate create", "name", r.Name)
	return r.validate()
}