github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/cloud/cmd/admission/app/options/options.go (about) 1 /* 2 Copyright 2019 The KubeEdge 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 package options 17 18 import ( 19 cliflag "k8s.io/component-base/cli/flag" 20 ) 21 22 // AdmissionOptions admission-controller server config. 23 type AdmissionOptions struct { 24 Master string 25 Kubeconfig string 26 CertFile string 27 KeyFile string 28 CaCertFile string 29 Port int32 30 PrintVersion bool 31 AdmissionServiceName string 32 AdmissionServiceNamespace string 33 SchedulerName string 34 } 35 36 // NewAdmissionOptions create new config 37 func NewAdmissionOptions() *AdmissionOptions { 38 return &AdmissionOptions{} 39 } 40 41 // Flags add flags for admission webhook 42 func (o *AdmissionOptions) Flags() (fss cliflag.NamedFlagSets) { 43 fs := fss.FlagSet("admission") 44 fs.StringVar(&o.Master, "master", o.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)") 45 fs.StringVar(&o.Kubeconfig, "kubeconfig", o.Kubeconfig, "Path to kubeconfig file with authorization and master location information.") 46 fs.StringVar(&o.CertFile, "tls-cert-file", o.CertFile, ""+ 47 "File containing the default x509 Certificate for HTTPS. (CA cert, if any, concatenated "+"after server cert).") 48 fs.StringVar(&o.KeyFile, "tls-private-key-file", o.KeyFile, "File containing the default x509 private key matching --tls-cert-file.") 49 fs.StringVar(&o.CaCertFile, "ca-cert-file", o.CaCertFile, "File containing the x509 Certificate for HTTPS.") 50 fs.Int32Var(&o.Port, "port", 443, "the port used by admission-controller-server.") 51 fs.StringVar(&o.AdmissionServiceNamespace, "webhook-namespace", "kubeedge", "The namespace of this webhook") 52 fs.StringVar(&o.AdmissionServiceName, "webhook-service-name", "kubeedge-admission-service", "The name of this admission service") 53 return 54 }