Skip to content

Commit

Permalink
chore: support parameters api for loki
Browse files Browse the repository at this point in the history
  • Loading branch information
sophon-zt committed Dec 26, 2024
1 parent e97d07c commit dce28cb
Show file tree
Hide file tree
Showing 21 changed files with 535 additions and 1,183 deletions.
510 changes: 26 additions & 484 deletions addons-cluster/loki/templates/_helpers.tpl

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions addons-cluster/loki/templates/cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
name: {{ include "clustername" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "loki-cluster.labels" . | nindent 4 }}
spec:
{{- include "kblib.clusterCommon" . }}
clusterDef: loki
terminationPolicy: {{ .Values.terminationPolicy }}
topology: loki-cluster
terminationPolicy: {{ .Values.terminationPolicy }}
{{- include "loki-cluster.memberlist" . | indent 2 }}
componentSpecs:
- name: backend
{{- include "kblib.componentMonitor" . | indent 6 }}
{{- include "loki-cluster.s3storage" . | indent 6 }}
replicas: {{ .Values.replicas }}
{{- include "kblib.componentResources" . | indent 6 }}
{{- include "kblib.componentStorages" . | indent 6 }}
- name: write
{{- include "kblib.componentMonitor" . | indent 6 }}
replicas: {{ .Values.write.replicas }}
{{- include "loki-cluster.s3storage" . | indent 6 }}
{{- with .Values.write.resources }}
resources:
{{- with .limits }}
Expand All @@ -34,6 +30,7 @@ spec:
- name: read
{{- include "kblib.componentMonitor" . | indent 6 }}
replicas: {{ .Values.read.replicas | default 1 }}
{{- include "loki-cluster.s3storage" . | indent 6 }}
{{- with .Values.read.resources }}
resources:
{{- with .limits }}
Expand Down
10 changes: 0 additions & 10 deletions addons-cluster/loki/templates/configmap-gateway.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions addons-cluster/loki/templates/configmap.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions addons-cluster/loki/templates/runtime-configmap.yaml

This file was deleted.

256 changes: 5 additions & 251 deletions addons-cluster/loki/values.yaml
Original file line number Diff line number Diff line change
@@ -1,208 +1,6 @@
# Default values for loki-cluster.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
loki:
server:
http_listen_port: 3100
grpc_listen_port: 9095
http_server_read_timeout: 600s
http_server_write_timeout: 600s

config: |
{{- if .Values.enterprise.enabled}}
{{- tpl .Values.enterprise.config . }}
{{- else }}
auth_enabled: {{ .Values.loki.auth_enabled }}
{{- end }}
server:
http_listen_port: 3100
grpc_listen_port: 9095
{{- with .Values.loki.extraServerConfig }}
{{- toYaml . | nindent 2 }}
{{- end }}
memberlist:
join_members:
- {{ include "loki-cluster.name" . }}-memberlist
{{- if .Values.loki.commonConfig}}
common:
{{- toYaml .Values.loki.commonConfig | nindent 2}}
storage:
{{- include "loki-cluster.commonStorageConfig" . | nindent 4}}
{{- end}}
limits_config:
reject_old_samples: true
reject_old_samples_max_age: 168h
max_cache_freshness_per_query: 10m
split_queries_by_interval: 15m
query_timeout: 300s
volume_enabled: true
{{- with .Values.loki.memcached.chunk_cache }}
{{- if and .enabled .host }}
chunk_store_config:
chunk_cache_config:
memcached:
batch_size: {{ .batch_size }}
parallelism: {{ .parallelism }}
memcached_client:
host: {{ .host }}
service: {{ .service }}
{{- end }}
{{- end }}
{{- if .Values.loki.schemaConfig}}
schema_config:
{{- toYaml .Values.loki.schemaConfig | nindent 2}}
{{- else }}
schema_config:
configs:
- from: 2022-01-11
store: boltdb-shipper
{{- if eq .Values.loki.storage.type "s3" }}
object_store: s3
{{- else if eq .Values.loki.storage.type "gcs" }}
object_store: gcs
{{- else }}
object_store: filesystem
{{- end }}
schema: v12
index:
prefix: loki_index_
period: 24h
{{- end }}
{{- if or .Values.minio.enabled (eq .Values.loki.storage.type "s3") (eq .Values.loki.storage.type "gcs") }}
ruler:
storage:
{{- include "loki-cluster.rulerStorageConfig" . | nindent 4}}
{{- end -}}
{{- with .Values.loki.memcached.results_cache }}
query_range:
align_queries_with_step: true
{{- if and .enabled .host }}
cache_results: {{ .enabled }}
results_cache:
cache:
default_validity: {{ .default_validity }}
memcached_client:
host: {{ .host }}
service: {{ .service }}
timeout: {{ .timeout }}
{{- end }}
{{- end }}
{{- with .Values.loki.storage_config }}
storage_config:
{{- tpl (. | toYaml) $ | nindent 4 }}
{{- end }}
{{- with .Values.loki.query_scheduler }}
query_scheduler:
{{- tpl (. | toYaml) $ | nindent 4 }}
{{- end }}
auth_enabled: false

