...

Source file src/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/garbagecollectorcontroller.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  	garbagecollectorconfig "k8s.io/kubernetes/pkg/controller/garbagecollector/config"
    23  )
    24  
    25  // GarbageCollectorControllerOptions holds the GarbageCollectorController options.
    26  type GarbageCollectorControllerOptions struct {
    27  	*garbagecollectorconfig.GarbageCollectorControllerConfiguration
    28  }
    29  
    30  // AddFlags adds flags related to GarbageCollectorController for controller manager to the specified FlagSet.
    31  func (o *GarbageCollectorControllerOptions) AddFlags(fs *pflag.FlagSet) {
    32  	if o == nil {
    33  		return
    34  	}
    35  
    36  	fs.Int32Var(&o.ConcurrentGCSyncs, "concurrent-gc-syncs", o.ConcurrentGCSyncs, "The number of garbage collector workers that are allowed to sync concurrently.")
    37  	fs.BoolVar(&o.EnableGarbageCollector, "enable-garbage-collector", o.EnableGarbageCollector, "Enables the generic garbage collector. MUST be synced with the corresponding flag of the kube-apiserver.")
    38  }
    39  
    40  // ApplyTo fills up GarbageCollectorController config with options.
    41  func (o *GarbageCollectorControllerOptions) ApplyTo(cfg *garbagecollectorconfig.GarbageCollectorControllerConfiguration) error {
    42  	if o == nil {
    43  		return nil
    44  	}
    45  
    46  	cfg.ConcurrentGCSyncs = o.ConcurrentGCSyncs
    47  	cfg.GCIgnoredResources = o.GCIgnoredResources
    48  	cfg.EnableGarbageCollector = o.EnableGarbageCollector
    49  
    50  	return nil
    51  }
    52  
    53  // Validate checks validation of GarbageCollectorController.
    54  func (o *GarbageCollectorControllerOptions) Validate() []error {
    55  	if o == nil {
    56  		return nil
    57  	}
    58  
    59  	errs := []error{}
    60  	return errs
    61  }
    62  

View as plain text