helmfile.yaml 2.51 KB
{{- $dummy := merge (readFile "./defaults.yaml" | fromYaml) .Values }}

---
repositories:
  - name: bitnami
    url: https://charts.bitnami.com/bitnami
  - name: postgresql-rclone
    url: git+https://gitlab.brainfood.com/brainfood/k8s-postgresql.git@charts/postgresql-rclone?ref=master

releases: 
  - name: {{ .Values.chart.namePrefix }}postgresql
    namespace: {{ .Values.chart.namespace }}
    chart: bitnami/postgresql
    version: {{ .Values | get "chart.version" "12.8.0" }}
    dependencies:
      - chart: postgresql-rclone/postgresql-rclone
        alias: postgresql-rclone
        version: 0.0.0
    values:
      # Overlay passed in values
      - {{ omit .Values "rclone" "backup" "restore" "local" "postgresql-rclone" | toYaml | nindent 8 }}
      # Merge array-based things
      - primary:
          extraVolumeMounts:
            {{- range (.Values | get "primary.extraVolumeMounts" list) }}
            - {{ . | toYaml | indent 14 }}
            {{- end }}
            - name: rclone-restores
              mountPath: /docker-entrypoint-initdb.d
          extraVolumes:
            {{- range (.Values | get "primary.extraVolumes" list) }}
            - {{ . | toYaml | nindent 14 }}
            {{- end }}
            - name: rclone-restores
              persistentVolumeClaim:
                claimName: {{ .Values.chart.namePrefix }}postgresql-rclone-restores
          initContainers:
            - name: wait-for-restore-ready
              image: bash:latest
              volumeMounts:
                - name: rclone-restores
                  mountPath: /docker-entrypoint-initdb.d
              command:
                - bash
                - -cx
                - |-
                  until [ -f /docker-entrypoint-initdb.d/.restored ]; do
                     sleep 5
                  done
            {{- range (.Values | get "primary.initContainers" list) }}
            - {{ . | toYaml | nindent 14 }}
            {{- end }}
      # Configure the sub-chart
      - postgresql-rclone:
          nameOverride: "rclone"
          postgresql:
            host: {{ .Values.chart.namePrefix }}postgresql
            auth:
              postgresqlUser: postgres
              postgresqlPassword: {{ .Values.auth.postgresPassword }}
            databases:
              - {{ .Values.auth.database }}
          local: {{ .Values.local | toYaml | nindent 12 }}
          rclone: {{ .Values.rclone | toYaml | nindent 12 }}
          backup: {{ .Values.backup | toYaml | nindent 12 }}
          restore: {{ .Values.restore | toYaml | nindent 12 }}