func getResourceMutatingWebhookConfigName(serverIP string) string {
	if serverIP != "" {
		return config.MutatingWebhookConfigurationDebugName
	}
	return config.MutatingWebhookConfigurationName
}
getResourceMutatingWebhookConfigName returns the webhook configuration name
package webhookconfig
import (
	"fmt"
	"sync"
	"github.com/kyverno/kyverno/pkg/config"
	admregapi "k8s.io/api/admissionregistration/v1"
	errorsapi "k8s.io/apimachinery/pkg/api/errors"
	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func (wrc *Register) defaultResourceWebhookRule() admregapi.Rule {
	if wrc.autoUpdateWebhooks {
		return admregapi.Rule{}
	}
	return admregapi.Rule{
		Resources:   []string{"*/*"},
		APIGroups:   []string{"*"},
		APIVersions: []string{"*"},
	}
}
func (wrc *Register) constructDefaultDebugMutatingWebhookConfig(caData []byte) *admregapi.MutatingWebhookConfiguration {
	logger := wrc.log
	url := fmt.Sprintf("https://%s%s", wrc.serverIP, config.MutatingWebhookServicePath)
	logger.V(4).Info("Debug MutatingWebhookConfig registered", "url", url)
	return &admregapi.MutatingWebhookConfiguration{
		ObjectMeta: v1.ObjectMeta{
			Name: config.MutatingWebhookConfigurationDebugName,
		},
		Webhooks: []admregapi.MutatingWebhook{
			generateDebugMutatingWebhook(
				config.MutatingWebhookName+"-ignore",
				url,
				caData,
				true,
				wrc.timeoutSeconds,
				wrc.defaultResourceWebhookRule(),
				[]admregapi.OperationType{admregapi.Create, admregapi.Update},
				admregapi.Ignore,
			),
			generateDebugMutatingWebhook(
				config.MutatingWebhookName+"-fail",
				url,
				caData,
				true,
				wrc.timeoutSeconds,
				wrc.defaultResourceWebhookRule(),
				[]admregapi.OperationType{admregapi.Create, admregapi.Update},
				admregapi.Fail,
			),
		},
	}
}
func (wrc *Register) constructDefaultMutatingWebhookConfig(caData []byte) *admregapi.MutatingWebhookConfiguration {
	return &admregapi.MutatingWebhookConfiguration{
		ObjectMeta: v1.ObjectMeta{
			Name: config.MutatingWebhookConfigurationName,
			OwnerReferences: []v1.OwnerReference{
				wrc.constructOwner(),
			},
		},
		Webhooks: []admregapi.MutatingWebhook{
			generateMutatingWebhook(
				config.MutatingWebhookName+"-ignore",
				config.MutatingWebhookServicePath,
				caData,
				false,
				wrc.timeoutSeconds,
				wrc.defaultResourceWebhookRule(),
				[]admregapi.OperationType{admregapi.Create, admregapi.Update},
				admregapi.Ignore,
			),
			generateMutatingWebhook(
				config.MutatingWebhookName+"-fail",
				config.MutatingWebhookServicePath,
				caData,
				false,
				wrc.timeoutSeconds,
				wrc.defaultResourceWebhookRule(),
				[]admregapi.OperationType{admregapi.Create, admregapi.Update},
				admregapi.Fail,
			),
		},
	}
}