SGShardedBackup.yaml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. apiVersion: apiextensions.k8s.io/v1
  2. kind: CustomResourceDefinition
  3. metadata:
  4. name: sgshardedbackups.stackgres.io
  5. spec:
  6. group: stackgres.io
  7. scope: Namespaced
  8. names:
  9. kind: SGShardedBackup
  10. listKind: SGShardedBackupList
  11. plural: sgshardedbackups
  12. singular: sgshardedbackup
  13. shortNames:
  14. - sgsbk
  15. versions:
  16. - name: v1
  17. served: true
  18. storage: true
  19. additionalPrinterColumns:
  20. - name: cluster
  21. type: string
  22. jsonPath: .spec.sgShardedCluster
  23. - name: managed
  24. type: string
  25. jsonPath: .spec.managedLifecycle
  26. - name: status
  27. type: string
  28. jsonPath: .status.process.status
  29. - name: pg-version
  30. type: string
  31. jsonPath: .status.backupInformation.postgresVersion
  32. priority: 1
  33. - name: compressed-size
  34. type: integer
  35. format: byte
  36. jsonPath: .status.backupInformation.size.compressed
  37. priority: 1
  38. schema:
  39. openAPIV3Schema:
  40. type: object
  41. required: [metadata, spec]
  42. description: |
  43. A manual or automatically generated sharded backup of an SGCluster configured with an SGBackupConfig.
  44. When a SGBackup is created a Job will perform a full sharded backup of the database and update the status of the SGBackup
  45. with the all the information required to restore it and some stats (or a failure message in case something unexpected
  46. happened).
  47. After an SGBackup is created the same Job performs a reconciliation of the sharded backups by applying the retention window
  48. that has been configured in the SGBackupConfig and removing the sharded backups with managed lifecycle and the WAL files older
  49. than the ones that fit in the retention window. The reconciliation also removes sharded backups (excluding WAL files) that do
  50. not belongs to any SGBackup. If the target storage of the SGBackupConfig is changed deletion of an SGBackup sharded backups
  51. with managed lifecycle and the WAL files older than the ones that fit in the retention window and of sharded backups that do
  52. not belongs to any SGBackup will not be performed anymore on the previous storage, only on the new target storage.
  53. properties:
  54. metadata:
  55. type: object
  56. properties:
  57. name:
  58. type: string
  59. maxLength: 56
  60. pattern: "^[a-z]([-a-z0-9]*[a-z0-9])?$"
  61. description: |
  62. Name of the sharded backup. Following [Kubernetes naming conventions](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/architecture/identifiers.md), it must be an rfc1035/rfc1123 subdomain, that is, up to 253 characters consisting of one or more lowercase labels separated by `.`. Where each label is an alphanumeric (a-z, and 0-9) string, with the `-` character allowed anywhere except the first or last character.
  63. The name must be unique across all StackGres sharded backups in the same namespace."
  64. spec:
  65. type: object
  66. properties:
  67. sgShardedCluster:
  68. type: string
  69. description: |
  70. The name of the `SGShardedCluster` from which this sharded backup is/will be taken.
  71. If this is a copy of an existing completed sharded backup in a different namespace
  72. the value must be prefixed with the namespace of the source backup and a
  73. dot `.` (e.g. `<sharded cluster namespace>.<sharded cluster name>`) or have the same value
  74. if the source sharded backup is also a copy.
  75. managedLifecycle:
  76. type: boolean
  77. description: |
  78. Indicate if this sharded backup is permanent and should not be removed by the automated
  79. retention policy. Default is `false`.
  80. timeout:
  81. type: integer
  82. description: |
  83. Allow to set a timeout for the backup creation.
  84. If not set it will be disabled and the backup operation will continue until the backup completes or fail. If set to 0 is the same as not being set.
  85. Make sure to set a reasonable high value in order to allow for any unexpected delays during backup creation (network low bandwidth, disk low throughput and so forth).
  86. reconciliationTimeout:
  87. type: integer
  88. default: 300
  89. description: |
  90. Allow to set a timeout for the reconciliation process that take place after the backup.
  91. If not set defaults to 300 (5 minutes). If set to 0 it will disable timeout.
  92. Failure of reconciliation will not make the backup fail and will be re-tried the next time a SGBackup
  93. or shecduled backup Job take place.
  94. maxRetries:
  95. type: integer
  96. description: |
  97. The maximum number of retries the backup operation is allowed to do after a failure.
  98. A value of `0` (zero) means no retries are made. Defaults to: `3`.
  99. status:
  100. type: object
  101. properties:
  102. sgBackups:
  103. type: array
  104. description: |
  105. The list of SGBackups that compose the SGShardedBackup used to restore the sharded cluster.
  106. items:
  107. type: string
  108. description: |
  109. One of the SGBackups that compose the SGShardedBackup used to restore the sharded cluster.
  110. process:
  111. type: object
  112. properties:
  113. status:
  114. type: string
  115. description: |
  116. Status of the sharded backup.
  117. failure:
  118. type: string
  119. description: |
  120. If the status is `failed` this field will contain a message indicating the failure reason.
  121. jobPod:
  122. type: string
  123. description: |
  124. Name of the pod assigned to the sharded backup. StackGres utilizes internally a locking mechanism based on the pod name of the job that creates the sharded backup.
  125. timing:
  126. type: object
  127. properties:
  128. start:
  129. type: string
  130. # format: date-time
  131. description: |
  132. Start time of sharded backup.
  133. end:
  134. type: string
  135. # format: date-time
  136. description: |
  137. End time of sharded backup.
  138. stored:
  139. type: string
  140. # format: date-time
  141. description: |
  142. Time at which the sharded backup is safely stored in the object storage.
  143. backupInformation:
  144. type: object
  145. properties:
  146. postgresVersion:
  147. type: string
  148. description: |
  149. Postgres version of the server where the sharded backup is taken from.
  150. size:
  151. type: object
  152. properties:
  153. uncompressed:
  154. type: integer
  155. format: int64
  156. description: |
  157. Size (in bytes) of the uncompressed sharded backup.
  158. compressed:
  159. type: integer
  160. format: int64
  161. description: |
  162. Size (in bytes) of the compressed sharded backup.