mariadb.yaml (8270B)
1 apiVersion: k8s.mariadb.com/v1alpha1 2 kind: MariaDB 3 metadata: 4 name: mariadb 5 spec: 6 rootPasswordSecretKeyRef: 7 name: mariadb-root 8 key: root-password 9 generate: true 10 storage: 11 size: 5Gi 12 storageClassName: hcloud-volumes 13 # Recreate the MariaDB resource and bootstrap from a backup in S3. 14 # bootstrapFrom: 15 # s3: 16 # bucket: backups 17 # prefix: mariadb 18 # endpoint: minio.minio.svc.cluster.local:9000 19 # accessKeyIdSecretKeyRef: 20 # name: minio 21 # key: access-key-id 22 # secretAccessKeySecretKeyRef: 23 # name: minio 24 # key: secret-access-key 25 # tls: 26 # enabled: true 27 # caSecretKeyRef: 28 # name: minio-ca 29 # key: ca.crt 30 # targetRecoveryTime: 2023-12-19T09:00:00Z 31 # stagingStorage: 32 # persistentVolumeClaim: 33 # resources: 34 # requests: 35 # storage: 10Gi 36 # accessModes: 37 # - ReadWriteOnce 38 # restoreJob: 39 # resources: 40 # requests: 41 # cpu: 100m 42 # memory: 128Mi 43 # limits: 44 # memory: 1Gi 45 replicas: 3 46 galera: 47 enabled: true 48 config: 49 reuseStorageVolume: true 50 metrics: 51 enabled: true 52 updateStrategy: 53 type: ReplicasFirstPrimaryLast 54 # Pause updates. 55 # type: Never 56 # Update the data-plane after an operator upgrade. 57 autoUpdateDataPlane: true 58 # Configure enough compute resources. This is just an example, take a look at your historic compute metrics to estimate. 59 resources: 60 requests: 61 cpu: 0.25 62 memory: 250Mi 63 limits: 64 memory: 4Gi 65 # Tune your liveness probe accordingly to avoid Pod restarts. 66 livenessProbe: 67 initialDelaySeconds: 20 68 periodSeconds: 5 69 timeoutSeconds: 5 70 # Tune your readiness probe accordingly to prevent disruptions in network traffic. 71 readinessProbe: 72 initialDelaySeconds: 20 73 periodSeconds: 5 74 timeoutSeconds: 5 75 # innodb_buffer_pool_size: 80% of memory limits. 76 myCnf: | 77 [mariadb] 78 bind-address=* 79 default_storage_engine=InnoDB 80 binlog_format=row 81 innodb_autoinc_lock_mode=2 82 innodb_buffer_pool_size=3200MB 83 max_allowed_packet=1GB 84 ft_min_word_len=2 85 # Schedule Pods in different Nodes to achieve real HA. 86 affinity: 87 antiAffinityEnabled: true 88 # When draining Nodes, make sure that you have at least 2 Pods available. 89 podDisruptionBudget: 90 maxUnavailable: 66% 91 maxScale: 92 enabled: true 93 replicas: 3 94 updateStrategy: 95 type: RollingUpdate 96 kubernetesService: 97 type: ClusterIP 98 --- 99 apiVersion: k8s.mariadb.com/v1alpha1 100 kind: Database 101 metadata: 102 name: osticket 103 spec: 104 mariaDbRef: 105 name: mariadb 106 characterSet: utf8 107 collate: utf8_general_ci 108 # Delete the resource in the database whenever the CR gets deleted. 109 # Alternatively, you can specify Skip in order to omit deletion. 110 cleanupPolicy: Delete 111 requeueInterval: 30s 112 retryInterval: 5s 113 --- 114 apiVersion: k8s.mariadb.com/v1alpha1 115 kind: User 116 metadata: 117 name: osticket 118 spec: 119 # If you want the user to be created with a different name than the resource name 120 # name: user-custom 121 mariaDbRef: 122 name: mariadb 123 passwordSecretKeyRef: 124 name: mariadb-osticket 125 key: password 126 # This field defaults to 10 127 maxUserConnections: 10 128 host: "%" 129 # Delete the resource in the database whenever the CR gets deleted. 130 # Alternatively, you can specify Skip in order to omit deletion. 131 cleanupPolicy: Delete 132 requeueInterval: 30s 133 retryInterval: 5s 134 --- 135 apiVersion: k8s.mariadb.com/v1alpha1 136 kind: Grant 137 metadata: 138 name: grant-osticket 139 spec: 140 mariaDbRef: 141 name: mariadb 142 privileges: 143 - "ALL PRIVILEGES" 144 database: "osticket" 145 table: "*" 146 username: osticket 147 grantOption: false 148 host: "%" 149 --- 150 apiVersion: k8s.mariadb.com/v1alpha1 151 kind: Grant 152 metadata: 153 name: grant-osticket-show-db 154 spec: 155 mariaDbRef: 156 name: mariadb 157 privileges: 158 - "SHOW DATABASES" 159 database: "*" 160 table: "*" 161 username: osticket 162 grantOption: false 163 host: "%" 164 --- 165 apiVersion: k8s.mariadb.com/v1alpha1 166 kind: Database 167 metadata: 168 name: hubzilla 169 spec: 170 mariaDbRef: 171 name: mariadb 172 characterSet: utf8 173 collate: utf8_general_ci 174 # Delete the resource in the database whenever the CR gets deleted. 175 # Alternatively, you can specify Skip in order to omit deletion. 176 cleanupPolicy: Delete 177 requeueInterval: 30s 178 retryInterval: 5s 179 --- 180 apiVersion: k8s.mariadb.com/v1alpha1 181 kind: User 182 metadata: 183 name: hubzilla 184 spec: 185 # If you want the user to be created with a different name than the resource name 186 # name: user-custom 187 mariaDbRef: 188 name: mariadb 189 passwordSecretKeyRef: 190 name: mariadb-hubzilla 191 key: password 192 # This field defaults to 10 193 maxUserConnections: 10 194 host: "%" 195 # Delete the resource in the database whenever the CR gets deleted. 196 # Alternatively, you can specify Skip in order to omit deletion. 197 cleanupPolicy: Delete 198 requeueInterval: 30s 199 retryInterval: 5s 200 --- 201 apiVersion: k8s.mariadb.com/v1alpha1 202 kind: Grant 203 metadata: 204 name: grant-hubzilla 205 spec: 206 mariaDbRef: 207 name: mariadb 208 privileges: 209 - "ALL PRIVILEGES" 210 database: "hubzilla" 211 table: "*" 212 username: hubzilla 213 grantOption: false 214 host: "%" 215 --- 216 apiVersion: k8s.mariadb.com/v1alpha1 217 kind: Grant 218 metadata: 219 name: grant-hubzilla-show-db 220 spec: 221 mariaDbRef: 222 name: mariadb 223 privileges: 224 - "SHOW DATABASES" 225 database: "*" 226 table: "*" 227 username: hubzilla 228 grantOption: false 229 host: "%" 230 --- 231 apiVersion: k8s.mariadb.com/v1alpha1 232 kind: Database 233 metadata: 234 name: bugzilla 235 spec: 236 mariaDbRef: 237 name: mariadb 238 characterSet: utf8 239 collate: utf8_general_ci 240 # Delete the resource in the database whenever the CR gets deleted. 241 # Alternatively, you can specify Skip in order to omit deletion. 242 cleanupPolicy: Delete 243 requeueInterval: 30s 244 retryInterval: 5s 245 --- 246 apiVersion: k8s.mariadb.com/v1alpha1 247 kind: User 248 metadata: 249 name: bugzilla 250 spec: 251 # If you want the user to be created with a different name than the resource name 252 # name: user-custom 253 mariaDbRef: 254 name: mariadb 255 passwordSecretKeyRef: 256 name: mariadb-bugzilla 257 key: password 258 # This field defaults to 10 259 maxUserConnections: 10 260 host: "%" 261 # Delete the resource in the database whenever the CR gets deleted. 262 # Alternatively, you can specify Skip in order to omit deletion. 263 cleanupPolicy: Delete 264 requeueInterval: 30s 265 retryInterval: 5s 266 --- 267 apiVersion: k8s.mariadb.com/v1alpha1 268 kind: Grant 269 metadata: 270 name: grant-bugzilla 271 spec: 272 mariaDbRef: 273 name: mariadb 274 privileges: 275 - "ALL PRIVILEGES" 276 database: "bugzilla" 277 table: "*" 278 username: bugzilla 279 grantOption: false 280 host: "%" 281 --- 282 apiVersion: k8s.mariadb.com/v1alpha1 283 kind: Grant 284 metadata: 285 name: grant-bugzilla-show-db 286 spec: 287 mariaDbRef: 288 name: mariadb 289 privileges: 290 - "SHOW DATABASES" 291 database: "*" 292 table: "*" 293 username: bugzilla 294 grantOption: false 295 host: "%" 296 --- 297 apiVersion: k8s.mariadb.com/v1alpha1 298 kind: Database 299 metadata: 300 name: irc 301 spec: 302 mariaDbRef: 303 name: mariadb 304 characterSet: utf8 305 collate: utf8_general_ci 306 # Delete the resource in the database whenever the CR gets deleted. 307 # Alternatively, you can specify Skip in order to omit deletion. 308 cleanupPolicy: Delete 309 requeueInterval: 30s 310 retryInterval: 5s 311 --- 312 apiVersion: k8s.mariadb.com/v1alpha1 313 kind: User 314 metadata: 315 name: irc 316 spec: 317 # If you want the user to be created with a different name than the resource name 318 # name: user-custom 319 mariaDbRef: 320 name: mariadb 321 passwordSecretKeyRef: 322 name: mariadb-irc 323 key: password 324 # This field defaults to 10 325 maxUserConnections: 10 326 host: "%" 327 # Delete the resource in the database whenever the CR gets deleted. 328 # Alternatively, you can specify Skip in order to omit deletion. 329 cleanupPolicy: Delete 330 requeueInterval: 30s 331 retryInterval: 5s 332 --- 333 apiVersion: k8s.mariadb.com/v1alpha1 334 kind: Grant 335 metadata: 336 name: grant-irc 337 spec: 338 mariaDbRef: 339 name: mariadb 340 privileges: 341 - "ALL PRIVILEGES" 342 database: "irc" 343 table: "*" 344 username: irc 345 grantOption: false 346 host: "%" 347 --- 348 apiVersion: k8s.mariadb.com/v1alpha1 349 kind: Grant 350 metadata: 351 name: grant-irc-show-db 352 spec: 353 mariaDbRef: 354 name: mariadb 355 privileges: 356 - "SHOW DATABASES" 357 database: "*" 358 table: "*" 359 username: irc 360 grantOption: false 361 host: "%"