Skip to content

Commit

Permalink
Helm: Add support for dnsmasq (#11013)
Browse files Browse the repository at this point in the history
**What this PR does / why we need it**:
When a dns in k8s is rebooted, nginx will not notice this. Resulting in
failing dnslookups and failing writes to the write pods. A more in depth
explanation is written here:
https://gist.github.com/joemiller/68ab3f7a7a08e4a9d5ad5d023cb14fc2
It's already fixed in the loki-distributed helm charts
grafana/helm-charts#1272

This pr simply ports the necessary fixes to the loki helm chart.

**Which issue(s) this PR fixes**:
Fixes none I could find

**Special notes for your reviewer**:

**Checklist**
- [x] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)
- [x] Documentation added
- [ ] Tests updated
- [x] `CHANGELOG.md` updated
- [ ] If the change is worth mentioning in the release notes, add
`add-to-release-notes` label
- [ ] Changes that require user attention or interaction to upgrade are
documented in `docs/sources/setup/upgrade/_index.md`
- [x] For Helm chart changes bump the Helm chart version in
`production/helm/loki/Chart.yaml` and update
`production/helm/loki/CHANGELOG.md` and
`production/helm/loki/README.md`. [Example
PR](d10549e)
- [ ] If the change is deprecating or removing a configuration option,
update the `deprecated-config.yaml` and `deleted-config.yaml` files
respectively in the `tools/deprecated-config-checker` directory. <!--
TODO(salvacorts): Add example PR -->

---------

Signed-off-by: Yannick te Kulve <[email protected]>
Co-authored-by: J Stickler <[email protected]>
Co-authored-by: Michel Hollands <[email protected]>
  • Loading branch information
3 people authored Nov 3, 2023
1 parent c6ddd70 commit c31668e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 4 deletions.
18 changes: 18 additions & 0 deletions docs/sources/setup/install/helm/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,15 @@ true
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
<td>gateway.extraContainers</td>
<td>list</td>
<td>Containers to add to the gateway pods</td>
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -1260,6 +1269,15 @@ See values.yaml
<td><pre lang="json">
"main '$remote_addr - $remote_user [$time_local] $status '\n '\"$request\" $body_bytes_sent \"$http_referer\" '\n '\"$http_user_agent\" \"$http_x_forwarded_for\"';"
</pre>
</td>
</tr>
<tr>
<td>gateway.nginxConfig.resolver</td>
<td>string</td>
<td>Allows overriding the DNS resolver address nginx will use.</td>
<td><pre lang="json">
""
</pre>
</td>
</tr>
<tr>
Expand Down
6 changes: 4 additions & 2 deletions production/helm/loki/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ Entries should include a reference to the pull request that introduced the chang

[//]: # (<AUTOMATED_UPDATES_LOCATOR> : 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.)

## 5.36.2

- [BUGFIX] Add support to run dnsmasq

## 5.36.1

- [FEATURE] Allow topology spread constraints for Loki


## 5.36.0

- [CHANGE] Changed version of Loki to 2.9.2


## 5.35.0

- [FEATURE] Add support for configuring distributor.
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: loki
description: Helm chart for Grafana Loki in simple, scalable mode
type: application
appVersion: 2.9.2
version: 5.36.1
version: 5.36.2
home: https://grafana.github.io/helm-charts
sources:
- https://github.com/grafana/loki
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# loki

![Version: 5.36.1](https://img.shields.io/badge/Version-5.36.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.9.2](https://img.shields.io/badge/AppVersion-2.9.2-informational?style=flat-square)
![Version: 5.36.2](https://img.shields.io/badge/Version-5.36.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.9.2](https://img.shields.io/badge/AppVersion-2.9.2-informational?style=flat-square)

Helm chart for Grafana Loki in simple, scalable mode

Expand Down
4 changes: 4 additions & 0 deletions production/helm/loki/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,11 @@ http {

sendfile on;
tcp_nopush on;
{{- if .Values.gateway.nginxConfig.resolver }}
resolver {{ .Values.gateway.nginxConfig.resolver }};
{{- else }}
resolver {{ .Values.global.dnsService }}.{{ .Values.global.dnsNamespace }}.svc.{{ .Values.global.clusterDomain }}.;
{{- end }}

{{- with .Values.gateway.nginxConfig.httpSnippet }}
{{- tpl . $ | nindent 2 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ spec:
{{- end }}
resources:
{{- toYaml .Values.gateway.resources | nindent 12 }}
{{- if .Values.gateway.extraContainers }}
{{- toYaml .Values.gateway.extraContainers | nindent 8}}
{{- end }}
{{- with .Values.gateway.affinity }}
affinity:
{{- tpl . $ | nindent 8 }}
Expand Down
4 changes: 4 additions & 0 deletions production/helm/loki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,8 @@ gateway:
allowPrivilegeEscalation: false
# -- Resource requests and limits for the gateway
resources: {}
# -- Containers to add to the gateway pods
extraContainers: []
# -- Grace period to allow the gateway to shutdown before it is killed
terminationGracePeriodSeconds: 30
# -- Affinity for gateway pods. Passed through `tpl` and, thus, to be configured as string
Expand Down Expand Up @@ -1427,6 +1429,8 @@ gateway:
customWriteUrl: null
# -- Override Backend URL
customBackendUrl: null
# -- Allows overriding the DNS resolver address nginx will use.
resolver: ""
# -- Config file contents for Nginx. Passed through the `tpl` function to allow templating
# @default -- See values.yaml
file: |
Expand Down

0 comments on commit c31668e

Please sign in to comment.