github.com/kubewharf/katalyst-core@v0.5.3/pkg/config/controller/controller_base.go (about) 1 /* 2 Copyright 2022 The Katalyst 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 controller 18 19 import ( 20 componentbaseconfig "k8s.io/component-base/config" 21 ) 22 23 type GenericControllerConfiguration struct { 24 // Controllers is the list of controllers to enable or disable 25 // '*' means "all enabled by default controllers" 26 // 'foo' means "enable 'foo'" 27 // '-foo' means "disable 'foo'" 28 // first item for a particular name wins 29 Controllers []string 30 31 // leaderElection defines the configuration of leader election client. 32 LeaderElection componentbaseconfig.LeaderElectionConfiguration 33 34 // A selector to restrict the list of returned objects by their labels. this selector is 35 // used in informer factory. 36 LabelSelector string 37 38 // since many centralized components need a dynamic mechanism to 39 // list-watch or get GYR from APIServer (such as autoscaling and 40 // service-profiling), we use DynamicGVResources to define those GVRs 41 DynamicGVResources []string 42 } 43 44 type ControllersConfiguration struct { 45 *VPAConfig 46 *KCCConfig 47 *SPDConfig 48 *LifeCycleConfig 49 *MonitorConfig 50 *OvercommitConfig 51 *TideConfig 52 *ResourceRecommenderConfig 53 } 54 55 func NewGenericControllerConfiguration() *GenericControllerConfiguration { 56 return &GenericControllerConfiguration{} 57 } 58 59 func NewControllersConfiguration() *ControllersConfiguration { 60 return &ControllersConfiguration{ 61 VPAConfig: NewVPAConfig(), 62 KCCConfig: NewKCCConfig(), 63 SPDConfig: NewSPDConfig(), 64 LifeCycleConfig: NewLifeCycleConfig(), 65 MonitorConfig: NewMonitorConfig(), 66 OvercommitConfig: NewOvercommitConfig(), 67 TideConfig: NewTideConfig(), 68 ResourceRecommenderConfig: NewResourceRecommenderConfig(), 69 } 70 }