mirror of https://github.com/grafana/loki
Helm: Add Table Manager support to Loki helm chart (#8098)
The Table Manager is a Loki component which takes care of creating a periodic table before its time period begins, and deleting it once its data time range exceeds the retention period. This PR is to add Table Manager support to the loki helm chart deployment as the current chart is based on the deprecated loki-simple-scalable chart that did not support Table Manager. Fixes #<6830>pull/8200/head
parent
b6004050a6
commit
af93f4a11e
@ -0,0 +1,32 @@ |
|||||||
|
{{/* |
||||||
|
table-manager fullname |
||||||
|
*/}} |
||||||
|
{{- define "loki.tableManagerFullname" -}} |
||||||
|
{{ include "loki.fullname" . }}-table-manager |
||||||
|
{{- end }} |
||||||
|
|
||||||
|
{{/* |
||||||
|
table-manager common labels |
||||||
|
*/}} |
||||||
|
{{- define "loki.tableManagerLabels" -}} |
||||||
|
{{ include "loki.labels" . }} |
||||||
|
app.kubernetes.io/component: table-manager |
||||||
|
{{- end }} |
||||||
|
|
||||||
|
{{/* |
||||||
|
table-manager selector labels |
||||||
|
*/}} |
||||||
|
{{- define "loki.tableManagerSelectorLabels" -}} |
||||||
|
{{ include "loki.selectorLabels" . }} |
||||||
|
app.kubernetes.io/component: table-manager |
||||||
|
{{- end }} |
||||||
|
|
||||||
|
{{/* |
||||||
|
table-manager priority class name |
||||||
|
*/}} |
||||||
|
{{- define "loki.tableManagerPriorityClassName" -}} |
||||||
|
{{- $pcn := coalesce .Values.global.priorityClassName .Values.tableManager.priorityClassName -}} |
||||||
|
{{- if $pcn }} |
||||||
|
priorityClassName: {{ $pcn }} |
||||||
|
{{- end }} |
||||||
|
{{- end }} |
||||||
@ -0,0 +1,112 @@ |
|||||||
|
{{- if .Values.tableManager.enabled }} |
||||||
|
apiVersion: apps/v1 |
||||||
|
kind: Deployment |
||||||
|
metadata: |
||||||
|
name: {{ include "loki.tableManagerFullname" . }} |
||||||
|
labels: |
||||||
|
{{- include "loki.tableManagerLabels" . | nindent 4 }} |
||||||
|
{{- with .Values.loki.annotations }} |
||||||
|
annotations: |
||||||
|
{{- toYaml . | nindent 4 }} |
||||||
|
{{- end }} |
||||||
|
spec: |
||||||
|
replicas: 1 |
||||||
|
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} |
||||||
|
selector: |
||||||
|
matchLabels: |
||||||
|
{{- include "loki.tableManagerSelectorLabels" . | nindent 6 }} |
||||||
|
template: |
||||||
|
metadata: |
||||||
|
annotations: |
||||||
|
checksum/config: {{ include (print .Template.BasePath "/configmap.yaml") . | sha256sum }} |
||||||
|
{{- with .Values.loki.podAnnotations }} |
||||||
|
{{- toYaml . | nindent 8 }} |
||||||
|
{{- end }} |
||||||
|
{{- with .Values.tableManager.podAnnotations }} |
||||||
|
{{- toYaml . | nindent 8 }} |
||||||
|
{{- end }} |
||||||
|
labels: |
||||||
|
{{- include "loki.tableManagerSelectorLabels" . | nindent 8 }} |
||||||
|
{{- with .Values.loki.podLabels }} |
||||||
|
{{- toYaml . | nindent 8 }} |
||||||
|
{{- end }} |
||||||
|
{{- with .Values.tableManager.podLabels }} |
||||||
|
{{- toYaml . | nindent 8 }} |
||||||
|
{{- end }} |
||||||
|
spec: |
||||||
|
serviceAccountName: {{ include "loki.serviceAccountName" . }} |
||||||
|
{{- with .Values.imagePullSecrets }} |
||||||
|
imagePullSecrets: |
||||||
|
{{- toYaml . | nindent 8 }} |
||||||
|
{{- end }} |
||||||
|
{{- include "loki.tableManagerPriorityClassName" . | nindent 6 }} |
||||||
|
securityContext: |
||||||
|
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }} |
||||||
|
terminationGracePeriodSeconds: {{ .Values.tableManager.terminationGracePeriodSeconds }} |
||||||
|
containers: |
||||||
|
- name: table-manager |
||||||
|
image: {{ include "loki.image" . }} |
||||||
|
imagePullPolicy: {{ .Values.loki.image.pullPolicy }} |
||||||
|
args: |
||||||
|
- -config.file=/etc/loki/config/config.yaml |
||||||
|
- -target=table-manager |
||||||
|
{{- with .Values.tableManager.extraArgs }} |
||||||
|
{{- toYaml . | nindent 12 }} |
||||||
|
{{- end }} |
||||||
|
ports: |
||||||
|
- name: http-metrics |
||||||
|
containerPort: 3100 |
||||||
|
protocol: TCP |
||||||
|
- name: grpc |
||||||
|
containerPort: 9095 |
||||||
|
protocol: TCP |
||||||
|
{{- with .Values.tableManager.extraEnv }} |
||||||
|
env: |
||||||
|
{{- toYaml . | nindent 12 }} |
||||||
|
{{- end }} |
||||||
|
{{- with .Values.tableManager.extraEnvFrom }} |
||||||
|
envFrom: |
||||||
|
{{- toYaml . | nindent 12 }} |
||||||
|
{{- end }} |
||||||
|
securityContext: |
||||||
|
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }} |
||||||
|
readinessProbe: |
||||||
|
{{- toYaml .Values.loki.readinessProbe | nindent 12 }} |
||||||
|
livenessProbe: |
||||||
|
{{- toYaml .Values.loki.livenessProbe | nindent 12 }} |
||||||
|
volumeMounts: |
||||||
|
- name: config |
||||||
|
mountPath: /etc/loki/config |
||||||
|
{{- with .Values.tableManager.extraVolumeMounts }} |
||||||
|
{{- toYaml . | nindent 12 }} |
||||||
|
{{- end }} |
||||||
|
resources: |
||||||
|
{{- toYaml .Values.tableManager.resources | nindent 12 }} |
||||||
|
{{- if .Values.tableManager.extraContainers }} |
||||||
|
{{- toYaml .Values.tableManager.extraContainers | nindent 8}} |
||||||
|
{{- end }} |
||||||
|
{{- with .Values.tableManager.affinity }} |
||||||
|
affinity: |
||||||
|
{{- tpl . $ | nindent 8 }} |
||||||
|
{{- end }} |
||||||
|
{{- with .Values.tableManager.nodeSelector }} |
||||||
|
nodeSelector: |
||||||
|
{{- toYaml . | nindent 8 }} |
||||||
|
{{- end }} |
||||||
|
{{- with .Values.tableManager.tolerations }} |
||||||
|
tolerations: |
||||||
|
{{- toYaml . | nindent 8 }} |
||||||
|
{{- end }} |
||||||
|
volumes: |
||||||
|
- name: config |
||||||
|
{{- if .Values.loki.existingSecretForConfig }} |
||||||
|
secret: |
||||||
|
secretName: {{ .Values.loki.existingSecretForConfig }} |
||||||
|
{{- else }} |
||||||
|
configMap: |
||||||
|
name: {{ include "loki.fullname" . }} |
||||||
|
{{- end }} |
||||||
|
{{- with .Values.tableManager.extraVolumes }} |
||||||
|
{{- toYaml . | nindent 8 }} |
||||||
|
{{- end }} |
||||||
|
{{- end }} |
||||||
@ -0,0 +1,30 @@ |
|||||||
|
{{- if .Values.tableManager.enabled }} |
||||||
|
apiVersion: v1 |
||||||
|
kind: Service |
||||||
|
metadata: |
||||||
|
name: {{ include "loki.fullname" . }}-table-manager |
||||||
|
labels: |
||||||
|
{{- include "loki.labels" . | nindent 4 }} |
||||||
|
{{- with .Values.tableManager.serviceLabels }} |
||||||
|
{{- toYaml . | nindent 4 }} |
||||||
|
{{- end }} |
||||||
|
app.kubernetes.io/component: table-manager |
||||||
|
{{- with .Values.loki.serviceAnnotations }} |
||||||
|
annotations: |
||||||
|
{{- toYaml . | nindent 4 }} |
||||||
|
{{- end }} |
||||||
|
spec: |
||||||
|
type: ClusterIP |
||||||
|
ports: |
||||||
|
- name: http-metrics |
||||||
|
port: 3100 |
||||||
|
targetPort: http-metrics |
||||||
|
protocol: TCP |
||||||
|
- name: grpc |
||||||
|
port: 9095 |
||||||
|
targetPort: grpc |
||||||
|
protocol: TCP |
||||||
|
selector: |
||||||
|
{{- include "loki.selectorLabels" . | nindent 4 }} |
||||||
|
app.kubernetes.io/component: table-manager |
||||||
|
{{- end }} |
||||||
@ -0,0 +1,57 @@ |
|||||||
|
{{- if .Values.tableManager.enabled }} |
||||||
|
{{- with .Values.serviceMonitor }} |
||||||
|
{{- if .enabled }} |
||||||
|
apiVersion: monitoring.coreos.com/v1 |
||||||
|
kind: ServiceMonitor |
||||||
|
metadata: |
||||||
|
name: {{ include "loki.tableManagerFullname" $ }} |
||||||
|
{{- with .namespace }} |
||||||
|
namespace: {{ . }} |
||||||
|
{{- end }} |
||||||
|
{{- with .annotations }} |
||||||
|
annotations: |
||||||
|
{{- toYaml . | nindent 4 }} |
||||||
|
{{- end }} |
||||||
|
labels: |
||||||
|
{{- include "loki.tableManagerLabels" $ | nindent 4 }} |
||||||
|
{{- with .labels }} |
||||||
|
{{- toYaml . | nindent 4 }} |
||||||
|
{{- end }} |
||||||
|
spec: |
||||||
|
{{- with .namespaceSelector }} |
||||||
|
namespaceSelector: |
||||||
|
{{- toYaml . | nindent 4 }} |
||||||
|
{{- end }} |
||||||
|
selector: |
||||||
|
matchLabels: |
||||||
|
{{- include "loki.tableManagerSelectorLabels" $ | nindent 6 }} |
||||||
|
endpoints: |
||||||
|
- port: http-metrics |
||||||
|
{{- with .interval }} |
||||||
|
interval: {{ . }} |
||||||
|
{{- end }} |
||||||
|
{{- with .scrapeTimeout }} |
||||||
|
scrapeTimeout: {{ . }} |
||||||
|
{{- end }} |
||||||
|
{{- with .relabelings }} |
||||||
|
relabelings: |
||||||
|
{{- toYaml . | nindent 8 }} |
||||||
|
{{- end }} |
||||||
|
{{- with .metricRelabelings }} |
||||||
|
metricRelabelings: |
||||||
|
{{- toYaml . | nindent 8 }} |
||||||
|
{{- end }} |
||||||
|
{{- with .scheme }} |
||||||
|
scheme: {{ . }} |
||||||
|
{{- end }} |
||||||
|
{{- with .tlsConfig }} |
||||||
|
tlsConfig: |
||||||
|
{{- toYaml . | nindent 8 }} |
||||||
|
{{- end }} |
||||||
|
{{- with .targetLabels }} |
||||||
|
targetLabels: |
||||||
|
{{- toYaml . | nindent 4 }} |
||||||
|
{{- end }} |
||||||
|
{{- end }} |
||||||
|
{{- end }} |
||||||
|
{{- end }} |
||||||
Loading…
Reference in new issue