...
1
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
26 type GarbageCollectorControllerOptions struct {
27 *garbagecollectorconfig.GarbageCollectorControllerConfiguration
28 }
29
30
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
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
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