|
| 1 | +{{/* vim: set filetype=mustache: */}} |
| 2 | +{{/* |
| 3 | +Expand the name of the chart. |
| 4 | +*/}} |
| 5 | +{{- define "newrelic-logging.name" -}} |
| 6 | +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} |
| 7 | +{{- end -}} |
| 8 | + |
| 9 | +{{/* |
| 10 | +Create a default fully qualified app name. |
| 11 | +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 12 | +*/}} |
| 13 | +{{- define "newrelic-logging.fullname" -}} |
| 14 | +{{- $name := default .Chart.Name .Values.nameOverride -}} |
| 15 | +{{- if ne $name .Release.Name -}} |
| 16 | +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} |
| 17 | +{{- else -}} |
| 18 | +{{- printf "%s" $name | trunc 63 | trimSuffix "-" -}} |
| 19 | +{{- end -}} |
| 20 | +{{- end -}} |
| 21 | + |
| 22 | + |
| 23 | +{{/* Generate basic labels */}} |
| 24 | +{{- define "newrelic-logging.labels" }} |
| 25 | +app: {{ template "newrelic-logging.name" . }} |
| 26 | +chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
| 27 | +heritage: {{.Release.Service }} |
| 28 | +release: {{.Release.Name }} |
| 29 | +app.kubernetes.io/name: {{ template "newrelic-logging.name" . }} |
| 30 | +{{- end }} |
| 31 | + |
| 32 | +{{/* |
| 33 | +Create chart name and version as used by the chart label. |
| 34 | +*/}} |
| 35 | +{{- define "newrelic-logging.chart" -}} |
| 36 | +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} |
| 37 | +{{- end -}} |
| 38 | + |
| 39 | +{{/* |
| 40 | +Create the name of the service account to use |
| 41 | +*/}} |
| 42 | +{{- define "newrelic-logging.serviceAccountName" -}} |
| 43 | +{{- if .Values.serviceAccount.create -}} |
| 44 | + {{ default (include "newrelic-logging.fullname" .) .Values.serviceAccount.name }} |
| 45 | +{{- else -}} |
| 46 | + {{ default "default" .Values.serviceAccount.name }} |
| 47 | +{{- end -}} |
| 48 | +{{- end -}} |
| 49 | + |
| 50 | + |
| 51 | +{{/* |
| 52 | +Create the name of the fluent bit config |
| 53 | +*/}} |
| 54 | +{{- define "newrelic-logging.fluentBitConfig" -}} |
| 55 | +{{ template "newrelic-logging.fullname" . }}-fluent-bit-config |
| 56 | +{{- end -}} |
| 57 | + |
| 58 | +{{/* |
| 59 | +Return the licenseKey |
| 60 | +*/}} |
| 61 | +{{- define "newrelic-logging.licenseKey" -}} |
| 62 | +{{- if .Values.global}} |
| 63 | + {{- if .Values.global.licenseKey }} |
| 64 | + {{- .Values.global.licenseKey -}} |
| 65 | + {{- else -}} |
| 66 | + {{- .Values.licenseKey | default "" -}} |
| 67 | + {{- end -}} |
| 68 | +{{- else -}} |
| 69 | + {{- .Values.licenseKey | default "" -}} |
| 70 | +{{- end -}} |
| 71 | +{{- end -}} |
| 72 | + |
| 73 | +{{/* |
| 74 | +Return the clusterName |
| 75 | +*/}} |
| 76 | +{{- define "newrelic-logging.clusterName" -}} |
| 77 | +{{- if .Values.global}} |
| 78 | + {{- if .Values.global.clusterName }} |
| 79 | + {{- .Values.global.clusterName -}} |
| 80 | + {{- else -}} |
| 81 | + {{- .Values.clusterName | default "" -}} |
| 82 | + {{- end -}} |
| 83 | +{{- else -}} |
| 84 | + {{- .Values.clusterName | default "" -}} |
| 85 | +{{- end -}} |
| 86 | +{{- end -}} |
| 87 | + |
| 88 | +{{/* |
| 89 | +Return the customSecretName |
| 90 | +*/}} |
| 91 | +{{- define "newrelic-logging.customSecretName" -}} |
| 92 | +{{- if .Values.global }} |
| 93 | + {{- if .Values.global.customSecretName }} |
| 94 | + {{- .Values.global.customSecretName -}} |
| 95 | + {{- else -}} |
| 96 | + {{- .Values.customSecretName | default "" -}} |
| 97 | + {{- end -}} |
| 98 | +{{- else -}} |
| 99 | + {{- .Values.customSecretName | default "" -}} |
| 100 | +{{- end -}} |
| 101 | +{{- end -}} |
| 102 | + |
| 103 | +{{/* |
| 104 | +Return the customSecretKey |
| 105 | +*/}} |
| 106 | +{{- define "newrelic-logging.customSecretKey" -}} |
| 107 | +{{- if .Values.global }} |
| 108 | + {{- if .Values.global.customSecretKey }} |
| 109 | + {{- .Values.global.customSecretKey -}} |
| 110 | + {{- else -}} |
| 111 | + {{- .Values.customSecretKey | default "" -}} |
| 112 | + {{- end -}} |
| 113 | +{{- else -}} |
| 114 | + {{- .Values.customSecretKey | default "" -}} |
| 115 | +{{- end -}} |
| 116 | +{{- end -}} |
| 117 | + |
| 118 | +{{/* |
| 119 | +Returns if the template should render, it checks if the required values are set. |
| 120 | +*/}} |
| 121 | +{{- define "newrelic-logging.areValuesValid" -}} |
| 122 | +{{- $licenseKey := include "newrelic-logging.licenseKey" . -}} |
| 123 | +{{- $customSecretName := include "newrelic-logging.customSecretName" . -}} |
| 124 | +{{- $customSecretKey := include "newrelic-logging.customSecretKey" . -}} |
| 125 | +{{- and (or $licenseKey (and $customSecretName $customSecretKey))}} |
| 126 | +{{- end -}} |
0 commit comments