_helpers.tpl 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. {{/*
  2. Expand the name of the chart.
  3. */}}
  4. {{- define "deepflow.name" -}}
  5. {{- $deepflowChartName := "deepflow" }}
  6. {{- default $deepflowChartName .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 "deepflow.fullname" -}}
  14. {{- if .Values.fullnameOverride }}
  15. {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
  16. {{- else }}
  17. {{- $deepflowChartName := "deepflow" }}
  18. {{- $name := default $deepflowChartName .Values.nameOverride }}
  19. {{- if contains $name .Release.Name }}
  20. {{- .Release.Name | trunc 63 | trimSuffix "-" }}
  21. {{- else }}
  22. {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
  23. {{- end }}
  24. {{- end }}
  25. {{- end }}
  26. {{/*
  27. Create chart name and version as used by the chart label.
  28. */}}
  29. {{- define "deepflow.chart" -}}
  30. {{- $deepflowChartName := "deepflow" }}
  31. {{- printf "%s-%s" $deepflowChartName .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
  32. {{- end }}
  33. {{/*
  34. Common labels
  35. */}}
  36. {{- define "deepflow.labels" -}}
  37. helm.sh/chart: {{ include "deepflow.chart" . }}
  38. {{ include "deepflow.selectorLabels" . }}
  39. {{- if .Chart.AppVersion }}
  40. app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
  41. {{- end }}
  42. app.kubernetes.io/managed-by: {{ .Release.Service }}
  43. {{- end }}
  44. {{/*
  45. Selector labels
  46. */}}
  47. {{- define "deepflow.selectorLabels" -}}
  48. app: deepflow
  49. app.kubernetes.io/name: {{ include "deepflow.name" . }}
  50. app.kubernetes.io/instance: {{ .Release.Name }}
  51. {{- end }}
  52. {{/*
  53. Common labels
  54. */}}
  55. {{- define "deepflow-server.labels" -}}
  56. helm.sh/chart: {{ include "deepflow.chart" . }}
  57. {{ include "deepflow.selectorLabels" . }}
  58. {{- if .Chart.AppVersion }}
  59. app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
  60. {{- end }}
  61. app.kubernetes.io/managed-by: {{ .Release.Service }}
  62. {{- end }}
  63. {{/*
  64. Selector labels
  65. */}}
  66. {{- define "deepflow-server.selectorLabels" -}}
  67. app: deepflow
  68. component: deepflow-server
  69. app.kubernetes.io/name: {{ include "deepflow.name" . }}
  70. app.kubernetes.io/instance: {{ .Release.Name }}
  71. {{- end }}
  72. {{/*
  73. Common labels
  74. */}}
  75. {{- define "deepflow-app.labels" -}}
  76. helm.sh/chart: {{ include "deepflow.chart" . }}
  77. {{ include "deepflow-app.selectorLabels" . }}
  78. {{- if .Chart.AppVersion }}
  79. app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
  80. {{- end }}
  81. app.kubernetes.io/managed-by: {{ .Release.Service }}
  82. {{- end }}
  83. {{/*
  84. Selector labels
  85. */}}
  86. {{- define "deepflow-app.selectorLabels" -}}
  87. app: deepflow
  88. component: deepflow-app
  89. app.kubernetes.io/name: {{ include "deepflow.name" . }}
  90. app.kubernetes.io/instance: {{ .Release.Name }}
  91. {{- end }}