-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(helm): change how the configMap for the gateway is generated #14575
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this results in a change to the rendered configmap (see the results of the diff CI job), any idea why that's the case? On it's surface it looks like this is a backwards compatible change, so I'm fine with it as long as we can explain that difference in the rendered manifests.
Hi @trevorwhitney file: |-
# My comment
worker_processes 5; ## Default: 1
error_log /dev/stderr;
pid /tmp/nginx.pid;
worker_rlimit_nofile 8192; Since my first line here is a comment I can illustrate what is happening since the comment is valid code in both yaml and in the configmap: With indent 4: data:
nginx.conf: | # My comment
worker_processes 5; ## Default: 1
error_log /dev/stderr;
pid /tmp/nginx.pid;
worker_rlimit_nofile 8192; You can see that the comment is added to the same line as the nginx.conf: | in the ConfigMap When using nindent 4: data:
nginx.conf: |
# My comment
worker_processes 5; ## Default: 1
error_log /dev/stderr;
pid /tmp/nginx.pid;
worker_rlimit_nofile 8192; If the first line in the configuration is not a #comment this will error out when using indent 4 when using custom file configuration as above. Error: YAML parse error on loki/templates/gateway/configmap-gateway.yaml: error converting YAML to JSON: yaml: line 14: did not find expected comment or line break I hope this explains it well enough :) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Kubernetes Manifest Diff SummaryScenario: default-single-binary-values (Added: 0, Modified: 2, Removed: 0)
Summary:
Added FilesNo added files Modified Filesloki/templates/gateway/configmap-gateway.yaml*** /home/runner/work/loki/loki/output/base/default-single-binary-values/loki/templates/gateway/configmap-gateway.yaml 2024-11-07 06:41:05.625939515 +0000
--- /home/runner/work/loki/loki/output/pr/default-single-binary-values/loki/templates/gateway/configmap-gateway.yaml 2024-11-07 06:41:08.421931952 +0000
***************
*** 13,19 ****
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: gateway
data:
! nginx.conf: |
worker_processes 5; ## Default: 1
error_log /dev/stderr;
pid /tmp/nginx.pid;
--- 13,20 ----
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: gateway
data:
! nginx.conf: |
!
worker_processes 5; ## Default: 1
error_log /dev/stderr;
pid /tmp/nginx.pid; loki/templates/gateway/deployment-gateway-nginx.yaml*** /home/runner/work/loki/loki/output/base/default-single-binary-values/loki/templates/gateway/deployment-gateway-nginx.yaml 2024-11-07 06:41:05.629939503 +0000
--- /home/runner/work/loki/loki/output/pr/default-single-binary-values/loki/templates/gateway/deployment-gateway-nginx.yaml 2024-11-07 06:41:08.421931952 +0000
***************
*** 25,31 ****
template:
metadata:
annotations:
! checksum/config: 3dbb80416c97a064cb67bdff77651e9aaf2147a4203dcf817a86a4281ae529a7
labels:
app.kubernetes.io/name: loki
app.kubernetes.io/instance: loki-test-chart-name
--- 25,31 ----
template:
metadata:
annotations:
! checksum/config: 5c6a0c0f55c1f1f53bcf5b8e2b17153d536bed0b09bb1d66d31d2fbf664a021c
labels:
app.kubernetes.io/name: loki
app.kubernetes.io/instance: loki-test-chart-name Removed FilesNo removed files Scenario: default-values (Added: 0, Modified: 2, Removed: 0)
Summary:
Added FilesNo added files Modified Filesloki/templates/gateway/configmap-gateway.yaml*** /home/runner/work/loki/loki/output/base/default-values/loki/templates/gateway/configmap-gateway.yaml 2024-11-07 06:41:05.721939255 +0000
--- /home/runner/work/loki/loki/output/pr/default-values/loki/templates/gateway/configmap-gateway.yaml 2024-11-07 06:41:08.517931693 +0000
***************
*** 13,19 ****
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: gateway
data:
! nginx.conf: |
worker_processes 5; ## Default: 1
error_log /dev/stderr;
pid /tmp/nginx.pid;
--- 13,20 ----
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: gateway
data:
! nginx.conf: |
!
worker_processes 5; ## Default: 1
error_log /dev/stderr;
pid /tmp/nginx.pid; loki/templates/gateway/deployment-gateway-nginx.yaml*** /home/runner/work/loki/loki/output/base/default-values/loki/templates/gateway/deployment-gateway-nginx.yaml 2024-11-07 06:41:05.721939255 +0000
--- /home/runner/work/loki/loki/output/pr/default-values/loki/templates/gateway/deployment-gateway-nginx.yaml 2024-11-07 06:41:08.517931693 +0000
***************
*** 25,31 ****
template:
metadata:
annotations:
! checksum/config: b42ca6b4a926bc67707b4bb02223e29e6a691983ba80c3efb237f4f6b060bc8f
labels:
app.kubernetes.io/name: loki
app.kubernetes.io/instance: loki-test-chart-name
--- 25,31 ----
template:
metadata:
annotations:
! checksum/config: 1faa240238fd567bea695d863b1e3cf66c931ab208e27b08774e77449a774deb
labels:
app.kubernetes.io/name: loki
app.kubernetes.io/instance: loki-test-chart-name Removed FilesNo removed files Scenario: ingress-values (Added: 0, Modified: 2, Removed: 0)
Summary:
Added FilesNo added files Modified Filesloki/templates/gateway/configmap-gateway.yaml*** /home/runner/work/loki/loki/output/base/ingress-values/loki/templates/gateway/configmap-gateway.yaml 2024-11-07 06:41:05.817938995 +0000
--- /home/runner/work/loki/loki/output/pr/ingress-values/loki/templates/gateway/configmap-gateway.yaml 2024-11-07 06:41:08.613931433 +0000
***************
*** 13,19 ****
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: gateway
data:
! nginx.conf: |
worker_processes 5; ## Default: 1
error_log /dev/stderr;
pid /tmp/nginx.pid;
--- 13,20 ----
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: gateway
data:
! nginx.conf: |
!
worker_processes 5; ## Default: 1
error_log /dev/stderr;
pid /tmp/nginx.pid; loki/templates/gateway/deployment-gateway-nginx.yaml*** /home/runner/work/loki/loki/output/base/ingress-values/loki/templates/gateway/deployment-gateway-nginx.yaml 2024-11-07 06:41:05.821938985 +0000
--- /home/runner/work/loki/loki/output/pr/ingress-values/loki/templates/gateway/deployment-gateway-nginx.yaml 2024-11-07 06:41:08.613931433 +0000
***************
*** 25,31 ****
template:
metadata:
annotations:
! checksum/config: b42ca6b4a926bc67707b4bb02223e29e6a691983ba80c3efb237f4f6b060bc8f
labels:
app.kubernetes.io/name: loki
app.kubernetes.io/instance: loki-test-chart-name
--- 25,31 ----
template:
metadata:
annotations:
! checksum/config: 1faa240238fd567bea695d863b1e3cf66c931ab208e27b08774e77449a774deb
labels:
app.kubernetes.io/name: loki
app.kubernetes.io/instance: loki-test-chart-name Removed FilesNo removed files Scenario: legacy-monitoring-values (Added: 0, Modified: 2, Removed: 0)
Summary:
Added FilesNo added files Modified Filesloki/templates/gateway/configmap-gateway.yaml*** /home/runner/work/loki/loki/output/base/legacy-monitoring-values/loki/templates/gateway/configmap-gateway.yaml 2024-11-07 06:41:05.921938714 +0000
--- /home/runner/work/loki/loki/output/pr/legacy-monitoring-values/loki/templates/gateway/configmap-gateway.yaml 2024-11-07 06:41:08.717931152 +0000
***************
*** 13,19 ****
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: gateway
data:
! nginx.conf: |
worker_processes 5; ## Default: 1
error_log /dev/stderr;
pid /tmp/nginx.pid;
--- 13,20 ----
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: gateway
data:
! nginx.conf: |
!
worker_processes 5; ## Default: 1
error_log /dev/stderr;
pid /tmp/nginx.pid; loki/templates/gateway/deployment-gateway-nginx.yaml*** /home/runner/work/loki/loki/output/base/legacy-monitoring-values/loki/templates/gateway/deployment-gateway-nginx.yaml 2024-11-07 06:41:05.925938703 +0000
--- /home/runner/work/loki/loki/output/pr/legacy-monitoring-values/loki/templates/gateway/deployment-gateway-nginx.yaml 2024-11-07 06:41:08.717931152 +0000
***************
*** 25,31 ****
template:
metadata:
annotations:
! checksum/config: b42ca6b4a926bc67707b4bb02223e29e6a691983ba80c3efb237f4f6b060bc8f
labels:
app.kubernetes.io/name: loki
app.kubernetes.io/instance: loki-test-chart-name
--- 25,31 ----
template:
metadata:
annotations:
! checksum/config: 1faa240238fd567bea695d863b1e3cf66c931ab208e27b08774e77449a774deb
labels:
app.kubernetes.io/name: loki
app.kubernetes.io/instance: loki-test-chart-name Removed FilesNo removed files Scenario: simple-scalable-aws-kube-irsa-values (Added: 0, Modified: 0, Removed: 0)
Summary:
Added FilesNo added files Modified FilesNo modified files Removed FilesNo removed files |
What this PR does / why we need it:
This PR updates the helm template file for [configmap-gateway.yaml] and the default values.yaml file
When you try to change the default configuration of:
The helm template errors out with the following error:
Error: YAML parse error on loki/templates/gateway/configmap-gateway.yaml: error converting YAML to JSON: yaml: line 14: did not find expected comment or line break
It has been tested to do the extra configuration in several way like:
But it all keeps errors out.
With this update we have tested the following scenarios with code snippets for the GW deployment:
Scenario 1:
The user uses the default helm values
Scenario 2
The user has as bad practice copied the entire default values to their configuration using the old values file default config:
Scenario 3
The user has their own customized nginx configuration
Note: The loki-distributed helm chart uses the same approach for the template of the gateway configmap:
https://github.com/grafana/helm-charts/blob/main/charts/loki-distributed/templates/gateway/configmap-gateway.yaml#L10
Which issue(s) this PR fixes:
Fixes #
N/A
Special notes for your reviewer:
Checklist
CONTRIBUTING.md
guide (required)feat
PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.docs/sources/setup/upgrade/_index.md
(N/A)deprecated-config.yaml
anddeleted-config.yaml
files respectively in thetools/deprecated-config-checker
directory. Example PR