Switch Loki to StatefulSet (#585)

Signed-off-by: Steven Sheehy <ssheehy@firescope.com>
pull/631/head
Steven Sheehy 6 years ago committed by Cyril Tovena
parent e58b1db6ce
commit 18392ea19c
  1. 13
      production/helm/README.md
  2. 2
      production/helm/loki-stack/Chart.yaml
  3. 2
      production/helm/loki/Chart.yaml
  4. 22
      production/helm/loki/templates/pvc.yaml
  5. 19
      production/helm/loki/templates/service-headless.yaml
  6. 40
      production/helm/loki/templates/statefulset.yaml
  7. 12
      production/helm/loki/values.yaml

@ -105,20 +105,17 @@ tls:
## How to contribute
If you want to add any feature to helm chart, you can follow as below:
After adding your new feature to the appropriate chart, you can build and deploy it locally to test:
```bash
$ # do some changes to loki/promtail in the corresponding directory
$ make helm
$ helm upgrade --install loki ./loki-stack-*.tgz
```
After verify changes, need to bump chart version.
For example, if you update the loki chart, you need to bump the version as following:
After verifying your changes, you need to bump the chart version following [semantic versioning](https://semver.org) rules.
For example, if you update the loki chart, you need to bump the versions as follows:
```bash
$ # update version loki/Chart.yaml
$ # update version loki-stack/Chart.yaml
```
- 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`.

@ -1,5 +1,5 @@
name: loki-stack
version: 0.9.5
version: 0.10.0
appVersion: 0.0.1
kubeVersion: "^1.10.0-0"
description: "Loki: like Prometheus, but for logs."

@ -1,5 +1,5 @@
name: loki
version: 0.8.5
version: 0.9.0
appVersion: 0.0.1
kubeVersion: "^1.10.0-0"
description: "Loki: like Prometheus, but for logs."

@ -1,22 +0,0 @@
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ template "loki.fullname" . }}
labels:
app: {{ template "loki.name" . }}
chart: {{ template "loki.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
annotations:
{{- toYaml .Values.persistence.annotations | nindent 4 }}
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
storageClassName: {{ .Values.persistence.storageClassName }}
{{- end }}

@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "loki.fullname" . }}-headless
labels:
app: {{ template "loki.name" . }}
chart: {{ template "loki.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
clusterIP: None
ports:
- port: {{ .Values.service.port }}
protocol: TCP
name: http-metrics
targetPort: http-metrics
selector:
app: {{ template "loki.name" . }}
release: {{ .Release.Name }}

@ -1,5 +1,5 @@
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: {{ template "loki.fullname" . }}
labels:
@ -10,17 +10,15 @@ metadata:
annotations:
{{- toYaml .Values.annotations | nindent 4 }}
spec:
podManagementPolicy: {{ .Values.podManagementPolicy }}
replicas: {{ .Values.replicas }}
minReadySeconds: {{ .Values.minReadySeconds }}
selector:
matchLabels:
app: {{ template "loki.name" . }}
release: {{ .Release.Name }}
strategy:
type: {{ .Values.deploymentStrategy }}
{{- if ne .Values.deploymentStrategy "RollingUpdate" }}
rollingUpdate: null
{{- end }}
serviceName: {{ template "loki.fullname" . }}-headless
updateStrategy:
{{- toYaml .Values.updateStrategy | nindent 4 }}
template:
metadata:
labels:
@ -29,7 +27,7 @@ spec:
release: {{ .Release.Name }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
@ -50,7 +48,7 @@ spec:
- "-config.file=/etc/loki/loki.yaml"
{{- range $key, $value := .Values.extraArgs }}
- "-{{ $key }}={{ $value }}"
{{- end }}
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/loki
@ -85,11 +83,25 @@ spec:
- name: config
secret:
secretName: {{ template "loki.fullname" . }}
{{- if not .Values.persistence.enabled }}
- name: storage
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "loki.fullname" .) }}
{{- else }}
emptyDir: {}
{{- end }}
{{- else if .Values.persistence.existingClaim }}
- name: storage
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim }}
{{- else }}
volumeClaimTemplates:
- metadata:
name: storage
annotations:
{{- toYaml .Values.persistence.annotations | nindent 8 }}
spec:
accessModes:
{{- toYaml .Values.persistence.accessModes | nindent 8 }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
storageClassName: {{ .Values.persistence.storageClassName }}
{{- end }}

@ -11,7 +11,7 @@ affinity: {}
# - loki
# topologyKey: "kubernetes.io/hostname"
## Deployment annotations
## StatefulSet annotations
annotations: {}
# enable tracing for debug, need install jaeger and specify right jaeger_agent_host
@ -20,7 +20,6 @@ tracing:
config:
auth_enabled: false
ingester:
chunk_idle_period: 15m
chunk_block_size: 262144
@ -63,8 +62,6 @@ config:
retention_deletes_enabled: false
retention_period: 0
deploymentStrategy: RollingUpdate
image:
repository: grafana/loki
tag: latest
@ -80,8 +77,6 @@ livenessProbe:
port: http-metrics
initialDelaySeconds: 45
minReadySeconds: 0
## Enable persistence using Persistent Volume Claims
networkPolicy:
enabled: false
@ -111,6 +106,8 @@ podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/port: "http-metrics"
podManagementPolicy: OrderedReady
## Assign a PriorityClassName to pods if set
# priorityClassName:
@ -162,3 +159,6 @@ tolerations: []
podDisruptionBudget: {}
# minAvailable: 1
# maxUnavailable: 1
updateStrategy:
type: RollingUpdate

Loading…
Cancel
Save