defaults.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. Copyright 2019 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 v1alpha1
  14. import (
  15. kubectrlmgrconfigv1alpha1 "k8s.io/kube-controller-manager/config/v1alpha1"
  16. )
  17. // RecommendedDefaultStatefulSetControllerConfiguration defaults a pointer to a
  18. // StatefulSetControllerConfiguration struct. This will set the recommended default
  19. // values, but they may be subject to change between API versions. This function
  20. // is intentionally not registered in the scheme as a "normal" `SetDefaults_Foo`
  21. // function to allow consumers of this type to set whatever defaults for their
  22. // embedded configs. Forcing consumers to use these defaults would be problematic
  23. // as defaulting in the scheme is done as part of the conversion, and there would
  24. // be no easy way to opt-out. Instead, if you want to use this defaulting method
  25. // run it in your wrapper struct of this type in its `SetDefaults_` method.
  26. func RecommendedDefaultStatefulSetControllerConfiguration(obj *kubectrlmgrconfigv1alpha1.StatefulSetControllerConfiguration) {
  27. if obj.ConcurrentStatefulSetSyncs == 0 {
  28. obj.ConcurrentStatefulSetSyncs = 5
  29. }
  30. }