SGInstanceProfile.yaml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. apiVersion: apiextensions.k8s.io/v1
  2. kind: CustomResourceDefinition
  3. metadata:
  4. name: sginstanceprofiles.stackgres.io
  5. spec:
  6. group: stackgres.io
  7. scope: Namespaced
  8. names:
  9. kind: SGInstanceProfile
  10. listKind: SGInstanceProfileList
  11. plural: sginstanceprofiles
  12. singular: sginstanceprofile
  13. shortNames:
  14. - sginp
  15. versions:
  16. - name: v1
  17. served: true
  18. storage: true
  19. additionalPrinterColumns:
  20. - name: cpu
  21. type: string
  22. jsonPath: .spec.cpu
  23. - name: memory
  24. type: string
  25. jsonPath: .spec.memory
  26. schema:
  27. openAPIV3Schema:
  28. required: ["metadata", "spec"]
  29. type: object
  30. properties:
  31. metadata:
  32. type: object
  33. properties:
  34. name:
  35. type: string
  36. description: |
  37. Name of the Instance Profile. An instance profile represents a "kind" of
  38. server (CPU and RAM) where you may run StackGres Pods, classified by a given name.
  39. The profile may be referenced by zero or more SGClusters, and if so it would
  40. be referenced by its name. 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.
  41. The name must be unique across all instance profiles in the same namespace.
  42. spec:
  43. type: object
  44. properties:
  45. cpu:
  46. type: string
  47. pattern: '^[1-9][0-9]*[m]?$'
  48. description: |
  49. CPU(s) (cores) limits for every resource's Pod that reference this SGInstanceProfile. The suffix `m`
  50. specifies millicpus (where 1000m is equals to 1).
  51. The number of cpu limits is assigned to the patroni container (that runs both Patroni and PostgreSQL).
  52. A minimum of 2 cpu is recommended.
  53. memory:
  54. type: string
  55. pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
  56. description: |
  57. RAM limits for every resource's Pod that reference this SGInstanceProfile. The suffix `Mi` or `Gi`
  58. specifies Mebibytes or Gibibytes, respectively.
  59. The amount of RAM limits is assigned to the patroni container (that runs both Patroni and PostgreSQL).
  60. A minimum of 2Gi is recommended.
  61. hugePages:
  62. type: object
  63. description: |
  64. RAM limits allocated for huge pages of the patroni container (that runs both Patroni and PostgreSQL).
  65. properties:
  66. hugepages-2Mi:
  67. type: string
  68. pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
  69. description: |
  70. RAM limits allocated for huge pages of the patroni container (that runs both Patroni and PostgreSQL) with a size of 2Mi. The suffix `Mi` or `Gi`
  71. specifies Mebibytes or Gibibytes, respectively.
  72. hugepages-1Gi:
  73. type: string
  74. pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
  75. description: |
  76. RAM limits allocated for huge pages of the patroni container (that runs both Patroni and PostgreSQL) with a size of 1Gi. The suffix `Mi` or `Gi`
  77. specifies Mebibytes or Gibibytes, respectively.
  78. containers:
  79. type: object
  80. description: |
  81. The CPU(s) (cores) and RAM limits assigned to containers other than patroni container.
  82. additionalProperties:
  83. type: object
  84. description: |
  85. The CPU(s) (cores) and RAM limits assigned to a container.
  86. This section, if left empty, will be filled automatically by the operator with
  87. some defaults that can be proportional to the resources limits assigned to patroni
  88. container (except for the huge pages that are always left untouched).
  89. properties:
  90. cpu:
  91. type: string
  92. pattern: '^[1-9][0-9]*[m]?$'
  93. description: |
  94. CPU(s) (cores) limits for the specified container. The suffix `m`
  95. specifies millicpus (where 1000m is equals to 1).
  96. memory:
  97. type: string
  98. pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
  99. description: |
  100. RAM limits for the specified container. The suffix `Mi` or `Gi`
  101. specifies Mebibytes or Gibibytes, respectively.
  102. hugePages:
  103. type: object
  104. description: |
  105. RAM limits for huge pages for the specified container.
  106. properties:
  107. hugepages-2Mi:
  108. type: string
  109. pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
  110. description: |
  111. RAM limits for huge pages of the specified container with a size of 2Mi. The suffix `Mi`
  112. or `Gi` specifies Mebibytes or Gibibytes, respectively.
  113. hugepages-1Gi:
  114. type: string
  115. pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
  116. description: |
  117. RAM limits for huge pages of the specified container with a size of 1Gi. The suffix `Mi`
  118. or `Gi` specifies Mebibytes or Gibibytes, respectively.
  119. initContainers:
  120. type: object
  121. description: The CPU(s) (cores) and RAM limits assigned to the init containers.
  122. additionalProperties:
  123. type: object
  124. description: |
  125. The CPU(s) (cores) and RAM limits assigned to a init container.
  126. This section will be filled automatically by the operator with
  127. the same values of the resources limits assigned to patroni
  128. container (except for the huge pages that are always left untouched).
  129. properties:
  130. cpu:
  131. type: string
  132. pattern: '^[1-9][0-9]*[m]?$'
  133. description: |
  134. CPU(s) (cores) limits for the specified init container. The suffix
  135. `m` specifies millicpus (where 1000m is equals to 1).
  136. memory:
  137. type: string
  138. pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
  139. description: |
  140. RAM limits for the specified init container. The suffix `Mi`
  141. or `Gi` specifies Mebibytes or Gibibytes, respectively.
  142. hugePages:
  143. type: object
  144. description: |
  145. RAM limits for huge pages of the specified init container
  146. properties:
  147. hugepages-2Mi:
  148. type: string
  149. pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
  150. description: |
  151. RAM limits for huge pages of the specified init container with a size of 2Mi. The suffix `Mi`
  152. or `Gi` specifies Mebibytes or Gibibytes, respectively.
  153. hugepages-1Gi:
  154. type: string
  155. pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
  156. description: |
  157. RAM limits for huge pages of the specified init container with a size of 1Gi. The suffix `Mi` or `Gi`
  158. specifies Mebibytes or Gibibytes, respectively.
  159. requests:
  160. type: object
  161. description: |
  162. This section allow to configure the resources requests for each container and, if not specified, it is filled with some defaults based on the fields `.spec.cpu` and `.spec.memory` will be set.
  163. On containerized environments, when running production workloads, enforcing container's resources requirements requests to be equals to the limits in order to achieve the highest level of performance. Doing so, reduces the chances of leaving
  164. the workload with less resources than it requires. It also allow to set [static CPU management policy](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#static-policy) that allows to guarantee a pod the usage exclusive CPUs on the node.
  165. There are cases where you may need to set cpu requests to the same value as cpu limits in order to achieve static CPU management policy.
  166. By default the resources requests values in fields `.spec.requests.cpu` and `.spec.requests.memory` represent the total resources requests assigned to each resource's Pod that reference this SGInstanceProfile.
  167. The resources requests of the patroni container (that runs both Patroni and PostgreSQL) is calculated by subtracting from the total resources requests the resources requests of other containers that are present in the Pod.
  168. To change this behavior and having the resources requests values in fields `.spec.requests.cpu` and `.spec.requests.memory` to represent the resources requests of the patroni container and the total resources requests
  169. calculated by adding the resources requests of all the containers (including the patroni container) you may set one or more of the following fields to `true`
  170. (depending on the resource's Pods you need this behaviour to be changed):
  171. * `SGCluster.spec.pods.resources.disableResourcesRequestsSplitFromTotal`
  172. * `SGShardedCluster.spec.coordinator.pods.resources.disableResourcesRequestsSplitFromTotal`
  173. * `SGShardedCluster.spec.shards.pods.resources.disableResourcesRequestsSplitFromTotal`
  174. * `SGShardedCluster.spec.shards.ovewrites.pods.resources.disableResourcesRequestsSplitFromTotal`
  175. * `SGDistributedLogs.spec.resources.disableResourcesRequestsSplitFromTotal`
  176. properties:
  177. cpu:
  178. type: string
  179. pattern: '^[1-9][0-9]*[m]?$'
  180. description: |
  181. CPU(s) (cores) requests for every resource's Pod that reference this SGInstanceProfile. The suffix `m`
  182. specifies millicpus (where 1000m is equals to 1).
  183. By default the cpu requests values in field `.spec.requests.cpu` represent the total cpu requests assigned to each resource's Pod that reference this SGInstanceProfile.
  184. The cpu requests of the patroni container (that runs both Patroni and PostgreSQL) is calculated by subtracting from the total cpu requests the cpu requests of other containers that are present in the Pod.
  185. To change this behavior and having the cpu requests values in field `.spec.requests.cpu` to represent the cpu requests of the patroni container and the total cpu requests
  186. calculated by adding the cpu requests of all the containers (including the patroni container) you may set one or more of the following fields to `true`
  187. (depending on the resource's Pods you need this behaviour to be changed):
  188. * `SGCluster.spec.pods.resources.disableResourcesRequestsSplitFromTotal`
  189. * `SGShardedCluster.spec.coordinator.pods.resources.disableResourcesRequestsSplitFromTotal`
  190. * `SGShardedCluster.spec.shards.pods.resources.disableResourcesRequestsSplitFromTotal`
  191. * `SGShardedCluster.spec.shards.ovewrites.pods.resources.disableResourcesRequestsSplitFromTotal`
  192. * `SGDistributedLogs.spec.resources.disableResourcesRequestsSplitFromTotal`
  193. memory:
  194. type: string
  195. pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
  196. description: |
  197. RAM requests for every resource's Pod that reference this SGInstanceProfile. The suffix `Mi` or `Gi`
  198. specifies Mebibytes or Gibibytes, respectively.
  199. By default the memory requests values in field `.spec.requests.memory` represent the total memory requests assigned to each resource's Pod that reference this SGInstanceProfile.
  200. The memory requests of the patroni container (that runs both Patroni and PostgreSQL) is calculated by subtracting from the total memory requests the memory requests of other containers that are present in the Pod.
  201. To change this behavior and having the memory requests values in field `.spec.requests.memory` to represent the memory requests of the patroni container and the total memory requests
  202. calculated by adding the memory requests of all the containers (including the patroni container) you may set one or more of the following fields to `true`
  203. (depending on the resource's Pods you need this behaviour to be changed):
  204. * `SGCluster.spec.pods.resources.disableResourcesRequestsSplitFromTotal`
  205. * `SGShardedCluster.spec.coordinator.pods.resources.disableResourcesRequestsSplitFromTotal`
  206. * `SGShardedCluster.spec.shards.pods.resources.disableResourcesRequestsSplitFromTotal`
  207. * `SGShardedCluster.spec.shards.ovewrites.pods.resources.disableResourcesRequestsSplitFromTotal`
  208. * `SGDistributedLogs.spec.resources.disableResourcesRequestsSplitFromTotal`
  209. containers:
  210. type: object
  211. description: |
  212. The CPU(s) (cores) and RAM requests assigned to containers other than patroni container.
  213. additionalProperties:
  214. type: object
  215. description: |
  216. The CPU(s) (cores) and RAM requests assigned to a container.
  217. This section, if left empty, will be filled automatically by the operator with
  218. some defaults that can be proportional to the resources assigned to patroni
  219. container (except for the huge pages that are always left untouched).
  220. properties:
  221. cpu:
  222. type: string
  223. pattern: '^[1-9][0-9]*[m]?$'
  224. description: |
  225. CPU(s) (cores) requests for the specified container. The suffix `m`
  226. specifies millicpus (where 1000m is equals to 1).
  227. memory:
  228. type: string
  229. pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
  230. description: |
  231. RAM requests for the specified container. The suffix `Mi` or `Gi`
  232. specifies Mebibytes or Gibibytes, respectively.
  233. initContainers:
  234. type: object
  235. description: The CPU(s) (cores) and RAM requests assigned to init containers.
  236. additionalProperties:
  237. type: object
  238. description: |
  239. The CPU(s) (cores) and RAM requests assigned to a init container.
  240. This section will be filled automatically by the operator with
  241. the same values of the resources requests assigned to patroni
  242. container (except for the huge pages that are always left untouched).
  243. properties:
  244. cpu:
  245. type: string
  246. pattern: '^[1-9][0-9]*[m]?$'
  247. description: |
  248. CPU(s) (cores) requests for the specified init container. The suffix
  249. `m` specifies millicpus (where 1000m is equals to 1).
  250. memory:
  251. type: string
  252. pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
  253. description: |
  254. RAM requests for the specified init container. The suffix `Mi`
  255. or `Gi` specifies Mebibytes or Gibibytes, respectively.