_postgres.tpl 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. {{/*
  2. Get Home assistance Postgres Database Name
  3. */}}
  4. {{- define "postgres.DatabaseName" -}}
  5. {{- print "homeassistance" -}}
  6. {{- end -}}
  7. {{- define "postgres.imageName" -}}
  8. {{- print "postgres:13.1" -}}
  9. {{- end -}}
  10. {{/*
  11. Retrieve postgres backup name
  12. This will return a unique name based on revision and chart numbers specified.
  13. */}}
  14. {{- define "postgres.backupName" -}}
  15. {{- $upgradeDict := .Values.ixChartContext.upgradeMetadata -}}
  16. {{- printf "postgres-backup-from-%s-to-%s-revision-%d" $upgradeDict.oldChartVersion $upgradeDict.newChartVersion (int64 $upgradeDict.preUpgradeRevision) -}}
  17. {{- end }}
  18. {{/*
  19. Retrieve postgres credentials for environment variables configuration
  20. */}}
  21. {{- define "postgres.envVariableConfiguration" -}}
  22. {{ $envList := list }}
  23. {{ $envList = mustAppend $envList (dict "name" "POSTGRES_USER" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-user") }}
  24. {{ $envList = mustAppend $envList (dict "name" "POSTGRES_PASSWORD" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-password") }}
  25. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) }}
  26. {{- end -}}
  27. {{/*
  28. Retrieve postgres volume configuration
  29. */}}
  30. {{- define "postgres.volumeConfiguration" -}}
  31. {{ include "common.storage.configureAppVolumes" (dict "appVolumeMounts" .Values.postgresAppVolumeMounts "emptyDirVolumes" .Values.emptyDirVolumes "ixVolumes" .Values.ixVolumes) | nindent 0 }}
  32. {{- end -}}
  33. {{/*
  34. Retrieve postgres volume mounts configuration
  35. */}}
  36. {{- define "postgres.volumeMountsConfiguration" -}}
  37. {{ include "common.storage.configureAppVolumeMountsInContainer" (dict "appVolumeMounts" .Values.postgresAppVolumeMounts ) | nindent 0 }}
  38. {{- end -}}