From 09cf6d8045346b9b0b903aa216893c73bce37152 Mon Sep 17 00:00:00 2001 From: Theo Brigitte Date: Tue, 1 Oct 2024 17:13:07 +0200 Subject: [PATCH 1/7] add PodLogs template --- CHANGELOG.md | 4 ++++ helm/alloy/templates/podlogs.yaml | 11 +++++++++++ helm/alloy/values.yaml | 2 ++ 3 files changed, 17 insertions(+) create mode 100644 helm/alloy/templates/podlogs.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c4f5cc..adaa90f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Add PodLogs as helm chart template. + ## [0.5.2] - 2024-09-17 ### Added diff --git a/helm/alloy/templates/podlogs.yaml b/helm/alloy/templates/podlogs.yaml new file mode 100644 index 0000000..b01ec9d --- /dev/null +++ b/helm/alloy/templates/podlogs.yaml @@ -0,0 +1,11 @@ +{{- range $podLog := .Values.podLogs }} +apiVersion: monitoring.grafana.com/v1alpha2 +kind: PodLogs +metadata: + name: {{ $podLog.name }} + namespace: {{ $podLog.namespace }} + labels: + giantswarm.io/managed-by: logging-operator + spec: +{{- $podLog.spec | toYaml | nindent 4 }} +{{- end }} diff --git a/helm/alloy/values.yaml b/helm/alloy/values.yaml index 7ed5620..2100261 100644 --- a/helm/alloy/values.yaml +++ b/helm/alloy/values.yaml @@ -119,3 +119,5 @@ verticalPodAutoscaler: # -- Specifies whether recommended updates are applied when a Pod is started and whether recommended updates # are applied during the life of a Pod. Possible values are "Off", "Initial", "Recreate", and "Auto". # updateMode: Auto + +podLogs: [] From d48cc0a7a40c73740cacc3200558df204fabdd34 Mon Sep 17 00:00:00 2001 From: Theo Brigitte Date: Tue, 1 Oct 2024 17:20:34 +0200 Subject: [PATCH 2/7] use standard chart labels --- helm/alloy/templates/podlogs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/alloy/templates/podlogs.yaml b/helm/alloy/templates/podlogs.yaml index b01ec9d..de1c62a 100644 --- a/helm/alloy/templates/podlogs.yaml +++ b/helm/alloy/templates/podlogs.yaml @@ -5,7 +5,7 @@ metadata: name: {{ $podLog.name }} namespace: {{ $podLog.namespace }} labels: - giantswarm.io/managed-by: logging-operator + {{- include "alloy.labels" . | nindent 4 }} spec: {{- $podLog.spec | toYaml | nindent 4 }} {{- end }} From 5c1c6cf6fd9242987796dfea3fd3c4f233c2a4a6 Mon Sep 17 00:00:00 2001 From: Theo Brigitte Date: Tue, 1 Oct 2024 18:17:07 +0200 Subject: [PATCH 3/7] fix labels templating error * Error: template: alloy/templates/podlogs.yaml:9:8: executing "alloy/templates/podlogs.yaml" at : error calling include: template: alloy/templates/_helpers.tpl:5:18: executing "alloy.labels" at : error calling include: template: alloy/charts/alloy/templates/_helpers.tpl:30:7: executing "alloy.chart" at : error calling index: index of untyped nil --- helm/alloy/templates/podlogs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/alloy/templates/podlogs.yaml b/helm/alloy/templates/podlogs.yaml index de1c62a..23f8d08 100644 --- a/helm/alloy/templates/podlogs.yaml +++ b/helm/alloy/templates/podlogs.yaml @@ -5,7 +5,7 @@ metadata: name: {{ $podLog.name }} namespace: {{ $podLog.namespace }} labels: - {{- include "alloy.labels" . | nindent 4 }} + {{- include "alloy.labels" $ | nindent 4 }} spec: {{- $podLog.spec | toYaml | nindent 4 }} {{- end }} From 4b81ee29901626dec7bf476920f8657d7350416d Mon Sep 17 00:00:00 2001 From: Theo Brigitte Date: Tue, 1 Oct 2024 18:17:32 +0200 Subject: [PATCH 4/7] fix multi podlogs resources yaml --- helm/alloy/templates/podlogs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/helm/alloy/templates/podlogs.yaml b/helm/alloy/templates/podlogs.yaml index 23f8d08..bb962dd 100644 --- a/helm/alloy/templates/podlogs.yaml +++ b/helm/alloy/templates/podlogs.yaml @@ -1,4 +1,5 @@ {{- range $podLog := .Values.podLogs }} +--- apiVersion: monitoring.grafana.com/v1alpha2 kind: PodLogs metadata: From 240aa62c9080137deb15d94ce5a64723157fa0ed Mon Sep 17 00:00:00 2001 From: Theo Brigitte Date: Tue, 1 Oct 2024 18:17:41 +0200 Subject: [PATCH 5/7] cosmetic indent --- helm/alloy/templates/podlogs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/alloy/templates/podlogs.yaml b/helm/alloy/templates/podlogs.yaml index bb962dd..13ca0e8 100644 --- a/helm/alloy/templates/podlogs.yaml +++ b/helm/alloy/templates/podlogs.yaml @@ -8,5 +8,5 @@ metadata: labels: {{- include "alloy.labels" $ | nindent 4 }} spec: -{{- $podLog.spec | toYaml | nindent 4 }} + {{- $podLog.spec | toYaml | nindent 4 }} {{- end }} From c58d22ed32d1ce13f8639dcb8a5b1f7e0d6d4e60 Mon Sep 17 00:00:00 2001 From: Theo Brigitte Date: Mon, 7 Oct 2024 11:22:11 +0200 Subject: [PATCH 6/7] fix podlogs spec --- helm/alloy/templates/podlogs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/alloy/templates/podlogs.yaml b/helm/alloy/templates/podlogs.yaml index 13ca0e8..308c12e 100644 --- a/helm/alloy/templates/podlogs.yaml +++ b/helm/alloy/templates/podlogs.yaml @@ -7,6 +7,6 @@ metadata: namespace: {{ $podLog.namespace }} labels: {{- include "alloy.labels" $ | nindent 4 }} - spec: - {{- $podLog.spec | toYaml | nindent 4 }} +spec: + {{- $podLog.spec | toYaml | nindent 2 }} {{- end }} From de2c75507d3d5fa2b04d3222f9562fa004499601 Mon Sep 17 00:00:00 2001 From: Theo Brigitte Date: Mon, 7 Oct 2024 17:14:51 +0200 Subject: [PATCH 7/7] comment --- helm/alloy/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/helm/alloy/values.yaml b/helm/alloy/values.yaml index 2100261..1a49c60 100644 --- a/helm/alloy/values.yaml +++ b/helm/alloy/values.yaml @@ -120,4 +120,5 @@ verticalPodAutoscaler: # are applied during the life of a Pod. Possible values are "Off", "Initial", "Recreate", and "Auto". # updateMode: Auto +# Creates PodLogs resources along Alloy podLogs: []