commonConfig:
path_prefix: /var/loki
replication_factor: 3

storage:
bucketNames:
chunks: chunks
ruler: ruler
admin: admin
type: null
s3:
s3: null
endpoint: null
region: null
secretAccessKey: null
accessKeyId: null
s3ForcePathStyle: true
insecure: false
gcs:
chunkBufferSize: 0
requestTimeout: "0s"
enableHttp2: true
azure:
accountName: null
accountKey: null
connectionString: null
useManagedIdentity: false
useFederatedToken: false
userAssignedId: null
requestTimeout: null
endpointSuffix: null
swift:
auth_version: null
auth_url: null
internal: null
username: null
user_domain_name: null
user_domain_id: null
user_id: null
password: null
domain_id: null
domain_name: null
project_id: null
project_name: null
project_domain_id: null
project_domain_name: null
region_name: null
container_name: null
max_retries: null
connect_timeout: null
request_timeout: null
local:
chunks_directory: /var/loki/chunks
rules_directory: /var/loki/rules

memcached:
chunk_cache:
enabled: false
host: ""
service: "memcached-client"
batch_size: 256
parallelism: 10
results_cache:
enabled: false
host: ""
service: "memcached-client"
timeout: "500ms"
default_validity: "12h"

schemaConfig:
configs:
- from: 2024-04-01
store: tsdb
object_store: null
schema: v13
index:
prefix: loki_index_
period: 24h

storage_config:
hedging:
at: "250ms"
max_per_second: 20
up_to: 3

querier:
# Default is 4, if you have enough memory and CPU you can increase, reduce if OOMing
max_concurrent: 4

query_scheduler: {}
structuredConfig: {}
runtimeConfig: {}
tenants: []
global:
# -- configures cluster domain ("cluster.local" by default)
clusterDomain: "cluster.local"
Expand All @@ -214,75 +12,26 @@ global:
enterprise:
enabled: false


read:
replicas: 1
httpMetricsPort: 3100
grpcPort: 9095
httpMemberlistPort: 7946
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.

# limits:
# cpu: 500m
# memory: 512Mi
# requests:
# cpu: 500m
# memory: 512Mi

write:
replicas: 1
httpMetricsPort: 3100
grpcPort: 9095
httpMemberlistPort: 7946
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.

# limits:
# cpu: 500m
# memory: 512Mi
# requests:
# cpu: 500m
# memory: 512Mi

backend:
replicas: 1
httpMetricsPort: 3100
grpcPort: 9095
httpMemberlistPort: 7946
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.

# limits:
# cpu: 500m
# memory: 512Mi
# requests:
# cpu: 500m
# memory: 512Mi

gateway:
replicas: 1
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.

# limits:
# cpu: 500m
# memory: 512Mi
# requests:
# cpu: 500m
# memory: 512Mi
basicAuth:
# -- Enables basic authentication for the gateway
enabled: false
Expand Down Expand Up @@ -349,4 +98,9 @@ requests:
##
storage: 20

s3:
## "s3", "local" or "oss"
storageType: ""
secret: ""


Loading

0 comments on commit dce28cb

Please sign in to comment.