deprecatedcontroller.go 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. Copyright 2018 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package options
  14. import (
  15. "github.com/spf13/pflag"
  16. kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
  17. )
  18. // DeprecatedControllerOptions holds the DeprecatedController options, those option are deprecated.
  19. // TODO remove these fields once the deprecated flags are removed.
  20. type DeprecatedControllerOptions struct {
  21. *kubectrlmgrconfig.DeprecatedControllerConfiguration
  22. }
  23. // AddFlags adds flags related to DeprecatedController for controller manager to the specified FlagSet.
  24. func (o *DeprecatedControllerOptions) AddFlags(fs *pflag.FlagSet) {
  25. if o == nil {
  26. return
  27. }
  28. fs.Float32Var(&o.DeletingPodsQPS, "deleting-pods-qps", 0.1, "Number of nodes per second on which pods are deleted in case of node failure.")
  29. fs.MarkDeprecated("deleting-pods-qps", "This flag is currently no-op and will be deleted.")
  30. fs.Int32Var(&o.DeletingPodsBurst, "deleting-pods-burst", 0, "Number of nodes on which pods are bursty deleted in case of node failure. For more details look into RateLimiter.")
  31. fs.MarkDeprecated("deleting-pods-burst", "This flag is currently no-op and will be deleted.")
  32. fs.Int32Var(&o.RegisterRetryCount, "register-retry-count", o.RegisterRetryCount, ""+
  33. "The number of retries for initial node registration. Retry interval equals node-sync-period.")
  34. fs.MarkDeprecated("register-retry-count", "This flag is currently no-op and will be deleted.")
  35. }
  36. // ApplyTo fills up DeprecatedController config with options.
  37. func (o *DeprecatedControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.DeprecatedControllerConfiguration) error {
  38. if o == nil {
  39. return nil
  40. }
  41. cfg.DeletingPodsQPS = o.DeletingPodsQPS
  42. cfg.DeletingPodsBurst = o.DeletingPodsBurst
  43. cfg.RegisterRetryCount = o.RegisterRetryCount
  44. return nil
  45. }
  46. // Validate checks validation of DeprecatedControllerOptions.
  47. func (o *DeprecatedControllerOptions) Validate() []error {
  48. if o == nil {
  49. return nil
  50. }
  51. errs := []error{}
  52. return errs
  53. }