priorityclasses.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. Copyright 2019 The Rook Authors. All rights reserved.
  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 v1
  14. // All returns the priority class name defined for 'all' daemons in the Ceph cluster CRD.
  15. func (p PriorityClassNamesSpec) All() string {
  16. if val, ok := p[KeyAll]; ok {
  17. return val
  18. }
  19. return ""
  20. }
  21. // GetMgrPriorityClassName returns the priority class name for the MGR service
  22. func GetMgrPriorityClassName(p PriorityClassNamesSpec) string {
  23. if _, ok := p[KeyMgr]; !ok {
  24. return p.All()
  25. }
  26. return p[KeyMgr]
  27. }
  28. // GetMonPriorityClassName returns the priority class name for the monitors
  29. func GetMonPriorityClassName(p PriorityClassNamesSpec) string {
  30. if _, ok := p[KeyMon]; !ok {
  31. return p.All()
  32. }
  33. return p[KeyMon]
  34. }
  35. // GetOSDPriorityClassName returns the priority class name for the OSDs
  36. func GetOSDPriorityClassName(p PriorityClassNamesSpec) string {
  37. if _, ok := p[KeyOSD]; !ok {
  38. return p.All()
  39. }
  40. return p[KeyOSD]
  41. }
  42. // GetCleanupPriorityClassName returns the priority class name for the cleanup job
  43. func GetCleanupPriorityClassName(p PriorityClassNamesSpec) string {
  44. if _, ok := p[KeyCleanup]; !ok {
  45. return p.All()
  46. }
  47. return p[KeyCleanup]
  48. }
  49. // GetCrashCollectorPriorityClassName returns the priority class name for the crashcollector
  50. func GetCrashCollectorPriorityClassName(p PriorityClassNamesSpec) string {
  51. if _, ok := p[KeyCrashCollector]; !ok {
  52. return p.All()
  53. }
  54. return p[KeyCrashCollector]
  55. }
  56. // GetCephExporterPriorityClassName returns the priority class name for the ceph-exporter
  57. func GetCephExporterPriorityClassName(p PriorityClassNamesSpec) string {
  58. if _, ok := p[KeyCephExporter]; !ok {
  59. return p.All()
  60. }
  61. return p[KeyCephExporter]
  62. }