_postgres.tpl 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. {{- define "postgres.imageName" -}}
  2. {{- print "postgres:14.5" -}}
  3. {{- end -}}
  4. {{- define "postgres.nameSuffix" -}}
  5. {{- print "postgres" -}}
  6. {{- end -}}
  7. {{- define "postgres.secretName" -}}
  8. {{- print "postgres-details" -}}
  9. {{- end -}}
  10. {{- define "postgres.dbName" -}}
  11. {{- print "logsearchapi" -}}
  12. {{- end -}}
  13. {{- define "postgres.dbUser" -}}
  14. {{- print "logsearchapi" -}}
  15. {{- end -}}
  16. {{/*
  17. Retrieve postgres backup name
  18. This will return a unique name based on revision and chart numbers specified.
  19. */}}
  20. {{- define "postgres.backupName" -}}
  21. {{- $upgradeDict := .Values.ixChartContext.upgradeMetadata -}}
  22. {{- printf "postgres-backup-from-%s-to-%s-revision-%d" $upgradeDict.oldChartVersion $upgradeDict.newChartVersion (int64 $upgradeDict.preUpgradeRevision) -}}
  23. {{- end -}}
  24. {{- define "postgres.envVariableConfiguration" -}}
  25. {{- $envList := list -}}
  26. {{- $secretName := (include "postgres.secretName" .) -}}
  27. {{- $envList = mustAppend $envList (dict "name" "POSTGRES_USER" "valueFromSecret" true "secretName" $secretName "secretKey" "db_user") -}}
  28. {{- $envList = mustAppend $envList (dict "name" "POSTGRES_DB" "valueFromSecret" true "secretName" $secretName "secretKey" "db_name") -}}
  29. {{- $envList = mustAppend $envList (dict "name" "POSTGRES_PASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "db_password") -}}
  30. {{- include "common.containers.environmentVariables" (dict "environmentVariables" $envList) -}}
  31. {{- end -}}
  32. {{/*
  33. Retrieve postgres volume configuration
  34. */}}
  35. {{- define "postgres.volumeConfiguration" -}}
  36. {{ include "common.storage.configureAppVolumes" (dict "appVolumeMounts" .Values.postgresAppVolumeMounts "emptyDirVolumes" .Values.emptyDirVolumes "ixVolumes" .Values.ixVolumes) | nindent 0 }}
  37. {{- end -}}
  38. {{/*
  39. Retrieve postgres volume mounts configuration
  40. */}}
  41. {{- define "postgres.volumeMountsConfiguration" -}}
  42. {{ include "common.storage.configureAppVolumeMountsInContainer" (dict "appVolumeMounts" .Values.postgresql ) | nindent 0 }}
  43. {{- end -}}