From 55627b2a8ea4c999763bd9d7b4846fceb7ca86de Mon Sep 17 00:00:00 2001 From: Aaron Benton Date: Tue, 7 Jan 2025 11:39:45 -0500 Subject: [PATCH 1/3] Added Support for Overrides Exporter --- docs/sources/setup/install/helm/reference.md | 299 ++++++++++++++++++ .../_helpers-overrides-exporter.tpl | 32 ++ .../deployment-overrides-exporter.yaml | 146 +++++++++ ...oddisruptionbudget-overrides-exporter.yaml | 21 ++ .../service-overrides-exporter-headless.yaml | 39 +++ .../service-overrides-exporter.yaml | 37 +++ 6 files changed, 574 insertions(+) create mode 100644 production/helm/loki/templates/overrides-exporter/_helpers-overrides-exporter.tpl create mode 100644 production/helm/loki/templates/overrides-exporter/deployment-overrides-exporter.yaml create mode 100644 production/helm/loki/templates/overrides-exporter/poddisruptionbudget-overrides-exporter.yaml create mode 100644 production/helm/loki/templates/overrides-exporter/service-overrides-exporter-headless.yaml create mode 100644 production/helm/loki/templates/overrides-exporter/service-overrides-exporter.yaml diff --git a/docs/sources/setup/install/helm/reference.md b/docs/sources/setup/install/helm/reference.md index e0f2fe9dc3829..4713c875c7813 100644 --- a/docs/sources/setup/install/helm/reference.md +++ b/docs/sources/setup/install/helm/reference.md @@ -7660,6 +7660,305 @@ false
 {}
 
