Skip to content

Commit

Permalink
This add make target to deploy a dev version using helm (grafana#586)
Browse files Browse the repository at this point in the history
* add a dev target to deploy the current image in k8s

* impr/clients: Handle TLS config and MTLS for logcli and promtail (grafana#540)

* impr/clients: Handle TLS config and MTLS for logcli and promtail

* fix/tls: Please gofmt...

* impr/clients: use prometheus HTTPClientConfig for logcli and promtail

* fix/promtail: Set proper Client config name

* impr/promtail: Use prometheus HTTPClientConfig configuration

* adapt with master

* address review

* fix conflicts

* address requested changes

* remove file

* add helm dev targets

* adding back assets

* fix review comments

* Review feedback
  • Loading branch information
cyriltovena authored May 24, 2019
1 parent 1e4a0ca commit 30209ec
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 8 deletions.
3 changes: 3 additions & 0 deletions production/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,6 @@ For example, if you update the loki chart, you need to bump the version as follo
```bash
$ # update version loki/Chart.yaml
$ # update version loki-stack/Chart.yaml
```

You can use the `make helm-debug` to test and print out all chart templates. If you want to install helm (tiller) in your cluster use `make helm-install`, to install the current build in your Kubernetes cluster run `make helm-upgrade`.
2 changes: 1 addition & 1 deletion production/helm/loki-stack/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: loki-stack
version: 0.9.3
version: 0.9.4
appVersion: 0.0.1
kubeVersion: "^1.10.0-0"
description: "Loki: like Prometheus, but for logs."
Expand Down
9 changes: 8 additions & 1 deletion production/helm/loki-stack/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ dependencies:
condition: promtail.enabled
repository: "file://../promtail"
version: "^0.6.0"

- name: "grafana"
condition: grafana.enabled
version: "~3.3.7"
repository: "https://kubernetes-charts.storage.googleapis.com/"
- name: "prometheus"
condition: prometheus.enabled
version: "~8.11.2"
repository: "https://kubernetes-charts.storage.googleapis.com/"
32 changes: 32 additions & 0 deletions production/helm/loki-stack/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "loki-stack.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "loki-stack.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "loki-stack.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
30 changes: 30 additions & 0 deletions production/helm/loki-stack/templates/datasources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- if and .Values.grafana.enabled .Values.grafana.sidecar.datasources.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "loki-stack.fullname" . }}
labels:
app: {{ template "loki-stack.name" . }}
chart: {{ template "loki-stack.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
grafana_datasource: "1"
data:
loki-stack-datasource.yaml: |-
apiVersion: 1
datasources:
{{- if .Values.loki.enabled }}
- name: Loki
type: loki
access: proxy
url: http://{{(include "loki.serviceName" .)}}:{{ .Values.loki.service.port }}
version: 1
{{- end }}
{{- if .Values.prometheus.enabled }}
- name: Prometheus
type: prometheus
access: proxy
url: http://{{ .Values.prometheus.server.fullnameOverride }}:{{ .Values.prometheus.server.service.servicePort }}
version: 1
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions production/helm/loki-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,13 @@ loki:
promtail:
enabled: true

grafana:
enabled: false
sidecar:
datasources:
enabled: true

prometheus:
enabled: false
server:
fullnameOverride: prometheus-server
6 changes: 3 additions & 3 deletions production/helm/loki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ persistence:
podLabels: {}

## Pod Annotations
podAnnotations: {}
# prometheus.io/scrape: "true"
# prometheus.io/port: "http-metrics"
podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/port: "http-metrics"

## Assign a PriorityClassName to pods if set
# priorityClassName:
Expand Down
6 changes: 3 additions & 3 deletions production/helm/promtail/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ pipelineStages:
## Pod Labels
podLabels: {}

podAnnotations: {}
# prometheus.io/scrape: "true"
# prometheus.io/port: "http-metrics"
podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/port: "http-metrics"

# This should match config.server.http_listen_port
port: 3101
Expand Down

0 comments on commit 30209ec

Please sign in to comment.