volcano.sh/volcano@v1.9.0/pkg/webhooks/router/interface.go (about) 1 /* 2 Copyright 2019 The Volcano 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 router 18 19 import ( 20 admissionv1 "k8s.io/api/admission/v1" 21 whv1 "k8s.io/api/admissionregistration/v1" 22 "k8s.io/client-go/kubernetes" 23 "k8s.io/client-go/tools/record" 24 25 "volcano.sh/apis/pkg/client/clientset/versioned" 26 "volcano.sh/volcano/pkg/webhooks/config" 27 ) 28 29 // The AdmitFunc returns response. 30 type AdmitFunc func(admissionv1.AdmissionReview) *admissionv1.AdmissionResponse 31 32 type AdmissionServiceConfig struct { 33 SchedulerNames []string 34 KubeClient kubernetes.Interface 35 VolcanoClient versioned.Interface 36 Recorder record.EventRecorder 37 ConfigData *config.AdmissionConfiguration 38 } 39 40 type AdmissionService struct { 41 Path string 42 Func AdmitFunc 43 Handler AdmissionHandler 44 45 ValidatingConfig *whv1.ValidatingWebhookConfiguration 46 MutatingConfig *whv1.MutatingWebhookConfiguration 47 48 Config *AdmissionServiceConfig 49 }