Scott Baker | e3090f0 | 2022-05-31 15:51:41 -0700 | [diff] [blame] | 1 | {{/* vim: set filetype=mustache: */}} |
| 2 | {{/* |
| 3 | SPDX-FileCopyrightText: 2022-present Intel Corporation |
| 4 | SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org> |
| 5 | SPDX-License-Identifier: Apache-2.0 |
| 6 | |
| 7 | Expand the name of the chart. |
| 8 | */}} |
| 9 | {{- define "fabric-adapter.name" -}} |
| 10 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} |
| 11 | {{- end -}} |
| 12 | |
| 13 | {{/* |
| 14 | Create a default fully qualified app name. |
| 15 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 16 | If release name contains chart name it will be used as a full name. |
| 17 | */}} |
| 18 | {{- define "fabric-adapter.fullname" -}} |
| 19 | {{- if .Values.fullnameOverride -}} |
| 20 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} |
| 21 | {{- else -}} |
| 22 | {{- $name := default .Chart.Name .Values.nameOverride -}} |
| 23 | {{- if contains $name .Release.Name -}} |
| 24 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}} |
| 25 | {{- else -}} |
| 26 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} |
| 27 | {{- end -}} |
| 28 | {{- end -}} |
| 29 | {{- end -}} |
| 30 | |
| 31 | {{/* |
| 32 | Create chart name and version as used by the chart label. |
| 33 | */}} |
| 34 | {{- define "fabric-adapter.chart" -}} |
| 35 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} |
| 36 | {{- end -}} |
| 37 | |
| 38 | |
| 39 | {{/* |
| 40 | Common labels |
| 41 | */}} |
| 42 | {{- define "fabric-adapter.labels" -}} |
| 43 | helm.sh/chart: {{ include "fabric-adapter.chart" . }} |
| 44 | {{ include "fabric-adapter.selectorLabels" . }} |
| 45 | {{- if .Chart.AppVersion }} |
| 46 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} |
| 47 | {{- end }} |
| 48 | app.kubernetes.io/managed-by: {{ .Release.Service }} |
| 49 | {{- end -}} |
| 50 | |
| 51 | {{/* |
| 52 | Selector labels |
| 53 | */}} |
| 54 | {{- define "fabric-adapter.selectorLabels" -}} |
| 55 | app.kubernetes.io/name: {{ include "fabric-adapter.name" . }} |
| 56 | app.kubernetes.io/instance: {{ .Release.Name }} |
| 57 | {{- end -}} |
Ray Milkey | cd9f8d1 | 2022-08-09 12:27:09 -0700 | [diff] [blame] | 58 | |
| 59 | {{/* |
| 60 | fabric-adapter consensus image name |
| 61 | */}} |
| 62 | {{- define "fabric-adapter.store.consensus.imagename" -}} |
| 63 | {{- if or .Values.store.consensus.image.tag .Values.global.store.consensus.image.tag -}} |
| 64 | {{- if .Values.global.store.consensus.image.registry -}} |
| 65 | {{- printf "%s/" .Values.global.store.consensus.image.registry -}} |
| 66 | {{- else if .Values.store.consensus.image.registry -}} |
| 67 | {{- printf "%s/" .Values.store.consensus.image.registry -}} |
| 68 | {{- end -}} |
| 69 | {{- printf "%s:" .Values.store.consensus.image.repository -}} |
| 70 | {{- if .Values.global.store.consensus.image.tag -}} |
| 71 | {{- .Values.global.store.consensus.image.tag -}} |
| 72 | {{- else -}} |
| 73 | {{- .Values.store.consensus.image.tag -}} |
| 74 | {{- end -}} |
| 75 | {{- else -}} |
| 76 | "" |
| 77 | {{- end -}} |
| 78 | {{- end -}} |
| 79 | |
| 80 | {{/* |
| 81 | fabric-adapter consensus store name |
| 82 | */}} |
| 83 | {{- define "fabric-adapter.store.consensus.name" -}} |
| 84 | {{- if .Values.store.consensus.name -}} |
| 85 | {{- printf "%s" .Values.store.consensus.name -}} |
| 86 | {{- else -}} |
| 87 | {{- printf "%s-consensus-store" ( include "fabric-adapter.fullname" . ) -}} |
| 88 | {{- end -}} |
| 89 | {{- end -}} |