_helpers.tpl 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {{/* vim: set filetype=mustache: */}}
  2. {{/*
  3. Expand the name of the chart.
  4. */}}
  5. {{- define "mastodon.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 "mastodon.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 "mastodon.chart" -}}
  29. {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
  30. {{- end }}
  31. {{/*
  32. Common labels
  33. */}}
  34. {{- define "mastodon.labels" -}}
  35. helm.sh/chart: {{ include "mastodon.chart" . }}
  36. {{ include "mastodon.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 "mastodon.selectorLabels" -}}
  46. app.kubernetes.io/name: {{ include "mastodon.name" . }}
  47. app.kubernetes.io/instance: {{ .Release.Name }}
  48. {{- end }}
  49. {{/*
  50. Create the name of the service account to use
  51. */}}
  52. {{- define "mastodon.serviceAccountName" -}}
  53. {{- if .Values.serviceAccount.create }}
  54. {{- default (include "mastodon.fullname" .) .Values.serviceAccount.name }}
  55. {{- else }}
  56. {{- default "default" .Values.serviceAccount.name }}
  57. {{- end }}
  58. {{- end }}
  59. {{/*
  60. Create a default fully qualified name for dependent services.
  61. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
  62. */}}
  63. {{- define "mastodon.elasticsearch.fullname" -}}
  64. {{- printf "%s-%s" .Release.Name "elasticsearch" | trunc 63 | trimSuffix "-" -}}
  65. {{- end -}}
  66. {{- define "mastodon.redis.fullname" -}}
  67. {{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}}
  68. {{- end -}}
  69. {{- define "mastodon.postgresql.fullname" -}}
  70. {{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}}
  71. {{- end -}}