osd-purge.yaml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #################################################################################################################
  2. # We need many operations to remove OSDs as written in Documentation/Storage-Configuration/Advanced/ceph-osd-mgmt.md.
  3. # This job can automate some of that operations: mark OSDs as `out`, purge these OSDs,
  4. # and delete the corresponding resources like OSD deployments, OSD prepare jobs, and PVCs.
  5. #
  6. # Please note the following.
  7. #
  8. # - This job only works for `down` OSDs.
  9. # - This job doesn't wait for backfilling to be completed.
  10. #
  11. # If you want to remove `up` OSDs and/or want to wait for backfilling to be completed between each OSD removal,
  12. # please do it by hand.
  13. #################################################################################################################
  14. apiVersion: batch/v1
  15. kind: Job
  16. metadata:
  17. name: rook-ceph-purge-osd
  18. namespace: nicki-ns
  19. labels:
  20. app: rook-ceph-purge-osd
  21. spec:
  22. template:
  23. metadata:
  24. labels:
  25. app: rook-ceph-purge-osd
  26. spec:
  27. serviceAccountName: rook-ceph-purge-osd
  28. containers:
  29. - name: osd-removal
  30. image: rook/ceph:master
  31. # TODO: Insert the OSD ID in the last parameter that is to be removed
  32. # The OSD IDs are a comma-separated list. For example: "0" or "0,2".
  33. # If you want to preserve the OSD PVCs, set `--preserve-pvc true`.
  34. #
  35. # A --force-osd-removal option is available if the OSD should be destroyed even though the
  36. # removal could lead to data loss.
  37. args:
  38. - "ceph"
  39. - "osd"
  40. - "remove"
  41. - "--preserve-pvc"
  42. - "false"
  43. - "--force-osd-removal"
  44. - "false"
  45. - "--osd-ids"
  46. - "3"
  47. env:
  48. - name: POD_NAMESPACE
  49. valueFrom:
  50. fieldRef:
  51. fieldPath: metadata.namespace
  52. - name: ROOK_MON_ENDPOINTS
  53. valueFrom:
  54. configMapKeyRef:
  55. key: data
  56. name: rook-ceph-mon-endpoints
  57. - name: ROOK_CEPH_USERNAME
  58. valueFrom:
  59. secretKeyRef:
  60. key: ceph-username
  61. name: rook-ceph-mon
  62. - name: ROOK_CONFIG_DIR
  63. value: /var/lib/rook
  64. - name: ROOK_CEPH_CONFIG_OVERRIDE
  65. value: /etc/rook/config/override.conf
  66. - name: ROOK_FSID
  67. valueFrom:
  68. secretKeyRef:
  69. key: fsid
  70. name: rook-ceph-mon
  71. - name: ROOK_LOG_LEVEL
  72. value: DEBUG
  73. volumeMounts:
  74. - mountPath: /etc/ceph
  75. name: ceph-conf-emptydir
  76. - mountPath: /var/lib/rook
  77. name: rook-config
  78. - name: ceph-admin-secret
  79. mountPath: /var/lib/rook-ceph-mon
  80. volumes:
  81. - name: ceph-admin-secret
  82. secret:
  83. secretName: rook-ceph-mon
  84. optional: false
  85. items:
  86. - key: ceph-secret
  87. path: secret.keyring
  88. - emptyDir: {}
  89. name: ceph-conf-emptydir
  90. - emptyDir: {}
  91. name: rook-config
  92. restartPolicy: Never