Skip to content

Commit

Permalink
Helm: Fix the reference error of loki/loki helm chart (#1056)
Browse files Browse the repository at this point in the history
* 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 <cyril.tovena@gmail.com>
  • Loading branch information
polar3130 and cyriltovena committed Oct 24, 2019
1 parent 94b9c4b commit 87c9452
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions production/helm/fluent-bit/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apiVersion: "v1"
name: fluent-bit
version: 0.0.2
appVersion: v0.0.1
Expand Down
3 changes: 2 additions & 1 deletion production/helm/loki-stack/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apiVersion: "v1"

This comment has been minimized.

Copy link
@shapeofarchitect

shapeofarchitect Jan 24, 2020

@polar3130 / @cyriltovena Firstly thank you for your efforts on this. I just have a small question , I have been using 0.17.0 for Loki-stack and so far it was working fine and recently I was updating my pipelines internally and this version(0.17.0) doesn't work anymore as it fails with below error.

I am wondering by introducing this apiVersion here , Helm client no longer recognize any Chart.yaml which doesn't have apiVersion set. Here is the error I am getting now.

Linting release=loki, chart=/var/folders/3q/9k97mz5s7dj90kwxx58ntfdm0000gn/T/657163572/loki/0.17.0/loki/loki-stack/loki-stack
==> Linting /var/folders/3q/9k97mz5s7dj90kwxx58ntfdm0000gn/T/657163572/loki/0.17.0/loki/loki-stack/loki-stack
[ERROR] Chart.yaml: apiVersion is required
in ./helmfile.yaml: helm exited with status 1:
Error: 1 chart(s) linted, 1 chart(s) failed

Do you think if I need to downgrade my helm client and that's the only way to fix this ?

my versions are:
helm version --short
Client: v2.16.1+gbbdfe5e
Server: v2.14.2+ga8b13cc

This comment has been minimized.

Copy link
@cyriltovena

cyriltovena Jan 24, 2020

Author Contributor

Can you try to remove the version locally and install from there ? happy to remove this if it solves your problem.

This comment has been minimized.

Copy link
@shapeofarchitect

shapeofarchitect Jan 25, 2020

Yes I downgraded the helm version locally and it seemed to work now. But just for my knowledge why did we added apiVersion for this chart.

helm version --short
Client: v2.14.2+ga8b13cc
Server: v2.14.2+ga8b13cc

This comment has been minimized.

Copy link
@cyriltovena

cyriltovena Jan 25, 2020

Author Contributor

The helm doc states that it is required, so we added it.I’m also confused as to why it breaks between 2.14 and 2.16, I tried a 3 version and I didn’t have an issue.

This comment has been minimized.

Copy link
@shapeofarchitect

shapeofarchitect Jan 25, 2020

Yea basically if I try to use any version of helm post >2.14 it will complain and when we upgrade Loki chart from 0.17.0 ---> 0.17.4.
If helm docs require this in the new versions then might be they are saying backward compatibility isn't supported ?

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."
Expand Down
3 changes: 2 additions & 1 deletion production/helm/loki/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
18 changes: 18 additions & 0 deletions production/helm/loki/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
2 changes: 1 addition & 1 deletion production/helm/loki/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
- from:
- podSelector:
matchLabels:
app: {{ template "promtail.name" . }}
app: {{ template "client.name" . }}
release: {{ .Release.Name }}
- ports:
- port: {{ .Values.service.port }}
Expand Down
4 changes: 4 additions & 0 deletions production/helm/loki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}

Expand Down
1 change: 1 addition & 0 deletions production/helm/promtail/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apiVersion: "v1"
name: promtail
version: 0.12.3
appVersion: v0.3.0
Expand Down

0 comments on commit 87c9452

Please sign in to comment.