helmfile.yaml 3.61 KB
environments:
  default:
    values:
      - namespace: mariadb
        namePrefix: "test-"
        restoreFromEmpty:
          enabled: true
        mariadbServer:
          jsonPatches: []
          strategicMergePatches: []
          rootPassword: CHANGEME
          password: CHANGEME
          database: CHANGEME
          user: CHANGEME
        images:
          debian: "debian:bullseye-20211220"
          mariadb: "bitnami/mariadb:10.3.32-debian-10-r67"

---

releases:
  - name: {{ .Values.namePrefix }}mariadb-restore-from-empty
    namespace: {{ .Values.namespace }}
    chart: charts/restore-from-empty
    condition: restoreFromEmpty.enabled
    values:
      - set-common-values.yaml.gotmpl
    strategicMergePatches:
      - apiVersion: batch/v1
        kind: Job
        metadata:
          name: {{ .Values.namePrefix }}mariadb-restore-from-empty
          namespace: {{ .Values.namespace }}
        spec:
          template:
            spec:
              volumes:
                - name: mariadb-entrypoint-initdb
                  persistentVolumeClaim:
                    claimName: {{ .Values.namePrefix }}mariadb-entrypoint-initdb
                - name: mariadb-scripts
                  configMap:
                    name: {{ .Values.namePrefix }}mariadb-scripts

  - name: {{ .Values.namePrefix }}mariadb-server
    namespace: {{ .Values.namespace }}
    chart: charts/mariadb-server
    values:
      - set-common-values.yaml.gotmpl
    jsonPatches:
      {{- if not (empty (.Values.mariadbServer.jsonPatches)) }}
      {{- .Values.mariadbServer.jsonPatches | toYaml | indent 6 }}
      {{- end }}
    strategicMergePatches:
      - apiVersion: apps/v1
        kind: Deployment
        metadata:
          name: {{ .Values.namePrefix }}mariadb-server
          namespace: {{ .Values.namespace }}
        spec:
          selector:
            matchLabels:
              app: {{ .Values.namePrefix }}mariadb-server
          template:
            metadata:
              labels:
                app: {{ .Values.namePrefix }}mariadb-server
            spec:
              volumes:
                - name: mariadb-data
                  persistentVolumeClaim:
                    claimName: {{ .Values.namePrefix }}mariadb-data
                - name: mariadb-config
                  configMap:
                    name: {{ .Values.namePrefix }}mariadb-config
                - name: mariadb-scripts
                  configMap:
                    name: {{ .Values.namePrefix }}mariadb-scripts
                - name: mariadb-secret
                  secret:
                    secretName: {{ .Values.namePrefix }}mariadb-secret
      - apiVersion: v1
        kind: Service
        metadata:
          name: {{ .Values.namePrefix }}mariadb
          namespace: {{ .Values.namespace }}
        spec:
          selector:
            app: {{ .Values.namePrefix }}mariadb-server
      {{- if not (empty (.Values.mariadbServer.strategicMergePatches)) }}
      {{- .Values.mariadbServer.strategicMergePatches | toYaml | indent 6 }}
      {{- end }}
      - apiVersion: v1
        kind: ConfigMap
        metadata:
          name: {{ .Values.namePrefix }}mariadb-config
          namespace: {{ .Values.namespace }}
        data:
          MARIADB_DATABASE: {{ .Values.mariadbServer.database }}
          MARIADB_USER: {{ .Values.mariadbServer.user }}
      - apiVersion: v1
        kind: Secret
        metadata:
          name: {{ .Values.namePrefix }}mariadb-secret
          namespace: {{ .Values.namespace }}
        stringData:
          MARIADB_PASSWORD: {{ .Values.mariadbServer.password }}
          MARIADB_ROOT_PASSWORD: {{ .Values.mariadbServer.rootPassword }}