_helpers.tpl 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. {{/*
  2. Expand the name of the chart.
  3. */}}
  4. {{- define "shop-recycle.name" -}}
  5. {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
  6. {{- end }}
  7. {{/*
  8. Create a default fully qualified app name.
  9. */}}
  10. {{- define "shop-recycle.fullname" -}}
  11. {{- if .Values.fullnameOverride }}
  12. {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
  13. {{- else }}
  14. {{- $name := default .Chart.Name .Values.nameOverride }}
  15. {{- if contains $name .Release.Name }}
  16. {{- .Release.Name | trunc 63 | trimSuffix "-" }}
  17. {{- else }}
  18. {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
  19. {{- end }}
  20. {{- end }}
  21. {{- end }}
  22. {{/*
  23. Create chart name and version as used by the chart label.
  24. */}}
  25. {{- define "shop-recycle.chart" -}}
  26. {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
  27. {{- end }}
  28. {{/*
  29. Common labels
  30. */}}
  31. {{- define "shop-recycle.labels" -}}
  32. helm.sh/chart: {{ include "shop-recycle.chart" . }}
  33. {{ include "shop-recycle.selectorLabels" . }}
  34. {{- if .Chart.AppVersion }}
  35. app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
  36. {{- end }}
  37. app.kubernetes.io/managed-by: {{ .Release.Service }}
  38. environment: {{ .Values.environment }}
  39. {{- end }}
  40. {{/*
  41. Selector labels
  42. */}}
  43. {{- define "shop-recycle.selectorLabels" -}}
  44. app.kubernetes.io/name: {{ include "shop-recycle.name" . }}
  45. app.kubernetes.io/instance: {{ .Release.Name }}
  46. {{- end }}
  47. {{/*
  48. Create the name of the service account to use
  49. */}}
  50. {{- define "shop-recycle.serviceAccountName" -}}
  51. {{- if .Values.rbac.serviceAccountName }}
  52. {{- .Values.rbac.serviceAccountName }}
  53. {{- else }}
  54. {{- include "shop-recycle.fullname" . }}
  55. {{- end }}
  56. {{- end }}
  57. {{/*
  58. Return image reference
  59. */}}
  60. {{- define "shop-recycle.image" -}}
  61. {{- $registry := .Values.image.registry }}
  62. {{- $namespace := .Values.image.namespace }}
  63. {{- $name := .service }}
  64. {{- $tag := .Values.image.tag | default .Chart.AppVersion }}
  65. {{- printf "%s/%s/%s:%s" $registry $namespace $name $tag }}
  66. {{- end }}
  67. {{/*
  68. Generate Docker registry config (.dockercfg) for imagePullSecret
  69. */}}
  70. {{- define "shop-recycle.registrySecret" -}}
  71. {{- $username := .Values.global.registry.username }}
  72. {{- $password := .Values.global.registry.password }}
  73. {{- $email := .Values.global.registry.email }}
  74. {{- $registry := .Values.image.registry }}
  75. {{- $auth := printf "%s:%s" $username $password | b64enc }}
  76. {{- printf "{%q:{%q:%q,%q:%q,%q:%q,%q:%q}}" $registry "username" $username "password" $password "email" $email "auth" $auth }}
  77. {{- end }}