diff --git a/charts/loki-distributed/Chart.yaml b/charts/loki-distributed/Chart.yaml index 593328a21b..6702fb2ee8 100644 --- a/charts/loki-distributed/Chart.yaml +++ b/charts/loki-distributed/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: loki-distributed description: Helm chart for Grafana Loki in microservices mode type: application -appVersion: 1.6.1 -version: 0.11.1 +appVersion: 2.0.0 +version: 0.12.0 home: https://github.com/unguiculus/loki-helm-chart sources: - https://github.com/grafana/loki diff --git a/charts/loki-distributed/README.md b/charts/loki-distributed/README.md index 1d1ffa8fd1..9bc0131259 100644 --- a/charts/loki-distributed/README.md +++ b/charts/loki-distributed/README.md @@ -1,6 +1,6 @@ # loki-distributed -![Version: 0.11.0](https://img.shields.io/badge/Version-0.11.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.6.1](https://img.shields.io/badge/AppVersion-1.6.1-informational?style=flat-square) +![Version: 0.12.0](https://img.shields.io/badge/Version-0.12.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.0.0](https://img.shields.io/badge/AppVersion-2.0.0-informational?style=flat-square) Helm chart for Grafana Loki in microservices mode @@ -24,6 +24,18 @@ helm repo add loki https://unguiculus.github.io/loki-helm-chart | Key | Type | Default | Description | |-----|------|---------|-------------| +| compactor.enabled | bool | `false` | Specifies whether compactor should be enabled | +| compactor.extraArgs | list | `[]` | Additional CLI args for the compactor | +| compactor.extraEnv | list | `[]` | Environment variables to add to the compactor pods | +| compactor.extraEnvFrom | list | `[]` | Environment variables from secrets or configmaps to add to the compactor pods | +| compactor.nodeSelector | object | `{}` | Node selector for compactor pods | +| compactor.persistence.enabled | bool | `false` | Enable creating PVCs for the compactor | +| compactor.persistence.size | string | `"10Gi"` | Size of persistent disk | +| compactor.persistence.storageClass | string | `""` | Storage class to be used. If defined, storageClassName: . If set to "-", storageClassName: "", which disables dynamic provisioning. If empty (the default) or set to null, no storageClassName spec is set, choosing the default provisioner (gp2 on AWS, standard on GKE, AWS, and OpenStack). | +| compactor.podAnnotations | object | `{}` | Annotations for compactor pods | +| compactor.resources | object | `{}` | Resource requests and limits for the compactor | +| compactor.terminationGracePeriodSeconds | int | `30` | Grace period to allow the compactor to shutdown before it is killed | +| compactor.tolerations | list | `[]` | Tolerations for compactor pods | | distributor.affinity | string | Hard node and soft zone anti-affinity | Affinity for distributor pods. Passed through `tpl` and, thus, to be configured as string | | distributor.extraArgs | list | `[]` | Additional CLI args for the distributor | | distributor.extraEnv | list | `[]` | Environment variables to add to the distributor pods | @@ -231,6 +243,7 @@ loki: ingestion_rate_mb: 10 ingestion_burst_size_mb: 20 max_concurrent_tail_requests: 20 + max_cache_freshness_per_query: 10m schema_config: configs: @@ -260,7 +273,6 @@ loki: cache_results: true results_cache: - max_freshness: 10m cache: enable_fifocache: true fifocache: diff --git a/charts/loki-distributed/README.md.gotmpl b/charts/loki-distributed/README.md.gotmpl index 69ffb3c806..d7668500ef 100644 --- a/charts/loki-distributed/README.md.gotmpl +++ b/charts/loki-distributed/README.md.gotmpl @@ -53,9 +53,12 @@ loki: store: memberlist ingester: - # disable chunk transfer which is not possible with statefulsets + # Disable chunk transfer which is not possible with statefulsets # and unnecessary for boltdb-shipper max_transfer_retries: 0 + chunk_idle_period: 1h + chunk_target_size: 1536000 + max_chunk_age: 1h lifecycler: join_after: 0s ring: @@ -70,6 +73,7 @@ loki: ingestion_rate_mb: 10 ingestion_burst_size_mb: 20 max_concurrent_tail_requests: 20 + max_cache_freshness_per_query: 10m schema_config: configs: @@ -99,7 +103,6 @@ loki: cache_results: true results_cache: - max_freshness: 10m cache: enable_fifocache: true fifocache: diff --git a/charts/loki-distributed/ci/cache-values.yaml b/charts/loki-distributed/ci/cache-values.yaml index d10e2ba915..3d04b32d46 100644 --- a/charts/loki-distributed/ci/cache-values.yaml +++ b/charts/loki-distributed/ci/cache-values.yaml @@ -80,7 +80,6 @@ loki: split_queries_by_interval: 30m cache_results: true results_cache: - max_freshness: 10m cache: memcached_client: consistent_hash: true diff --git a/charts/loki-distributed/templates/compactor/_helpers-compactor.tpl b/charts/loki-distributed/templates/compactor/_helpers-compactor.tpl new file mode 100644 index 0000000000..fc68ba017b --- /dev/null +++ b/charts/loki-distributed/templates/compactor/_helpers-compactor.tpl @@ -0,0 +1,22 @@ +{{/* +compactor fullname +*/}} +{{- define "loki.compactorFullname" -}} +{{ include "loki.fullname" . }}-compactor +{{- end }} + +{{/* +compactor common labels +*/}} +{{- define "loki.compactorLabels" -}} +{{ include "loki.labels" . }} +app.kubernetes.io/component: compactor +{{- end }} + +{{/* +compactor selector labels +*/}} +{{- define "loki.compactorSelectorLabels" -}} +{{ include "loki.selectorLabels" . }} +app.kubernetes.io/component: compactor +{{- end }} diff --git a/charts/loki-distributed/templates/compactor/deployment-compactor.yaml b/charts/loki-distributed/templates/compactor/deployment-compactor.yaml new file mode 100644 index 0000000000..65dfdf991e --- /dev/null +++ b/charts/loki-distributed/templates/compactor/deployment-compactor.yaml @@ -0,0 +1,97 @@ +{{- if .Values.compactor.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "loki.compactorFullname" . }} + labels: + {{- include "loki.compactorLabels" . | nindent 4 }} +spec: + replicas: 1 + revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "loki.compactorSelectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + checksum/config: {{ include (print .Template.BasePath "/configmap.yaml") $ | sha256sum }} + {{- with .Values.loki.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.compactor.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "loki.compactorSelectorLabels" . | nindent 8 }} + spec: + serviceAccountName: {{ include "loki.serviceAccountName" . }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + fsGroup: 10001 + runAsGroup: 10001 + runAsNonRoot: true + runAsUser: 10001 + terminationGracePeriodSeconds: {{ .Values.compactor.terminationGracePeriodSeconds }} + containers: + - name: loki + image: {{ include "loki.image" . }} + imagePullPolicy: {{ .Values.loki.image.pullPolicy }} + args: + - -config.file=/etc/loki/loki.yaml + - -target=compactor + - -boltdb.shipper.compactor.working-directory=/var/loki/compactor + {{- with .Values.compactor.extraArgs }} + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + - name: http + containerPort: 3100 + protocol: TCP + {{- with .Values.compactor.extraEnv }} + env: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.compactor.extraEnvFrom }} + envFrom: + {{- toYaml . | nindent 12 }} + {{- end }} + securityContext: + readOnlyRootFilesystem: true + readinessProbe: + httpGet: + path: /ready + port: http + initialDelaySeconds: 15 + timeoutSeconds: 1 + volumeMounts: + - name: config + mountPath: /etc/loki + - name: data + mountPath: /var/loki + resources: + {{- toYaml .Values.compactor.resources | nindent 12 }} + {{- with .Values.compactor.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.compactor.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: config + configMap: + name: data-{{ include "loki.fullname" . }} + - name: data + {{- if .Values.compactor.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "loki.compactorFullname" . }} + {{- else }} + emptyDir: {} + {{- end }} +{{- end }} diff --git a/charts/loki-distributed/templates/compactor/persistentvolumeclaim-compactor.yaml b/charts/loki-distributed/templates/compactor/persistentvolumeclaim-compactor.yaml new file mode 100644 index 0000000000..b5ad79c430 --- /dev/null +++ b/charts/loki-distributed/templates/compactor/persistentvolumeclaim-compactor.yaml @@ -0,0 +1,17 @@ +{{- if .Values.compactor.enabled }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: data-{{ include "loki.compactorFullname" . }} + labels: + {{- include "loki.compactorLabels" . | nindent 4 }} +spec: + accessModes: + - ReadWriteOnce + {{- with .Values.compactor.persistence.storageClass }} + storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} + {{- end }} + resources: + requests: + storage: "{{ .Values.compactor.persistence.size }}" +{{- end }} diff --git a/charts/loki-distributed/templates/compactor/service-compactor.yaml b/charts/loki-distributed/templates/compactor/service-compactor.yaml new file mode 100644 index 0000000000..03ffbd48e7 --- /dev/null +++ b/charts/loki-distributed/templates/compactor/service-compactor.yaml @@ -0,0 +1,19 @@ +{{- if .Values.compactor.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "loki.fullname" . }}-compactor + labels: + {{- include "loki.labels" . | nindent 4 }} + app.kubernetes.io/component: compactor +spec: + type: ClusterIP + ports: + - name: http + port: 3100 + targetPort: http + protocol: TCP + selector: + {{- include "loki.selectorLabels" . | nindent 4 }} + app.kubernetes.io/component: compactor +{{- end }} diff --git a/charts/loki-distributed/templates/compactor/servicemonitor-compactor.yaml b/charts/loki-distributed/templates/compactor/servicemonitor-compactor.yaml new file mode 100644 index 0000000000..1ea74e7152 --- /dev/null +++ b/charts/loki-distributed/templates/compactor/servicemonitor-compactor.yaml @@ -0,0 +1,38 @@ +{{- if .Values.compactor.enabled }} +{{- with .Values.serviceMonitor }} +{{- if .enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "loki.compactorFullname" $ }} + {{- with .namespace }} + namespace: {{ . }} + {{- end }} + {{- with .annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "loki.compactorLabels" $ | nindent 4 }} + {{- with .labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- with .namespaceSelector }} + namespaceSelector: + {{- toYaml . | nindent 4 }} + {{- end }} + selector: + matchLabels: + {{- include "loki.compactorSelectorLabels" $ | nindent 6 }} + endpoints: + - port: http + {{- with .interval }} + interval: {{ . }} + {{- end }} + {{- with .scrapeTimeout }} + scrapeTimeout: {{ . }} + {{- end }} +{{- end }} +{{- end }} +{{- end }} diff --git a/charts/loki-distributed/values.yaml b/charts/loki-distributed/values.yaml index a40c62becf..f379c3aa48 100644 --- a/charts/loki-distributed/values.yaml +++ b/charts/loki-distributed/values.yaml @@ -53,6 +53,7 @@ loki: enforce_metric_name: false reject_old_samples: true reject_old_samples_max_age: 168h + max_cache_freshness_per_query: 10m schema_config: configs: @@ -83,7 +84,6 @@ loki: split_queries_by_interval: 15m cache_results: true results_cache: - max_freshness: 10m cache: enable_fifocache: true fifocache: @@ -488,6 +488,38 @@ gateway: } } +# Configuration for the compactor +compactor: + # compactor.enabled -- Specifies whether compactor should be enabled + enabled: false + # compactor.podAnnotations -- Annotations for compactor pods + podAnnotations: {} + # compactor.extraArgs -- Additional CLI args for the compactor + extraArgs: [] + # compactor.extraEnv -- Environment variables to add to the compactor pods + extraEnv: [] + # compactor.extraEnvFrom -- Environment variables from secrets or configmaps to add to the compactor pods + extraEnvFrom: [] + # compactor.resources -- Resource requests and limits for the compactor + resources: {} + # compactor.terminationGracePeriodSeconds -- Grace period to allow the compactor to shutdown before it is killed + terminationGracePeriodSeconds: 30 + # compactor.nodeSelector -- Node selector for compactor pods + nodeSelector: {} + # compactor.tolerations -- Tolerations for compactor pods + tolerations: [] + persistence: + # compactor.persistence.enabled -- Enable creating PVCs for the compactor + enabled: false + # compactor.persistence.size -- Size of persistent disk + size: 10Gi + # compactor.persistence.storageClass -- Storage class to be used. + # If defined, storageClassName: . + # If set to "-", storageClassName: "", which disables dynamic provisioning. + # If empty (the default) or set to null, no storageClassName spec is + # set, choosing the default provisioner (gp2 on AWS, standard on GKE, AWS, and OpenStack). + storageClass: "" + memcached: image: # memcached.image.repository -- Memcached Docker image repository