You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
2.9 KiB

  1. {{/* vim: set filetype=mustache: */}}
  2. {{/*
  3. Expand the name of the chart.
  4. */}}
  5. {{- define "wiki.name" -}}
  6. {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
  7. {{- end -}}
  8. {{/*
  9. Create a default fully qualified app name.
  10. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
  11. If release name contains chart name it will be used as a full name.
  12. */}}
  13. {{- define "wiki.fullname" -}}
  14. {{- if .Values.fullnameOverride -}}
  15. {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
  16. {{- else -}}
  17. {{- $name := default .Chart.Name .Values.nameOverride -}}
  18. {{- if contains $name .Release.Name -}}
  19. {{- .Release.Name | trunc 63 | trimSuffix "-" -}}
  20. {{- else -}}
  21. {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
  22. {{- end -}}
  23. {{- end -}}
  24. {{- end -}}
  25. {{/*
  26. Create chart name and version as used by the chart label.
  27. */}}
  28. {{- define "wiki.chart" -}}
  29. {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
  30. {{- end -}}
  31. {{/*
  32. Common labels
  33. */}}
  34. {{- define "wiki.labels" -}}
  35. helm.sh/chart: {{ include "wiki.chart" . }}
  36. {{ include "wiki.selectorLabels" . }}
  37. {{- if .Chart.AppVersion }}
  38. app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
  39. {{- end }}
  40. app.kubernetes.io/managed-by: {{ .Release.Service }}
  41. {{- end -}}
  42. {{/*
  43. Selector labels
  44. */}}
  45. {{- define "wiki.selectorLabels" -}}
  46. app.kubernetes.io/name: {{ include "wiki.name" . }}
  47. app.kubernetes.io/instance: {{ .Release.Name }}
  48. {{- end -}}
  49. {{/*
  50. Create the name of the service account to use
  51. */}}
  52. {{- define "wiki.serviceAccountName" -}}
  53. {{- if .Values.serviceAccount.create -}}
  54. {{ default (include "wiki.fullname" .) .Values.serviceAccount.name }}
  55. {{- else -}}
  56. {{ default "default" .Values.serviceAccount.name }}
  57. {{- end -}}
  58. {{- end -}}
  59. {{/*
  60. Create a default fully qualified app name.
  61. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
  62. */}}
  63. {{- define "wiki.postgresql.fullname" -}}
  64. {{- if .Values.postgresql.fullnameOverride -}}
  65. {{- .Values.postgresql.fullnameOverride | trunc 63 | trimSuffix "-" -}}
  66. {{- else -}}
  67. {{ printf "%s-%s" .Release.Name "postgresql"}}
  68. {{- end -}}
  69. {{- end -}}
  70. {{/*
  71. Set postgres host
  72. */}}
  73. {{- define "wiki.postgresql.host" -}}
  74. {{- if .Values.postgresql.enabled -}}
  75. {{- template "wiki.postgresql.fullname" . -}}
  76. {{- else -}}
  77. {{- .Values.postgresql.postgresqlHost | quote -}}
  78. {{- end -}}
  79. {{- end -}}
  80. {{/*
  81. Set postgres secret
  82. */}}
  83. {{- define "wiki.postgresql.secret" -}}
  84. {{- if .Values.postgresql.enabled -}}
  85. {{- template "wiki.postgresql.fullname" . -}}
  86. {{- else -}}
  87. {{- template "wiki.fullname" . -}}
  88. {{- end -}}
  89. {{- end -}}
  90. {{/*
  91. Set postgres secretKey
  92. */}}
  93. {{- define "wiki.postgresql.secretKey" -}}
  94. {{- if .Values.postgresql.enabled -}}
  95. "postgresql-password"
  96. {{- else -}}
  97. {{- default "postgresql-password" .Values.postgresql.existingSecretKey | quote -}}
  98. {{- end -}}
  99. {{- end -}}