k8s.io/kubernetes@v1.31.0-alpha.0.0.20240520171757-56147500dadc/cmd/kube-controller-manager/app/options/deploymentcontroller.go (about) 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 deploymentconfig "k8s.io/kubernetes/pkg/controller/deployment/config" 23 ) 24 25 // DeploymentControllerOptions holds the DeploymentController options. 26 type DeploymentControllerOptions struct { 27 *deploymentconfig.DeploymentControllerConfiguration 28 } 29 30 // AddFlags adds flags related to DeploymentController for controller manager to the specified FlagSet. 31 func (o *DeploymentControllerOptions) AddFlags(fs *pflag.FlagSet) { 32 if o == nil { 33 return 34 } 35 36 fs.Int32Var(&o.ConcurrentDeploymentSyncs, "concurrent-deployment-syncs", o.ConcurrentDeploymentSyncs, "The number of deployment objects that are allowed to sync concurrently. Larger number = more responsive deployments, but more CPU (and network) load") 37 } 38 39 // ApplyTo fills up DeploymentController config with options. 40 func (o *DeploymentControllerOptions) ApplyTo(cfg *deploymentconfig.DeploymentControllerConfiguration) error { 41 if o == nil { 42 return nil 43 } 44 45 cfg.ConcurrentDeploymentSyncs = o.ConcurrentDeploymentSyncs 46 47 return nil 48 } 49 50 // Validate checks validation of DeploymentControllerOptions. 51 func (o *DeploymentControllerOptions) Validate() []error { 52 if o == nil { 53 return nil 54 } 55 56 errs := []error{} 57 return errs 58 }