_helpers.tpl 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. {{/* vim: set filetype=mustache: */}}
  2. {{/*
  3. Expand the name of the chart.
  4. */}}
  5. {{- define "rancher.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. */}}
  12. {{- define "rancher.fullname" -}}
  13. {{- $name := default .Chart.Name .Values.nameOverride -}}
  14. {{- if contains $name .Release.Name -}}
  15. {{- .Release.Name | trunc 63 | trimSuffix "-" -}}
  16. {{- else -}}
  17. {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
  18. {{- end -}}
  19. {{- end -}}
  20. {{/*
  21. Create a default fully qualified chart name.
  22. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
  23. */}}
  24. {{- define "rancher.chartname" -}}
  25. {{- printf "%s-%s" .Chart.Name .Chart.Version | trunc 63 | trimSuffix "-" -}}
  26. {{- end -}}
  27. # Render Values in configurationSnippet
  28. {{- define "configurationSnippet" -}}
  29. {{- tpl (.Values.ingress.configurationSnippet) . | nindent 6 -}}
  30. {{- end -}}
  31. {{/*
  32. Generate the labels.
  33. */}}
  34. {{- define "rancher.labels" -}}
  35. app: {{ template "rancher.fullname" . }}
  36. chart: {{ template "rancher.chartname" . }}
  37. heritage: {{ .Release.Service }}
  38. release: {{ .Release.Name }}
  39. {{- end }}
  40. # Windows Support
  41. {{/*
  42. Windows cluster will add default taint for linux nodes,
  43. add below linux tolerations to workloads could be scheduled to those linux nodes
  44. */}}
  45. {{- define "linux-node-tolerations" -}}
  46. - key: "cattle.io/os"
  47. value: "linux"
  48. effect: "NoSchedule"
  49. operator: "Equal"
  50. {{- end -}}
  51. {{- define "linux-node-selector-terms" -}}
  52. {{- $key := "kubernetes.io/os" -}}
  53. - matchExpressions:
  54. - key: {{ $key }}
  55. operator: NotIn
  56. values:
  57. - windows
  58. {{- end -}}
  59. {{- define "system_default_registry" -}}
  60. {{- if .Values.systemDefaultRegistry -}}
  61. {{- if hasSuffix "/" .Values.systemDefaultRegistry -}}
  62. {{- printf "%s" .Values.systemDefaultRegistry -}}
  63. {{- else -}}
  64. {{- printf "%s/" .Values.systemDefaultRegistry -}}
  65. {{- end -}}
  66. {{- end -}}
  67. {{- end -}}