-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add MariaDB operator and backup configurations
- Loading branch information
Showing
14 changed files
with
301 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
# yaml-language-server: $schema=https://ks.hsn.dev/k8s.mariadb.com/backup_v1alpha1.json | ||
apiVersion: k8s.mariadb.com/v1alpha1 | ||
kind: Backup | ||
metadata: | ||
name: &name mariadb-backup | ||
spec: | ||
mariaDbRef: | ||
name: mariadb | ||
timeZone: "Europe/Lisbon" | ||
schedule: | ||
cron: "0 * * * *" | ||
suspend: false | ||
stagingStorage: | ||
persistentVolumeClaim: | ||
storageClassName: openebs-hostpath | ||
resources: | ||
requests: | ||
storage: 6Gi | ||
accessModes: | ||
- ReadWriteOnce | ||
podSecurityContext: | ||
runAsUser: 1000 | ||
runAsGroup: 1000 | ||
fsGroup: 1000 | ||
fsGroupChangePolicy: OnRootMismatch | ||
storage: | ||
s3: | ||
endpoint: s3.rafaribe.com | ||
bucket: mariadb | ||
prefix: full/ | ||
accessKeyIdSecretKeyRef: | ||
name: mariadb-secret | ||
key: AWS_ACCESS_KEY_ID | ||
secretAccessKeySecretKeyRef: | ||
name: mariadb-secret | ||
key: AWS_SECRET_ACCESS_KEY | ||
--- | ||
# yaml-language-server: $schema=https://ks.hsn.dev/k8s.mariadb.com/backup_v1alpha1.json | ||
apiVersion: k8s.mariadb.com/v1alpha1 | ||
kind: Backup | ||
metadata: | ||
name: &name mariadb-pterodactyl-backup | ||
namespace: database | ||
spec: | ||
mariaDbRef: | ||
name: mariadb | ||
namespace: database | ||
timeZone: "Europe/Lisbon" | ||
schedule: | ||
cron: "0 * * * *" | ||
suspend: false | ||
stagingStorage: | ||
persistentVolumeClaim: | ||
storageClassName: openebs-hostpath | ||
resources: | ||
requests: | ||
storage: 6Gi | ||
accessModes: | ||
- ReadWriteOnce | ||
podSecurityContext: | ||
runAsUser: 1000 | ||
runAsGroup: 1000 | ||
fsGroup: 1000 | ||
fsGroupChangePolicy: OnRootMismatch | ||
databases: | ||
- pterodactyl | ||
storage: | ||
s3: | ||
endpoint: s3.rafaribe.com | ||
bucket: mariadb | ||
prefix: pterodactyl/ | ||
accessKeyIdSecretKeyRef: | ||
name: mariadb-secret | ||
key: AWS_ACCESS_KEY_ID | ||
secretAccessKeySecretKeyRef: | ||
name: mariadb-secret | ||
key: AWS_SECRET_ACCESS_KEY |
20 changes: 20 additions & 0 deletions
20
kubernetes/main/apps/storage/mariadb/cluster/externalsecret.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
# yaml-language-server: $schema=https://ks.hsn.dev/external-secrets.io/externalsecret_v1beta1.json | ||
apiVersion: external-secrets.io/v1beta1 | ||
kind: ExternalSecret | ||
metadata: | ||
name: &name mariadb | ||
spec: | ||
secretStoreRef: | ||
kind: ClusterSecretStore | ||
name: akeyless-secret-store | ||
target: | ||
name: mariadb-secret | ||
template: | ||
engineVersion: v2 | ||
data: | ||
AWS_ACCESS_KEY_ID: "{{ .AWS_ACCESS_KEY_ID }}" | ||
AWS_SECRET_ACCESS_KEY: "{{ .AWS_SECRET_ACCESS_KEY }}" | ||
dataFrom: | ||
- extract: | ||
key: /minio |
8 changes: 8 additions & 0 deletions
8
kubernetes/main/apps/storage/mariadb/cluster/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
# yaml-language-server: $schema=https://json.schemastore.org/kustomization | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ./backup.yaml | ||
- ./externalsecret.yaml | ||
- ./mariadb.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
# yaml-language-server: $schema=https://ks.hsn.dev/k8s.mariadb.com/mariadb_v1alpha1.json | ||
apiVersion: k8s.mariadb.com/v1alpha1 | ||
kind: MariaDB | ||
metadata: | ||
name: &name mariadb | ||
spec: | ||
# renovate: datasource=docker depName=docker.io/library/mariadb | ||
image: docker.io/library/mariadb:11.6.2 | ||
replicas: 3 | ||
storage: | ||
size: 5Gi | ||
storageClassName: openebs-hostpath | ||
# bootstrapFrom: | ||
# backupRef: | ||
# name: mariadb-backup | ||
nodeSelector: | ||
kubernetes.io/arch: amd64 | ||
maxScale: | ||
enabled: true | ||
kubernetesService: | ||
type: LoadBalancer | ||
metadata: | ||
annotations: | ||
io.cilium/lb-ipam-ips: ${LB_MARIADB_OPERATOR_MAXSCALE} | ||
connection: | ||
secretName: mxs-connection | ||
port: 3306 | ||
galera: | ||
enabled: true | ||
podSecurityContext: | ||
runAsUser: 1000 | ||
runAsGroup: 1000 | ||
fsGroup: 1000 | ||
fsGroupChangePolicy: OnRootMismatch | ||
service: | ||
type: LoadBalancer | ||
metadata: | ||
annotations: | ||
io.cilium/lb-ipam-ips: ${LB_MARIADB_OPERATOR_SCALE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
# yaml-language-server: $schema=https://ks.hsn.dev/k8s.mariadb.com/restore_v1alpha1.json | ||
apiVersion: k8s.mariadb.com/v1alpha1 | ||
kind: Restore | ||
metadata: | ||
name: restore | ||
spec: | ||
mariaDbRef: | ||
name: mariadb | ||
namespace: database | ||
backupRef: | ||
name: mariadb-backup | ||
podSecurityContext: | ||
runAsUser: 1000 | ||
runAsGroup: 1000 | ||
fsGroup: 1000 | ||
fsGroupChangePolicy: OnRootMismatch |
17 changes: 17 additions & 0 deletions
17
kubernetes/main/apps/storage/mariadb/crds/helmrelease.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
# yaml-language-server: $schema=https://ks.hsn.dev/helm.toolkit.fluxcd.io/helmrelease_v2.json | ||
apiVersion: helm.toolkit.fluxcd.io/v2 | ||
kind: HelmRelease | ||
metadata: | ||
name: mariadb-operator-crds | ||
spec: | ||
interval: 30m | ||
chart: | ||
spec: | ||
chart: mariadb-operator-crds | ||
version: 0.36.0 | ||
sourceRef: | ||
kind: HelmRepository | ||
name: mariadb-operator | ||
namespace: flux-system | ||
interval: 5m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
# yaml-language-server: $schema=https://json.schemastore.org/kustomization | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- helmrelease.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1 | ||
kind: Kustomization | ||
metadata: | ||
name: &app mariadb-operator | ||
namespace: flux-system | ||
spec: | ||
targetNamespace: storage | ||
commonMetadata: | ||
labels: | ||
app.kubernetes.io/name: *app | ||
dependsOn: | ||
- name: external-secrets-stores | ||
path: ./kubernetes/main/apps/storage/mariadb/operator | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: home-ops | ||
wait: true | ||
interval: 30m | ||
timeout: 5m | ||
--- | ||
# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1 | ||
kind: Kustomization | ||
metadata: | ||
name: &app mariadb-operator-crds | ||
namespace: flux-system | ||
spec: | ||
targetNamespace: storage | ||
commonMetadata: | ||
labels: | ||
app.kubernetes.io/name: *app | ||
path: ./kubernetes/main/apps/storage/mariadb/crds | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: home-ops | ||
wait: true | ||
interval: 30m | ||
timeout: 5m | ||
--- | ||
# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1 | ||
kind: Kustomization | ||
metadata: | ||
name: &app mariadb-cluster | ||
namespace: flux-system | ||
spec: | ||
targetNamespace: storage | ||
commonMetadata: | ||
labels: | ||
app.kubernetes.io/name: *app | ||
dependsOn: | ||
- name: external-secrets-stores | ||
path: ./kubernetes/main/apps/storage/mariadb/cluster | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: home-ops | ||
wait: true | ||
interval: 30m | ||
timeout: 5m |
31 changes: 31 additions & 0 deletions
31
kubernetes/main/apps/storage/mariadb/operator/helmrelease.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
# yaml-language-server: $schema=https://ks.hsn.dev/helm.toolkit.fluxcd.io/helmrelease_v2.json | ||
apiVersion: helm.toolkit.fluxcd.io/v2 | ||
kind: HelmRelease | ||
metadata: | ||
name: mariadb-operator | ||
spec: | ||
interval: 30m | ||
chart: | ||
spec: | ||
chart: mariadb-operator | ||
version: 0.36.0 | ||
sourceRef: | ||
kind: HelmRepository | ||
name: mariadb-operator | ||
namespace: flux-system | ||
interval: 5m | ||
values: | ||
logLevel: debug | ||
image: | ||
repository: ghcr.io/mariadb-operator/mariadb-operator | ||
pullPolicy: IfNotPresent | ||
metrics: | ||
enabled: true | ||
serviceMonitor: | ||
enabled: true | ||
webhook: | ||
certificate: | ||
certManager: true | ||
serviceMonitor: | ||
enabled: true |
6 changes: 6 additions & 0 deletions
6
kubernetes/main/apps/storage/mariadb/operator/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
# yaml-language-server: $schema=https://json.schemastore.org/kustomization | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- helmrelease.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/main/helmrepository-source-v1.json | ||
apiVersion: source.toolkit.fluxcd.io/v1 | ||
kind: HelmRepository | ||
metadata: | ||
name: mariadb-operator | ||
namespace: flux-system | ||
spec: | ||
interval: 1h | ||
url: https://mariadb-operator.github.io/mariadb-operator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters