-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[loki-distributed] Add overrides exporter
Signed-off-by: Lukas Monkevicius <[email protected]>
- Loading branch information
1 parent
04eb45b
commit 3d9c2aa
Showing
8 changed files
with
368 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
charts/loki-distributed/templates/overrides-exporter/_helpers-overrides-exporter.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{{/* | ||
overrides-exporter fullname | ||
*/}} | ||
{{- define "loki.overridesExporterFullname" -}} | ||
{{ include "loki.fullname" . }}-overrides-exporter | ||
{{- end }} | ||
|
||
{{/* | ||
overrides-exporter common labels | ||
*/}} | ||
{{- define "loki.overridesExporterLabels" -}} | ||
{{ include "loki.labels" . }} | ||
app.kubernetes.io/component: overrides-exporter | ||
{{- end }} | ||
|
||
{{/* | ||
overrides-exporter selector labels | ||
*/}} | ||
{{- define "loki.overridesExporterSelectorLabels" -}} | ||
{{ include "loki.selectorLabels" . }} | ||
app.kubernetes.io/component: overrides-exporter | ||
{{- end }} | ||
|
||
{{/* | ||
overrides-exporter image | ||
*/}} | ||
{{- define "loki.overridesExporterImage" -}} | ||
{{- $dict := dict "loki" .Values.loki.image "service" .Values.overridesExporter.image "global" .Values.global.image "defaultVersion" .Chart.AppVersion -}} | ||
{{- include "loki.lokiImage" $dict -}} | ||
{{- end }} | ||
|
||
{{/* | ||
overrides-exporter priority class name | ||
*/}} | ||
{{- define "loki.overridesExporterPriorityClassName" -}} | ||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.overridesExporter.priorityClassName -}} | ||
{{- if $pcn }} | ||
priorityClassName: {{ $pcn }} | ||
{{- end }} | ||
{{- end }} |
131 changes: 131 additions & 0 deletions
131
charts/loki-distributed/templates/overrides-exporter/deployment-overrides-exporter.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
{{- if .Values.overridesExporter.enabled }} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "loki.overridesExporterFullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "loki.overridesExporterLabels" . | nindent 4 }} | ||
{{- with .Values.loki.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
replicas: {{ .Values.overridesExporter.replicas }} | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 0 | ||
maxUnavailable: {{ .Values.overridesExporter.maxUnavailable }} | ||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} | ||
selector: | ||
matchLabels: | ||
{{- include "loki.overridesExporterSelectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
annotations: | ||
{{- include "loki.config.checksum" . | nindent 8 }} | ||
{{- with .Values.loki.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.overridesExporter.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "loki.overridesExporterSelectorLabels" . | nindent 8 }} | ||
{{- with .Values.loki.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.overridesExporter.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
serviceAccountName: {{ include "loki.serviceAccountName" . }} | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.overridesExporter.hostAliases }} | ||
hostAliases: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- include "loki.overridesExporterPriorityClassName" . | nindent 6 }} | ||
securityContext: | ||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }} | ||
terminationGracePeriodSeconds: {{ .Values.overridesExporter.terminationGracePeriodSeconds }} | ||
containers: | ||
- name: overrides-exporter | ||
image: {{ include "loki.overridesExporterImage" . }} | ||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }} | ||
args: | ||
- -config.file=/etc/loki/config/config.yaml | ||
- -target=overrides-exporter | ||
{{- with .Values.overridesExporter.extraArgs }} | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
ports: | ||
- name: http | ||
containerPort: 3100 | ||
protocol: TCP | ||
- name: grpc | ||
containerPort: 9095 | ||
protocol: TCP | ||
{{- with .Values.overridesExporter.extraEnv }} | ||
env: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- with .Values.overridesExporter.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 | ||
- name: runtime-config | ||
mountPath: /var/{{ include "loki.name" . }}-runtime | ||
{{- with .Values.overridesExporter.extraVolumeMounts }} | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- with .Values.overridesExporter.resources }} | ||
resources: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- if .Values.overridesExporter.extraContainers }} | ||
{{- toYaml .Values.overridesExporter.extraContainers | nindent 8}} | ||
{{- end }} | ||
{{- with .Values.overridesExporter.affinity }} | ||
affinity: | ||
{{- tpl . $ | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.overridesExporter.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.overridesExporter.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
volumes: | ||
- name: config | ||
{{- if .Values.loki.existingSecretForConfig }} | ||
secret: | ||
secretName: {{ .Values.loki.existingSecretForConfig }} | ||
{{- else if .Values.loki.configAsSecret }} | ||
secret: | ||
secretName: {{ include "loki.fullname" . }}-config | ||
{{- else }} | ||
configMap: | ||
name: {{ include "loki.fullname" . }} | ||
{{- end }} | ||
- name: runtime-config | ||
configMap: | ||
name: {{ template "loki.fullname" . }}-runtime | ||
{{- with .Values.overridesExporter.extraVolumes }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- end }} |
20 changes: 20 additions & 0 deletions
20
...loki-distributed/templates/overrides-exporter/poddisruptionbudget-overrides-exporter.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{- if and .Values.overridesExporter.enabled (gt (int .Values.overridesExporter.replicas) 1) }} | ||
{{- if not .Values.overridesExporter.maxUnavailable }} | ||
{{- fail "`.Values.overridesExporter.maxUnavailable` must be set when `.Values.overridesExporter.replicas` is greater than 1." }} | ||
{{- else }} | ||
apiVersion: {{ include "loki.pdb.apiVersion" . }} | ||
kind: PodDisruptionBudget | ||
metadata: | ||
name: {{ include "loki.overridesExporterFullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "loki.overridesExporterLabels" . | nindent 4 }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
{{- include "loki.overridesExporterSelectorLabels" . | nindent 6 }} | ||
{{- with .Values.overridesExporter.maxUnavailable }} | ||
maxUnavailable: {{ . }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
31 changes: 31 additions & 0 deletions
31
charts/loki-distributed/templates/overrides-exporter/service-overrides-exporter.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{{- if .Values.overridesExporter.enabled }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "loki.overridesExporterFullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "loki.overridesExporterLabels" . | nindent 4 }} | ||
{{- with .Values.overridesExporter.serviceLabels }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- with .Values.loki.serviceAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
type: ClusterIP | ||
clusterIP: None | ||
publishNotReadyAddresses: true | ||
ports: | ||
- name: http | ||
port: 3100 | ||
targetPort: http | ||
protocol: TCP | ||
- name: grpclb | ||
port: 9095 | ||
targetPort: grpc | ||
protocol: TCP | ||
selector: | ||
{{- include "loki.overridesExporterSelectorLabels" . | nindent 4 }} | ||
{{- end }} |
57 changes: 57 additions & 0 deletions
57
charts/loki-distributed/templates/overrides-exporter/servicemonitor-overrides-exporter.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{{- if .Values.overridesExporter.enabled }} | ||
{{- with .Values.serviceMonitor }} | ||
{{- if .enabled }} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: {{ include "loki.overridesExporterFullname" $ }} | ||
{{- with .namespace }} | ||
namespace: {{ . }} | ||
{{- end }} | ||
{{- with .annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
labels: | ||
{{- include "loki.overridesExporterLabels" $ | nindent 4 }} | ||
{{- with .labels }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- with .namespaceSelector }} | ||
namespaceSelector: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
selector: | ||
matchLabels: | ||
{{- include "loki.overridesExporterSelectorLabels" $ | nindent 6 }} | ||
{{- with .matchExpressions }} | ||
matchExpressions: | ||
{{- toYaml . | nindent 6 }} | ||
{{- end }} | ||
endpoints: | ||
- port: http | ||
{{- 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 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.