1 /* 2 Copyright 2018 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 options 18 19 import ( 20 "github.com/spf13/pflag" 21 22 "k8s.io/component-base/cli/globalflag" 23 24 // ensure libs have a chance to globally register their flags 25 _ "k8s.io/apiserver/pkg/admission" 26 _ "k8s.io/kubernetes/pkg/cloudprovider/providers" 27 ) 28 29 // AddCustomGlobalFlags explicitly registers flags that internal packages register 30 // against the global flagsets from "flag". We do this in order to prevent 31 // unwanted flags from leaking into the kube-apiserver's flagset. 32 func AddCustomGlobalFlags(fs *pflag.FlagSet) { 33 // Lookup flags in global flag set and re-register the values with our flagset. 34 35 // Adds flags from k8s.io/kubernetes/pkg/cloudprovider/providers. 36 registerLegacyGlobalFlags(fs) 37 38 // Adds flags from k8s.io/apiserver/pkg/admission. 39 globalflag.Register(fs, "default-not-ready-toleration-seconds") 40 globalflag.Register(fs, "default-unreachable-toleration-seconds") 41 } 42