...

Source file src/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/ttlafterfinishedcontroller.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  	"fmt"
    21  
    22  	"github.com/spf13/pflag"
    23  
    24  	"k8s.io/kubernetes/cmd/kube-controller-manager/names"
    25  	ttlafterfinishedconfig "k8s.io/kubernetes/pkg/controller/ttlafterfinished/config"
    26  )
    27  
    28  // TTLAfterFinishedControllerOptions holds the TTLAfterFinishedController options.
    29  type TTLAfterFinishedControllerOptions struct {
    30  	*ttlafterfinishedconfig.TTLAfterFinishedControllerConfiguration
    31  }
    32  
    33  // AddFlags adds flags related to TTLAfterFinishedController for controller manager to the specified FlagSet.
    34  func (o *TTLAfterFinishedControllerOptions) AddFlags(fs *pflag.FlagSet) {
    35  	if o == nil {
    36  		return
    37  	}
    38  
    39  	fs.Int32Var(&o.ConcurrentTTLSyncs, "concurrent-ttl-after-finished-syncs", o.ConcurrentTTLSyncs, fmt.Sprintf("The number of %s workers that are allowed to sync concurrently.", names.TTLAfterFinishedController))
    40  }
    41  
    42  // ApplyTo fills up TTLAfterFinishedController config with options.
    43  func (o *TTLAfterFinishedControllerOptions) ApplyTo(cfg *ttlafterfinishedconfig.TTLAfterFinishedControllerConfiguration) error {
    44  	if o == nil {
    45  		return nil
    46  	}
    47  
    48  	cfg.ConcurrentTTLSyncs = o.ConcurrentTTLSyncs
    49  
    50  	return nil
    51  }
    52  
    53  // Validate checks validation of TTLAfterFinishedControllerOptions.
    54  func (o *TTLAfterFinishedControllerOptions) Validate() []error {
    55  	if o == nil {
    56  		return nil
    57  	}
    58  
    59  	errs := []error{}
    60  	return errs
    61  }
    62  

View as plain text