...

Source file src/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/endpointcontroller.go

Documentation: k8s.io/kubernetes/cmd/kube-controller-manager/app/options

     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  	endpointconfig "k8s.io/kubernetes/pkg/controller/endpoint/config"
    23  )
    24  
    25  // EndpointControllerOptions holds the EndPointController options.
    26  type EndpointControllerOptions struct {
    27  	*endpointconfig.EndpointControllerConfiguration
    28  }
    29  
    30  // AddFlags adds flags related to EndPointController for controller manager to the specified FlagSet.
    31  func (o *EndpointControllerOptions) AddFlags(fs *pflag.FlagSet) {
    32  	if o == nil {
    33  		return
    34  	}
    35  
    36  	fs.Int32Var(&o.ConcurrentEndpointSyncs, "concurrent-endpoint-syncs", o.ConcurrentEndpointSyncs, "The number of endpoint syncing operations that will be done concurrently. Larger number = faster endpoint updating, but more CPU (and network) load")
    37  	fs.DurationVar(&o.EndpointUpdatesBatchPeriod.Duration, "endpoint-updates-batch-period", o.EndpointUpdatesBatchPeriod.Duration, "The length of endpoint updates batching period. Processing of pod changes will be delayed by this duration to join them with potential upcoming updates and reduce the overall number of endpoints updates. Larger number = higher endpoint programming latency, but lower number of endpoints revision generated")
    38  }
    39  
    40  // ApplyTo fills up EndPointController config with options.
    41  func (o *EndpointControllerOptions) ApplyTo(cfg *endpointconfig.EndpointControllerConfiguration) error {
    42  	if o == nil {
    43  		return nil
    44  	}
    45  
    46  	cfg.ConcurrentEndpointSyncs = o.ConcurrentEndpointSyncs
    47  	cfg.EndpointUpdatesBatchPeriod = o.EndpointUpdatesBatchPeriod
    48  
    49  	return nil
    50  }
    51  
    52  // Validate checks validation of EndpointControllerOptions.
    53  func (o *EndpointControllerOptions) Validate() []error {
    54  	if o == nil {
    55  		return nil
    56  	}
    57  
    58  	errs := []error{}
    59  	return errs
    60  }
    61  

View as plain text