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