func (r *Iamrole) ValidateCreate() error {
	log := log.Logger(context.Background(), "v1alpha1", "ValidateCreate")
	log.Info("validating create request", "name", r.Name)
	return r.validateIAMPolicy(false)
}
ValidateCreate implements webhook.Validator so a webhook will be registered for the type
package v1alpha1
import (
	"context"
	"fmt"
	"github.com/keikoproj/iam-manager/internal/config"
	"github.com/keikoproj/iam-manager/pkg/log"
	"strings"
	"github.com/keikoproj/iam-manager/pkg/k8s"
	apierrors "k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
	validationutils "k8s.io/apimachinery/pkg/util/validation"
	"k8s.io/apimachinery/pkg/util/validation/field"
	ctrl "sigs.k8s.io/controller-runtime"
	logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
	"sigs.k8s.io/controller-runtime/pkg/webhook"
)
const (
	version = "2012-10-17"
)
var iamrolelog = logf.Log.WithName("iamrole-resource")
var wClient *k8s.Client
func NewWClient() {
	log := log.Logger(context.Background(), "v1alpha1", "NewWClient")
	log.Info("loading k8s client")
	k8sClient, err := k8s.NewK8sClient()
	if err != nil {
		log.Error(err, "unable to create new k8s client")
		panic(err)
	}
	wClient = k8sClient
}
func (r *Iamrole) SetupWebhookWithManager(mgr ctrl.Manager) error {
	return ctrl.NewWebhookManagedBy(mgr).
		For(r).
		Complete()
}
var _ webhook.Defaulter = &Iamrole{}
func (r *Iamrole) Default() {
	log := log.Logger(context.Background(), "v1alpha1", "Default")
	log.Info("setting default version", "name", r.Name)
	if r.Spec.PolicyDocument.Version == "" {
		r.Spec.PolicyDocument.Version = version
	}
}
var _ webhook.Validator = &Iamrole{}