+ + + + overridesExporter + object + Configuration for the overrides-exporter +
+{
+  "affinity": {
+    "podAntiAffinity": {
+      "requiredDuringSchedulingIgnoredDuringExecution": [
+        {
+          "labelSelector": {
+            "matchLabels": {
+              "app.kubernetes.io/component": "overrides-exporter"
+            }
+          },
+          "topologyKey": "kubernetes.io/hostname"
+        }
+      ]
+    }
+  },
+  "appProtocol": {
+    "grpc": ""
+  },
+  "command": null,
+  "enabled": false,
+  "extraArgs": [],
+  "extraContainers": [],
+  "extraEnv": [],
+  "extraEnvFrom": [],
+  "extraVolumeMounts": [],
+  "extraVolumes": [],
+  "hostAliases": [],
+  "image": {
+    "registry": null,
+    "repository": null,
+    "tag": null
+  },
+  "initContainers": [],
+  "maxUnavailable": null,
+  "nodeSelector": {},
+  "podAnnotations": {},
+  "podLabels": {},
+  "priorityClassName": null,
+  "replicas": 0,
+  "resources": {},
+  "serviceAnnotations": {},
+  "serviceLabels": {},
+  "terminationGracePeriodSeconds": 300,
+  "tolerations": [],
+  "topologySpreadConstraints": []
+}
+
+ + + + overridesExporter.affinity + object + Affinity for overrides-exporter pods. +
+Hard node anti-affinity
+
+ + + + overridesExporter.appProtocol + object + Set the optional grpc service protocol. Ex: "grpc", "http2" or "https" +
+{
+  "grpc": ""
+}
+
+ + + + overridesExporter.command + string + Command to execute instead of defined in Docker image +
+null
+
+ + + + overridesExporter.enabled + bool + The overrides-exporter component is optional and can be disabled if desired. +
+false
+
+ + + + overridesExporter.extraArgs + list + Additional CLI args for the overrides-exporter +
+[]
+
+ + + + overridesExporter.extraContainers + list + Containers to add to the overrides-exporter pods +
+[]
+
+ + + + overridesExporter.extraEnv + list + Environment variables to add to the overrides-exporter pods +
+[]
+
+ + + + overridesExporter.extraEnvFrom + list + Environment variables from secrets or configmaps to add to the overrides-exporter pods +
+[]
+
+ + + + overridesExporter.extraVolumeMounts + list + Volume mounts to add to the overrides-exporter pods +
+[]
+
+ + + + overridesExporter.extraVolumes + list + Volumes to add to the overrides-exporter pods +
+[]
+
+ + + + overridesExporter.hostAliases + list + hostAliases to add +
+[]
+
+ + + + overridesExporter.image.registry + string + The Docker registry for the overrides-exporter image. Overrides `loki.image.registry` +
+null
+
+ + + + overridesExporter.image.repository + string + Docker image repository for the overrides-exporter image. Overrides `loki.image.repository` +
+null
+
+ + + + overridesExporter.image.tag + string + Docker image tag for the overrides-exporter image. Overrides `loki.image.tag` +
+null
+
+ + + + overridesExporter.initContainers + list + Init containers to add to the overrides-exporter pods +
+[]
+
+ + + + overridesExporter.maxUnavailable + string + Pod Disruption Budget maxUnavailable +
+null
+
+ + + + overridesExporter.nodeSelector + object + Node selector for overrides-exporter pods +
+{}
+
+ + + + overridesExporter.podAnnotations + object + Annotations for overrides-exporter pods +
+{}
+
+ + + + overridesExporter.podLabels + object + Labels for overrides-exporter pods +
+{}
+
+ + + + overridesExporter.priorityClassName + string + The name of the PriorityClass for overrides-exporter pods +
+null
+
+ + + + overridesExporter.replicas + int + Number of replicas for the overrides-exporter +
+0
+
+ + + + overridesExporter.resources + object + Resource requests and limits for the overrides-exporter +
+{}
+
+ + + + overridesExporter.serviceAnnotations + object + Annotations for overrides-exporter service +
+{}
+
+ + + + overridesExporter.serviceLabels + object + Labels for overrides-exporter service +
+{}
+
+ + + + overridesExporter.terminationGracePeriodSeconds + int + Grace period to allow the overrides-exporter to shutdown before it is killed +
+300
+
+ + + + overridesExporter.tolerations + list + Tolerations for overrides-exporter pods +
+[]
+
+ + + + overridesExporter.topologySpreadConstraints + list + Topology Spread Constraints for overrides-exporter pods +
+[]
+
diff --git a/production/helm/loki/templates/overrides-exporter/_helpers-overrides-exporter.tpl b/production/helm/loki/templates/overrides-exporter/_helpers-overrides-exporter.tpl new file mode 100644 index 0000000000000..1baa60e183d90 --- /dev/null +++ b/production/helm/loki/templates/overrides-exporter/_helpers-overrides-exporter.tpl @@ -0,0 +1,32 @@ +{{/* +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 priority class name +*/}} +{{- define "loki.overridesExporterPriorityClassName" -}} +{{- $pcn := coalesce .Values.global.priorityClassName .Values.overridesExporter.priorityClassName -}} +{{- if $pcn }} +priorityClassName: {{ $pcn }} +{{- end }} +{{- end }} diff --git a/production/helm/loki/templates/overrides-exporter/deployment-overrides-exporter.yaml b/production/helm/loki/templates/overrides-exporter/deployment-overrides-exporter.yaml new file mode 100644 index 0000000000000..89b025ec66c02 --- /dev/null +++ b/production/helm/loki/templates/overrides-exporter/deployment-overrides-exporter.yaml @@ -0,0 +1,146 @@ +{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} +{{- if and $isDistributed .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: 1 + 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 }} + app.kubernetes.io/part-of: memberlist + {{- with .Values.loki.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.overridesExporter.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }} + {{- with .Values.overridesExporter.topologySpreadConstraints }} + topologySpreadConstraints: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- end }} + 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.image" . }} + imagePullPolicy: {{ .Values.loki.image.pullPolicy }} + {{- if or .Values.loki.command .Values.overridesExporter.command }} + command: + - {{ coalesce .Values.overridesExporter.command .Values.loki.command | quote }} + {{- end }} + args: + - -config.file=/etc/loki/config/config.yaml + - -target=overrides-exporter + {{- with .Values.overridesExporter.extraArgs }} + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + - name: http-metrics + containerPort: 3100 + protocol: TCP + - name: grpc + containerPort: 9095 + protocol: TCP + - name: http-memberlist + containerPort: 7946 + 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 }} + volumeMounts: + - name: config + mountPath: /etc/loki/config + - name: runtime-config + mountPath: /etc/loki/runtime-config + {{- if .Values.enterprise.enabled }} + - name: license + mountPath: /etc/loki/license + {{- end }} + {{- with .Values.overridesExporter.extraVolumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + resources: + {{- toYaml .Values.overridesExporter.resources | nindent 12 }} + {{- if .Values.overridesExporter.extraContainers }} + {{- toYaml .Values.overridesExporter.extraContainers | nindent 8}} + {{- end }} + {{- with .Values.overridesExporter.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.overridesExporter.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.overridesExporter.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: config + {{- include "loki.configVolume" . | nindent 10 }} + - name: runtime-config + configMap: + name: {{ template "loki.name" . }}-runtime + {{- if .Values.enterprise.enabled }} + - name: license + secret: + {{- if .Values.enterprise.useExternalLicense }} + secretName: {{ .Values.enterprise.externalLicenseName }} + {{- else }} + secretName: enterprise-logs-license + {{- end }} + {{- end }} + {{- with .Values.overridesExporter.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end -}} diff --git a/production/helm/loki/templates/overrides-exporter/poddisruptionbudget-overrides-exporter.yaml b/production/helm/loki/templates/overrides-exporter/poddisruptionbudget-overrides-exporter.yaml new file mode 100644 index 0000000000000..d8be6f4a7f95f --- /dev/null +++ b/production/helm/loki/templates/overrides-exporter/poddisruptionbudget-overrides-exporter.yaml @@ -0,0 +1,21 @@ +{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} +{{- if and $isDistributed .Values.overridesExporter.enabled (gt (int .Values.overridesExporter.replicas) 1) }} +{{- if kindIs "invalid" .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 }} diff --git a/production/helm/loki/templates/overrides-exporter/service-overrides-exporter-headless.yaml b/production/helm/loki/templates/overrides-exporter/service-overrides-exporter-headless.yaml new file mode 100644 index 0000000000000..a645a8e8752b1 --- /dev/null +++ b/production/helm/loki/templates/overrides-exporter/service-overrides-exporter-headless.yaml @@ -0,0 +1,39 @@ +{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} +{{- if and $isDistributed .Values.overridesExporter.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "loki.overridesExporterFullname" . }}-headless + namespace: {{ .Release.Namespace }} + labels: + {{- include "loki.overridesExporterLabels" . | nindent 4 }} + {{- with .Values.overridesExporter.serviceLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} + prometheus.io/service-monitor: "false" + annotations: + {{- with .Values.loki.serviceAnnotations }} + {{- toYaml . | nindent 4}} + {{- end }} + {{- with .Values.overridesExporter.serviceAnnotations }} + {{- toYaml . | nindent 4}} + {{- end }} +spec: + clusterIP: None + type: ClusterIP + publishNotReadyAddresses: true + ports: + - name: http-metrics + port: 3100 + targetPort: http-metrics + protocol: TCP + - name: grpc + port: 9095 + targetPort: grpc + protocol: TCP + {{- if .Values.overridesExporter.appProtocol.grpc }} + appProtocol: {{ .Values.overridesExporter.appProtocol.grpc }} + {{- end }} + selector: + {{- include "loki.overridesExporterSelectorLabels" . | nindent 4 }} +{{- end -}} diff --git a/production/helm/loki/templates/overrides-exporter/service-overrides-exporter.yaml b/production/helm/loki/templates/overrides-exporter/service-overrides-exporter.yaml new file mode 100644 index 0000000000000..847aa2f7a456b --- /dev/null +++ b/production/helm/loki/templates/overrides-exporter/service-overrides-exporter.yaml @@ -0,0 +1,37 @@ +{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} +{{- if and $isDistributed .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 }} + annotations: + {{- with .Values.loki.serviceAnnotations }} + {{- toYaml . | nindent 4}} + {{- end }} + {{- with .Values.overridesExporter.serviceAnnotations }} + {{- toYaml . | nindent 4}} + {{- end }} +spec: + type: ClusterIP + publishNotReadyAddresses: true + ports: + - name: http-metrics + port: 3100 + targetPort: http-metrics + protocol: TCP + - name: grpc + port: 9095 + targetPort: grpc + protocol: TCP + {{- if .Values.overridesExporter.appProtocol.grpc }} + appProtocol: {{ .Values.overridesExporter.appProtocol.grpc }} + {{- end }} + selector: + {{- include "loki.overridesExporterSelectorLabels" . | nindent 4 }} +{{- end -}} From fbf73148fe49ef40d5d6e6156eaa22c6b242e650 Mon Sep 17 00:00:00 2001 From: Aaron Benton Date: Tue, 7 Jan 2025 11:45:51 -0500 Subject: [PATCH 2/3] Updated CHANGELOG --- production/helm/loki/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/production/helm/loki/CHANGELOG.md b/production/helm/loki/CHANGELOG.md index 15dec2f255e80..4771a872b21db 100644 --- a/production/helm/loki/CHANGELOG.md +++ b/production/helm/loki/CHANGELOG.md @@ -13,6 +13,10 @@ Entries should include a reference to the pull request that introduced the chang [//]: # ( : do not remove this line. This locator is used by the CI pipeline to automatically create a changelog entry for each new Loki release. Add other chart versions and respective changelog entries bellow this line.) +## 6.25.0 + +- [FEATURE] Added support for Overrides Exporter + ## 6.24.0 - [BUGFIX] Add conditional to include ruler config only if `ruler.enabled=true` From 8c20a323fdf521503cdeb59f3c679b07427855ff Mon Sep 17 00:00:00 2001 From: Aaron Benton Date: Tue, 7 Jan 2025 14:23:06 -0500 Subject: [PATCH 3/3] Updated Values Descriptions --- production/helm/loki/values.yaml | 70 ++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/production/helm/loki/values.yaml b/production/helm/loki/values.yaml index 2af9e32015888..7b040c94f7765 100644 --- a/production/helm/loki/values.yaml +++ b/production/helm/loki/values.yaml @@ -3016,6 +3016,76 @@ ruler: # - alert: HighThroughputLogStreams # expr: sum by(container) (rate({job=~"loki-dev/.*"}[1m])) > 1000 # for: 2m + +# -- Configuration for the overrides-exporter +overridesExporter: + # -- The overrides-exporter component is optional and can be disabled if desired. + enabled: false + # -- Number of replicas for the overrides-exporter + replicas: 0 + # -- hostAliases to add + hostAliases: [] + # - ip: 1.2.3.4 + # hostnames: + # - domain.tld + image: + # -- The Docker registry for the overrides-exporter image. Overrides `loki.image.registry` + registry: null + # -- Docker image repository for the overrides-exporter image. Overrides `loki.image.repository` + repository: null + # -- Docker image tag for the overrides-exporter image. Overrides `loki.image.tag` + tag: null + # -- Command to execute instead of defined in Docker image + command: null + # -- The name of the PriorityClass for overrides-exporter pods + priorityClassName: null + # -- Labels for overrides-exporter pods + podLabels: {} + # -- Annotations for overrides-exporter pods + podAnnotations: {} + # -- Labels for overrides-exporter service + serviceLabels: {} + # -- Annotations for overrides-exporter service + serviceAnnotations: {} + # -- Additional CLI args for the overrides-exporter + extraArgs: [] + # -- Environment variables to add to the overrides-exporter pods + extraEnv: [] + # -- Environment variables from secrets or configmaps to add to the overrides-exporter pods + extraEnvFrom: [] + # -- Volume mounts to add to the overrides-exporter pods + extraVolumeMounts: [] + # -- Volumes to add to the overrides-exporter pods + extraVolumes: [] + # -- Resource requests and limits for the overrides-exporter + resources: {} + # -- Containers to add to the overrides-exporter pods + extraContainers: [] + # -- Init containers to add to the overrides-exporter pods + initContainers: [] + # -- Grace period to allow the overrides-exporter to shutdown before it is killed + terminationGracePeriodSeconds: 300 + # -- Affinity for overrides-exporter pods. + # @default -- Hard node anti-affinity + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: + app.kubernetes.io/component: overrides-exporter + topologyKey: kubernetes.io/hostname + # -- Pod Disruption Budget maxUnavailable + maxUnavailable: null + # -- Node selector for overrides-exporter pods + nodeSelector: {} + # -- Topology Spread Constraints for overrides-exporter pods + topologySpreadConstraints: [] + # -- Tolerations for overrides-exporter pods + tolerations: [] + # -- Set the optional grpc service protocol. Ex: "grpc", "http2" or "https" + appProtocol: + grpc: "" + memcached: image: # -- Memcached Docker image repository