sigs.k8s.io/cluster-api-provider-aws@v1.5.5/bootstrap/eks/api/v1beta1/eksconfigtemplate_webhook.go (about) 1 /* 2 Copyright 2021 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package v1beta1 18 19 import ( 20 "k8s.io/apimachinery/pkg/runtime" 21 ctrl "sigs.k8s.io/controller-runtime" 22 "sigs.k8s.io/controller-runtime/pkg/webhook" 23 ) 24 25 // SetupWebhookWithManager will setup the webhooks for the EKSConfigTemplate. 26 func (r *EKSConfigTemplate) SetupWebhookWithManager(mgr ctrl.Manager) error { 27 return ctrl.NewWebhookManagedBy(mgr). 28 For(r). 29 Complete() 30 } 31 32 // +kubebuilder:webhook:verbs=create;update,path=/validate-bootstrap-cluster-x-k8s-io-v1beta1-eksconfigtemplate,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=bootstrap.cluster.x-k8s.io,resources=eksconfigtemplate,versions=v1beta1,name=validation.eksconfigtemplates.bootstrap.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 33 // +kubebuilder:webhook:verbs=create;update,path=/mutate-bootstrap-cluster-x-k8s-io-v1beta1-eksconfigtemplate,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=bootstrap.cluster.x-k8s.io,resources=eksconfigtemplate,versions=v1beta1,name=default.eksconfigtemplates.bootstrap.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 34 35 var _ webhook.Defaulter = &EKSConfigTemplate{} 36 var _ webhook.Validator = &EKSConfigTemplate{} 37 38 // ValidateCreate will do any extra validation when creating a EKSConfigTemplate. 39 func (r *EKSConfigTemplate) ValidateCreate() error { 40 return nil 41 } 42 43 // ValidateUpdate will do any extra validation when updating a EKSConfigTemplate. 44 func (r *EKSConfigTemplate) ValidateUpdate(old runtime.Object) error { 45 return nil 46 } 47 48 // ValidateDelete allows you to add any extra validation when deleting. 49 func (r *EKSConfigTemplate) ValidateDelete() error { 50 return nil 51 } 52 53 // Default will set default values for the EKSConfigTemplate. 54 func (r *EKSConfigTemplate) Default() { 55 }