runtime-parameters.yaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. extraDeploy:
  2. # Taken from https://cloudnative-pg.io/documentation/1.25/declarative_role_management/
  3. # 1) Deploy a PostgreSQL Cluster with the Barman Cloud Plugin enabled
  4. - apiVersion: v1
  5. kind: Secret
  6. metadata:
  7. name: vib-cluster-example-user
  8. labels:
  9. cnpg.io/reload: "true"
  10. type: kubernetes.io/basic-auth
  11. stringData:
  12. username: vib_user
  13. password: bitnami1234
  14. - |
  15. apiVersion: postgresql.cnpg.io/v1
  16. kind: Cluster
  17. metadata:
  18. name: vib-cluster-example
  19. spec:
  20. {{- include "cloudnative-pg.imagePullSecrets" . | nindent 2 }}
  21. instances: 3
  22. storage:
  23. size: 1Gi
  24. plugins:
  25. - name: barman-cloud.cloudnative-pg.io
  26. isWALArchiver: true
  27. parameters:
  28. barmanObjectName: minio-store
  29. managed:
  30. roles:
  31. - name: vib_user
  32. ensure: present
  33. comment: VIB User
  34. login: true
  35. superuser: true
  36. passwordSecret:
  37. name: vib-cluster-example-user
  38. # 2) Deploy a MinIO(TM) instance to be used as ObjectStore for backups
  39. - |
  40. apiVersion: apps/v1
  41. kind: Deployment
  42. metadata:
  43. name: minio
  44. labels:
  45. app.kubernetes.io/instance: minio
  46. app.kubernetes.io/managed-by: Helm
  47. app.kubernetes.io/name: minio
  48. app.kubernetes.io/version: 2025.5.24
  49. helm.sh/chart: minio-17.0.3
  50. app.kubernetes.io/component: minio
  51. app.kubernetes.io/part-of: minio
  52. spec:
  53. selector:
  54. matchLabels:
  55. app.kubernetes.io/instance: minio
  56. app.kubernetes.io/name: minio
  57. app.kubernetes.io/component: minio
  58. app.kubernetes.io/part-of: minio
  59. strategy:
  60. type: RollingUpdate
  61. template:
  62. metadata:
  63. labels:
  64. app.kubernetes.io/instance: minio
  65. app.kubernetes.io/managed-by: Helm
  66. app.kubernetes.io/name: minio
  67. app.kubernetes.io/version: 2025.5.24
  68. helm.sh/chart: minio-17.0.3
  69. app.kubernetes.io/component: minio
  70. app.kubernetes.io/part-of: minio
  71. spec:
  72. securityContext:
  73. fsGroupChangePolicy: OnRootMismatch
  74. supplementalGroups: []
  75. sysctls: []
  76. {{- if not (include "common.compatibility.isOpenshift" .) }}
  77. fsGroup: 1001
  78. {{- end }}
  79. initContainers:
  80. containers:
  81. - name: minio
  82. image: docker.io/bitnami/minio:2025.5.24-debian-12-r5
  83. imagePullPolicy: "IfNotPresent"
  84. securityContext:
  85. allowPrivilegeEscalation: false
  86. capabilities:
  87. drop:
  88. - ALL
  89. privileged: false
  90. readOnlyRootFilesystem: true
  91. runAsNonRoot: true
  92. seLinuxOptions: {}
  93. seccompProfile:
  94. type: RuntimeDefault
  95. {{- if not (include "common.compatibility.isOpenshift" .) }}
  96. runAsGroup: 1001
  97. runAsUser: 1001
  98. {{- end }}
  99. env:
  100. - name: BITNAMI_DEBUG
  101. value: "false"
  102. - name: MINIO_DISTRIBUTED_MODE_ENABLED
  103. value: "no"
  104. - name: MINIO_SCHEME
  105. value: "http"
  106. - name: MINIO_FORCE_NEW_KEYS
  107. value: "no"
  108. - name: MINIO_DEFAULT_BUCKETS
  109. value: postgrestest
  110. - name: MINIO_ROOT_USER_FILE
  111. value: /opt/bitnami/minio/secrets/root-user
  112. - name: MINIO_ROOT_PASSWORD_FILE
  113. value: /opt/bitnami/minio/secrets/root-password
  114. - name: MINIO_SKIP_CLIENT
  115. value: "yes"
  116. - name: MINIO_API_PORT_NUMBER
  117. value: "9000"
  118. - name: MINIO_BROWSER
  119. value: "off"
  120. - name: MINIO_PROMETHEUS_AUTH_TYPE
  121. value: "public"
  122. - name: MINIO_DATA_DIR
  123. value: "/bitnami/minio/data"
  124. ports:
  125. - name: api
  126. containerPort: 9000
  127. livenessProbe:
  128. httpGet:
  129. path: /minio/health/live
  130. port: api
  131. scheme: "HTTP"
  132. initialDelaySeconds: 5
  133. periodSeconds: 5
  134. timeoutSeconds: 5
  135. successThreshold: 1
  136. failureThreshold: 5
  137. readinessProbe:
  138. tcpSocket:
  139. port: api
  140. initialDelaySeconds: 5
  141. periodSeconds: 5
  142. timeoutSeconds: 1
  143. successThreshold: 1
  144. failureThreshold: 5
  145. volumeMounts:
  146. - name: empty-dir
  147. mountPath: /tmp
  148. subPath: tmp-dir
  149. - name: empty-dir
  150. mountPath: /opt/bitnami/minio/tmp
  151. subPath: app-tmp-dir
  152. - name: empty-dir
  153. mountPath: /.mc
  154. subPath: app-mc-dir
  155. - name: minio-credentials
  156. mountPath: /opt/bitnami/minio/secrets/
  157. - name: data
  158. mountPath: /bitnami/minio/data
  159. volumes:
  160. - name: empty-dir
  161. emptyDir: {}
  162. - name: minio-credentials
  163. secret:
  164. secretName: minio
  165. - name: data
  166. emptyDir: {}
  167. - apiVersion: v1
  168. kind: Service
  169. metadata:
  170. name: minio
  171. labels:
  172. app.kubernetes.io/instance: minio
  173. app.kubernetes.io/managed-by: Helm
  174. app.kubernetes.io/name: minio
  175. app.kubernetes.io/version: 2025.5.24
  176. helm.sh/chart: minio-17.0.3
  177. app.kubernetes.io/component: minio
  178. app.kubernetes.io/part-of: minio
  179. spec:
  180. type: ClusterIP
  181. ports:
  182. - name: tcp-api
  183. port: 9000
  184. targetPort: api
  185. nodePort: null
  186. selector:
  187. app.kubernetes.io/instance: minio
  188. app.kubernetes.io/name: minio
  189. app.kubernetes.io/component: minio
  190. app.kubernetes.io/part-of: minio
  191. - apiVersion: v1
  192. kind: Secret
  193. metadata:
  194. name: minio
  195. labels:
  196. app.kubernetes.io/instance: minio
  197. app.kubernetes.io/managed-by: Helm
  198. app.kubernetes.io/name: minio
  199. app.kubernetes.io/version: 2025.5.24
  200. helm.sh/chart: minio-17.0.3
  201. app.kubernetes.io/component: minio
  202. app.kubernetes.io/part-of: minio
  203. type: Opaque
  204. stringData:
  205. root-user: "root"
  206. root-password: "bitnami1234"
  207. - apiVersion: barmancloud.cnpg.io/v1
  208. kind: ObjectStore
  209. metadata:
  210. name: minio-store
  211. spec:
  212. configuration:
  213. destinationPath: s3://postgrestest/
  214. endpointURL: http://minio:9000
  215. s3Credentials:
  216. accessKeyId:
  217. name: minio
  218. key: root-user
  219. secretAccessKey:
  220. name: minio
  221. key: root-password
  222. wal:
  223. compression: gzip
  224. # 3) Deploy a Backup object to perform a backup of the PostgreSQL cluster deployed in step 1
  225. - apiVersion: postgresql.cnpg.io/v1
  226. kind: Backup
  227. metadata:
  228. name: backup-example
  229. spec:
  230. cluster:
  231. name: vib-cluster-example
  232. method: plugin
  233. pluginConfiguration:
  234. name: barman-cloud.cloudnative-pg.io
  235. # 4) Create a Deployment for our goss tests. We cannot run goss in the operators because they are scratch. We cannot run the test in the Cluster instances because it's ReadOnlyRootFilesystem and it is not configurable. The testing deployment is comprised as follows:
  236. # - First an init container with the PostgreSQL client checks that the cluster has been formed
  237. # - Then a kubectl container will be used for running the goss tests. With it we can verify that the backup succeeded
  238. - apiVersion: apps/v1
  239. kind: Deployment
  240. metadata:
  241. labels:
  242. app: postgresql
  243. name: vib-postgresql-test
  244. spec:
  245. replicas: 1
  246. selector:
  247. matchLabels:
  248. app: postgresql
  249. template:
  250. metadata:
  251. labels:
  252. app: postgresql
  253. spec:
  254. serviceAccountName: '{{ template "cloudnative-pg.operator.serviceAccountName" . }}'
  255. automountServiceAccountToken: true
  256. initContainers:
  257. - image: docker.io/bitnami/postgresql:latest
  258. command:
  259. - /bin/bash
  260. args:
  261. - -ec
  262. - |
  263. echo 0 > /tmp/ready
  264. # Wait until the cluster is formed
  265. while true; do
  266. if PGPASSWORD=$POSTGRES_PASSWORD psql -U $POSTGRES_USER -d postgres -h vib-cluster-example-rw -c "SELECT client_addr, state FROM pg_stat_replication;" | grep "2 rows"; then
  267. echo "Connected to PostgreSQL"
  268. break
  269. else
  270. echo "Connection failed. Sleeping 10 seconds"
  271. sleep 10
  272. fi
  273. done
  274. exit 0
  275. name: postgresql
  276. env:
  277. - name: POSTGRES_PASSWORD
  278. valueFrom:
  279. secretKeyRef:
  280. name: vib-cluster-example-user
  281. key: password
  282. - name: POSTGRES_USER
  283. valueFrom:
  284. secretKeyRef:
  285. name: vib-cluster-example-user
  286. key: username
  287. securityContext:
  288. runAsNonRoot: true
  289. privileged: false
  290. allowPrivilegeEscalation: false
  291. capabilities:
  292. drop: ["ALL"]
  293. seccompProfile:
  294. type: "RuntimeDefault"
  295. volumeMounts:
  296. - name: empty-dir
  297. mountPath: /tmp
  298. - name: copy-kubectl
  299. command:
  300. - /bin/bash
  301. args:
  302. - -ec
  303. - |
  304. cp /opt/bitnami/kubectl/bin/kubectl /out/kubectl
  305. image: bitnami/kubectl
  306. securityContext:
  307. runAsNonRoot: true
  308. privileged: false
  309. allowPrivilegeEscalation: false
  310. capabilities:
  311. drop: ["ALL"]
  312. seccompProfile:
  313. type: "RuntimeDefault"
  314. volumeMounts:
  315. - name: empty-dir
  316. subPath: kubectl-bin
  317. mountPath: /out
  318. containers:
  319. - name: kubectl
  320. command:
  321. - sleep
  322. args:
  323. - infinity
  324. readinessProbe:
  325. exec:
  326. command:
  327. - sh
  328. - -c
  329. - |
  330. exit 0
  331. # Providing extra time for the test runs to finish
  332. initialDelaySeconds: 120
  333. periodSeconds: 20
  334. timeoutSeconds: 1
  335. failureThreshold: 15
  336. successThreshold: 1
  337. image: bitnami/os-shell:latest
  338. securityContext:
  339. runAsNonRoot: true
  340. privileged: false
  341. allowPrivilegeEscalation: false
  342. capabilities:
  343. drop: ["ALL"]
  344. seccompProfile:
  345. type: "RuntimeDefault"
  346. volumeMounts:
  347. - name: empty-dir
  348. mountPath: /tmp
  349. - name: empty-dir
  350. subPath: kubectl-bin
  351. mountPath: /opt/bitnami/kubectl/bin
  352. volumes:
  353. - name: empty-dir
  354. emptyDir: {}
  355. operator:
  356. service:
  357. ports:
  358. webhook: 443
  359. type: LoadBalancer
  360. metrics:
  361. enabled: true
  362. service:
  363. ports:
  364. metrics: 2311
  365. pluginBarmanCloud:
  366. enabled: true
  367. service:
  368. ports:
  369. grpc: 2218
  370. metrics:
  371. enabled: true
  372. # Add the cloudnative-pg SA as allowed account because we need it for the goss tests
  373. allowedServiceAccounts:
  374. - name: '{{ include "cloudnative-pg.operator.serviceAccountName" $ }}'
  375. namespace: '{{ include "common.names.namespace" $ }}'
  376. service:
  377. ports:
  378. metrics: 8221