From 23a86d0890928423796bdae2e52667753a3ace5b Mon Sep 17 00:00:00 2001 From: polar3130 <47264004+polar3130@users.noreply.github.com> Date: Fri, 25 Oct 2019 00:08:00 +0900 Subject: [PATCH] Helm: Fix the reference error of loki/loki helm chart (#1056) * fix a reference error of loki/loki helm chart add new valuable "client.name" instead of "promtail.name" * bump loki-stack chart * Add missing chart version Co-authored-by: cyriltovena --- production/helm/fluent-bit/Chart.yaml | 1 + production/helm/loki-stack/Chart.yaml | 3 ++- production/helm/loki/Chart.yaml | 3 ++- production/helm/loki/templates/_helpers.tpl | 18 ++++++++++++++++++ .../helm/loki/templates/networkpolicy.yaml | 2 +- production/helm/loki/values.yaml | 4 ++++ production/helm/promtail/Chart.yaml | 1 + 7 files changed, 29 insertions(+), 3 deletions(-) diff --git a/production/helm/fluent-bit/Chart.yaml b/production/helm/fluent-bit/Chart.yaml index 909edfd06dfa1..cdeff1f45fb00 100644 --- a/production/helm/fluent-bit/Chart.yaml +++ b/production/helm/fluent-bit/Chart.yaml @@ -1,3 +1,4 @@ +apiVersion: "v1" name: fluent-bit version: 0.0.2 appVersion: v0.0.1 diff --git a/production/helm/loki-stack/Chart.yaml b/production/helm/loki-stack/Chart.yaml index eb14e6690a754..3d804f8fd0e5b 100644 --- a/production/helm/loki-stack/Chart.yaml +++ b/production/helm/loki-stack/Chart.yaml @@ -1,5 +1,6 @@ +apiVersion: "v1" name: loki-stack -version: 0.17.3 +version: 0.17.4 appVersion: v0.3.0 kubeVersion: "^1.10.0-0" description: "Loki: like Prometheus, but for logs." diff --git a/production/helm/loki/Chart.yaml b/production/helm/loki/Chart.yaml index 80ed0585503c6..e2576ca10c2bb 100644 --- a/production/helm/loki/Chart.yaml +++ b/production/helm/loki/Chart.yaml @@ -1,5 +1,6 @@ +apiVersion: "v1" name: loki -version: 0.16.0 +version: 0.16.1 appVersion: v0.3.0 kubeVersion: "^1.10.0-0" description: "Loki: like Prometheus, but for logs." diff --git a/production/helm/loki/templates/_helpers.tpl b/production/helm/loki/templates/_helpers.tpl index 2e333aae60f88..5e12a470f1787 100644 --- a/production/helm/loki/templates/_helpers.tpl +++ b/production/helm/loki/templates/_helpers.tpl @@ -41,3 +41,21 @@ Create the name of the service account {{ default "default" .Values.serviceAccount.name }} {{- end -}} {{- end -}} + +{{/* +Create the app name of loki clients. Defaults to the same logic as "loki.fullname", and default client expects "promtail". +*/}} +{{- define "client.name" -}} +{{- if .Values.client.name -}} +{{- .Values.client.name -}} +{{- else if .Values.client.fullnameOverride -}} +{{- .Values.client.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default "promtail" .Values.client.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} diff --git a/production/helm/loki/templates/networkpolicy.yaml b/production/helm/loki/templates/networkpolicy.yaml index dea85abcaf2fd..31d24d70031c0 100644 --- a/production/helm/loki/templates/networkpolicy.yaml +++ b/production/helm/loki/templates/networkpolicy.yaml @@ -19,7 +19,7 @@ spec: - from: - podSelector: matchLabels: - app: {{ template "promtail.name" . }} + app: {{ template "client.name" . }} release: {{ .Release.Name }} - ports: - port: {{ .Values.service.port }} diff --git a/production/helm/loki/values.yaml b/production/helm/loki/values.yaml index 7088515eb2cd3..ca4a84cdcefd6 100644 --- a/production/helm/loki/values.yaml +++ b/production/helm/loki/values.yaml @@ -84,6 +84,10 @@ livenessProbe: networkPolicy: enabled: false +## The app name of loki clients +client: {} + # name: + ## ref: https://kubernetes.io/docs/user-guide/node-selection/ nodeSelector: {} diff --git a/production/helm/promtail/Chart.yaml b/production/helm/promtail/Chart.yaml index 12fd854ffdf79..4ecc958a7c079 100644 --- a/production/helm/promtail/Chart.yaml +++ b/production/helm/promtail/Chart.yaml @@ -1,3 +1,4 @@ +apiVersion: "v1" name: promtail version: 0.12.3 appVersion: v0.3.0