_names.tpl 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {{/* Contains functions for generating names */}}
  2. {{/* Returns the name of the Chart */}}
  3. {{- define "ix.v1.common.lib.chart.names.name" -}}
  4. {{- .Chart.Name | lower | trunc 63 | trimSuffix "-" -}}
  5. {{- end -}}
  6. {{/* Returns the fullname of the Chart */}}
  7. {{- define "ix.v1.common.lib.chart.names.fullname" -}}
  8. {{- $name := include "ix.v1.common.lib.chart.names.name" . -}}
  9. {{- if contains $name .Release.Name -}}
  10. {{- $name = .Release.Name -}}
  11. {{- else -}}
  12. {{- $name = printf "%s-%s" .Release.Name $name -}}
  13. {{- end -}}
  14. {{- $name | lower | trunc 63 | trimSuffix "-" -}}
  15. {{- end -}}
  16. {{/* Validates names */}}
  17. {{- define "ix.v1.common.lib.chart.names.validation" -}}
  18. {{- $name := .name -}}
  19. {{- if not (mustRegexMatch "^[a-z0-9]([a-z0-9]-?|-?[a-z0-9]){0,61}[a-z0-9]$" $name) -}}
  20. {{- fail (printf "Name [%s] is not valid. Must start and end with an alphanumeric lowercase character. It can contain '-'. And must be at most 63 characters." $name) -}}
  21. {{- end -}}
  22. {{- end -}}
  23. {{/* Create chart name and version as used by the chart label */}}
  24. {{- define "ix.v1.common.lib.chart.names.chart" -}}
  25. {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
  26. {{- end -}}