|
| 1 | +{{/* |
| 2 | +Expand the name of the chart. |
| 3 | +*/}} |
| 4 | +{{- define "feast-operator.name" -}} |
| 5 | +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} |
| 6 | +{{- end }} |
| 7 | + |
| 8 | +{{/* |
| 9 | +Generate a DNS-1123 compatible name with a suffix, ensuring total length <= 63 |
| 10 | +Usage: {{ include "feast-operator.fullnameWithSuffix" (dict "root" . "suffix" "metrics") }} |
| 11 | +*/}} |
| 12 | +{{- define "feast-operator.fullnameWithSuffix" -}} |
| 13 | +{{- $root := .root -}} |
| 14 | +{{- $suffix := .suffix -}} |
| 15 | +{{- $base := include "feast-operator.fullname" $root -}} |
| 16 | +{{- $max := 63 -}} |
| 17 | +{{- $needed := add (len $suffix) 1 -}} |
| 18 | +{{- $trim := sub $max $needed -}} |
| 19 | +{{- printf "%s-%s" (trunc (int $trim) $base) $suffix | trimSuffix "-" -}} |
| 20 | +{{- end }} |
| 21 | + |
| 22 | +{{/* |
| 23 | +Create a default fully qualified app name. |
| 24 | +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 25 | +If release name contains chart name it will be used as a full name. |
| 26 | +*/}} |
| 27 | +{{- define "feast-operator.fullname" -}} |
| 28 | +{{- $name := "" }} |
| 29 | +{{- if .Values.fullnameOverride }} |
| 30 | +{{- $name = .Values.fullnameOverride }} |
| 31 | +{{- else }} |
| 32 | +{{- $chartName := default .Chart.Name .Values.nameOverride }} |
| 33 | +{{- if contains $chartName .Release.Name }} |
| 34 | +{{- $name = .Release.Name }} |
| 35 | +{{- else }} |
| 36 | +{{- $name = printf "%s-%s" .Release.Name $chartName }} |
| 37 | +{{- end }} |
| 38 | +{{- end }} |
| 39 | +{{- $prefix := .Values.namePrefix | default "" }} |
| 40 | +{{- printf "%s%s" $prefix $name | trunc 63 | trimSuffix "-" }} |
| 41 | +{{- end }} |
| 42 | + |
| 43 | +{{/* |
| 44 | +Create chart name and version as used by the chart label. |
| 45 | +*/}} |
| 46 | +{{- define "feast-operator.chart" -}} |
| 47 | +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} |
| 48 | +{{- end }} |
| 49 | + |
| 50 | +{{/* |
| 51 | +Common labels |
| 52 | +*/}} |
| 53 | +{{- define "feast-operator.labels" -}} |
| 54 | +helm.sh/chart: {{ include "feast-operator.chart" . }} |
| 55 | +{{ include "feast-operator.selectorLabels" . }} |
| 56 | +{{- if .Chart.AppVersion }} |
| 57 | +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} |
| 58 | +{{- end }} |
| 59 | +app.kubernetes.io/managed-by: {{ .Release.Service }} |
| 60 | +app.kubernetes.io/name: feast-operator |
| 61 | +{{- with .Values.commonLabels }} |
| 62 | +{{ toYaml . }} |
| 63 | +{{- end }} |
| 64 | +{{- end }} |
| 65 | + |
| 66 | +{{/* |
| 67 | +Selector labels |
| 68 | +*/}} |
| 69 | +{{- define "feast-operator.selectorLabels" -}} |
| 70 | +app.kubernetes.io/name: {{ include "feast-operator.name" . }} |
| 71 | +app.kubernetes.io/instance: {{ .Release.Name }} |
| 72 | +control-plane: controller-manager |
| 73 | +{{- end }} |
| 74 | + |
| 75 | +{{/* |
| 76 | +Create the name of the service account to use |
| 77 | +*/}} |
| 78 | +{{- define "feast-operator.serviceAccountName" -}} |
| 79 | +{{- if .Values.serviceAccount.create }} |
| 80 | +{{- default (printf "%s-controller-manager" (include "feast-operator.fullname" .)) .Values.serviceAccount.name }} |
| 81 | +{{- else }} |
| 82 | +{{- default "default" .Values.serviceAccount.name }} |
| 83 | +{{- end }} |
| 84 | +{{- end }} |
| 85 | + |
| 86 | +{{/* |
| 87 | +Create the namespace |
| 88 | +*/}} |
| 89 | +{{- define "feast-operator.namespace" -}} |
| 90 | +{{- if .Values.namespace.name }} |
| 91 | +{{- .Values.namespace.name }} |
| 92 | +{{- else }} |
| 93 | +{{- .Release.Namespace }} |
| 94 | +{{- end }} |
| 95 | +{{- end }} |
| 96 | + |
| 97 | +{{/* |
| 98 | +Create image reference |
| 99 | +*/}} |
| 100 | +{{- define "feast-operator.image" -}} |
| 101 | +{{- if .Values.global.imageRegistry }} |
| 102 | +{{- printf "%s/%s:%s" .Values.global.imageRegistry .Values.operator.image.repository .Values.operator.image.tag }} |
| 103 | +{{- else }} |
| 104 | +{{- printf "%s:%s" .Values.operator.image.repository .Values.operator.image.tag }} |
| 105 | +{{- end }} |
| 106 | +{{- end }} |
| 107 | + |
| 108 | +{{/* |
| 109 | +Common annotations |
| 110 | +*/}} |
| 111 | +{{- define "feast-operator.annotations" -}} |
| 112 | +{{- with .Values.commonAnnotations }} |
| 113 | +{{ toYaml . }} |
| 114 | +{{- end }} |
| 115 | +{{- end }} |
0 commit comments