diff --git a/production/helm/README.md b/production/helm/README.md index 19cadd3017cc..8a4cd098660d 100644 --- a/production/helm/README.md +++ b/production/helm/README.md @@ -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`. diff --git a/production/helm/loki-stack/Chart.yaml b/production/helm/loki-stack/Chart.yaml index 1f5b69491bfb..1209a6ad8b40 100644 --- a/production/helm/loki-stack/Chart.yaml +++ b/production/helm/loki-stack/Chart.yaml @@ -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." diff --git a/production/helm/loki/Chart.yaml b/production/helm/loki/Chart.yaml index cf5aab6f2df3..d0ef9035a057 100644 --- a/production/helm/loki/Chart.yaml +++ b/production/helm/loki/Chart.yaml @@ -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." diff --git a/production/helm/loki/templates/pvc.yaml b/production/helm/loki/templates/pvc.yaml deleted file mode 100644 index 350c04b120ee..000000000000 --- a/production/helm/loki/templates/pvc.yaml +++ /dev/null @@ -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 }} diff --git a/production/helm/loki/templates/service-headless.yaml b/production/helm/loki/templates/service-headless.yaml new file mode 100644 index 000000000000..dbc127b3bea3 --- /dev/null +++ b/production/helm/loki/templates/service-headless.yaml @@ -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 }} diff --git a/production/helm/loki/templates/deployment.yaml b/production/helm/loki/templates/statefulset.yaml similarity index 77% rename from production/helm/loki/templates/deployment.yaml rename to production/helm/loki/templates/statefulset.yaml index e8fe9be095c6..a1813b130aa2 100644 --- a/production/helm/loki/templates/deployment.yaml +++ b/production/helm/loki/templates/statefulset.yaml @@ -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 }} diff --git a/production/helm/loki/values.yaml b/production/helm/loki/values.yaml index 55eed6279190..c1825e85b987 100644 --- a/production/helm/loki/values.yaml +++ b/production/helm/loki/values.yaml @@ -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