Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch Loki to StatefulSet #585

Merged
merged 1 commit into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions production/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
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.5
version: 0.10.0
appVersion: 0.0.1
kubeVersion: "^1.10.0-0"
description: "Loki: like Prometheus, but for logs."
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
22 changes: 0 additions & 22 deletions production/helm/loki/templates/pvc.yaml

This file was deleted.

19 changes: 19 additions & 0 deletions production/helm/loki/templates/service-headless.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
steven-sheehy marked this conversation as resolved.
Show resolved Hide resolved
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 }}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: {{ template "loki.fullname" . }}
labels:
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -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
Expand Down Expand Up @@ -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 }}
steven-sheehy marked this conversation as resolved.
Show resolved Hide resolved
{{- 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 }}

12 changes: 6 additions & 6 deletions production/helm/loki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,7 +20,6 @@ tracing:

config:
auth_enabled: false

ingester:
chunk_idle_period: 15m
chunk_block_size: 262144
Expand Down Expand Up @@ -63,8 +62,6 @@ config:
retention_deletes_enabled: false
retention_period: 0

deploymentStrategy: RollingUpdate

image:
repository: grafana/loki
tag: latest
Expand All @@ -80,8 +77,6 @@ livenessProbe:
port: http-metrics
initialDelaySeconds: 45

minReadySeconds: 0

## Enable persistence using Persistent Volume Claims
networkPolicy:
enabled: false
Expand Down Expand Up @@ -111,6 +106,8 @@ podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/port: "http-metrics"

podManagementPolicy: OrderedReady

## Assign a PriorityClassName to pods if set
# priorityClassName:

Expand Down Expand Up @@ -162,3 +159,6 @@ tolerations: []
podDisruptionBudget: {}
# minAvailable: 1
# maxUnavailable: 1

updateStrategy:
type: RollingUpdate