Skip to content

Commit

Permalink
[stable/node-local-dns] fix: prevent duplicate metrics (#604)
Browse files Browse the repository at this point in the history
fix: prevent duplicate metrics

also adding values documentation to README

Fixes #600
  • Loading branch information
msvticket committed Sep 20, 2024
1 parent 80a4f5e commit b648d8b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 56 deletions.
2 changes: 1 addition & 1 deletion stable/node-local-dns/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: node-local-dns
version: 2.0.14
version: 2.1.0
appVersion: 1.23.1
maintainers:
- name: gabrieladt
Expand Down
49 changes: 22 additions & 27 deletions stable/node-local-dns/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# node-local-dns

![Version: 2.0.14](https://img.shields.io/badge/Version-2.0.14-informational?style=flat-square) ![AppVersion: 1.23.1](https://img.shields.io/badge/AppVersion-1.23.1-informational?style=flat-square)
![Version: 2.1.0](https://img.shields.io/badge/Version-2.1.0-informational?style=flat-square) ![AppVersion: 1.23.1](https://img.shields.io/badge/AppVersion-1.23.1-informational?style=flat-square)

A chart to install node-local-dns.

Expand Down Expand Up @@ -49,31 +49,27 @@ helm install my-release deliveryhero/node-local-dns -f values.yaml
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| config.bindIp | bool | `false` | |
| config.commProtocol | string | `"force_tcp"` | |
| config.customConfig | string | `""` | |
| config.customUpstreamsvc | string | `""` | |
| config.dnsDomain | string | `"cluster.local"` | |
| config.dnsServer | string | `"172.20.0.10"` | |
| config.healthPort | int | `8080` | |
| config.bindIp | bool | `false` | If false, it will bind 0.0.0.0, otherwise dnsServer and localDns will be used. https://github.com/bottlerocket-os/bottlerocket/issues/3711#issuecomment-1907087528 |
| config.commProtocol | string | `"force_tcp"` | Set communication protocol. Options are `prefer_udp` or `force_tcp` |
| config.customConfig | string | `""` | Overrides the generated configuration with specified one. |
| config.customUpstreamsvc | string | `""` | Use a custom upstreamsvc for -upstreamsvc |
| config.dnsDomain | string | `"cluster.local"` | Internal k8s DNS domain |
| config.dnsServer | string | `"172.20.0.10"` | Main coredns service (kube-dns) ip, used on iptables-mode. |
| config.healthPort | int | `8080` | Port used for the health endpoint |
| config.localDns | string | `"169.254.20.25"` | |
| config.noIPv6Lookups | bool | `false` | |
| config.prefetch.amount | int | `3` | |
| config.prefetch.duration | string | `"30s"` | |
| config.prefetch.enabled | bool | `false` | |
| config.prefetch.percentage | string | `"20%"` | |
| config.noIPv6Lookups | bool | `false` | If true, return NOERROR when attempting to resolve an IPv6 address |
| config.prefetch | object | `{"amount":3,"duration":"30s","enabled":false,"percentage":"20%"}` | If enabled, coredns will prefetch popular items when they are about to be expunged from the cache. https://coredns.io/plugins/cache/ |
| config.setupInterface | bool | `true` | |
| config.setupIptables | bool | `true` | |
| config.skipTeardown | bool | `false` | |
| daemonsetAnnotations | object | `{}` | |
| daemonsetLabels | object | `{}` | |
| dashboard.annotations | object | `{}` | |
| dashboard.enabled | bool | `false` | |
| dashboard.label | string | `"grafana_dashboard"` | |
| dashboard.namespace | string | `"kube-system"` | |
| dashboard | object | `{"annotations":{},"enabled":false,"label":"grafana_dashboard","namespace":"kube-system"}` | https://github.com/grafana/helm-charts/blob/main/charts/grafana/README.md |
| dashboard.label | string | `"grafana_dashboard"` | label that grafana sidecar is configured to look for |
| dashboard.namespace | string | `"kube-system"` | namespace where grafana sidecar is configured to look for dashboards. e.g. "monitoring" |
| fullnameOverride | string | `""` | |
| image.repository | string | `"registry.k8s.io/dns/k8s-dns-node-cache"` | |
| image.tag | string | `""` | |
| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. |
| imagePullSecrets | list | `[]` | |
| nameOverride | string | `""` | |
| podAnnotations | object | `{}` | |
Expand All @@ -83,15 +79,14 @@ helm install my-release deliveryhero/node-local-dns -f values.yaml
| resources.requests.cpu | string | `"25m"` | |
| resources.requests.memory | string | `"128Mi"` | |
| securityContext.capabilities.add[0] | string | `"NET_ADMIN"` | |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `""` | |
| serviceMonitor.enabled | bool | `false` | |
| serviceMonitor.honorLabels | bool | `false` | |
| serviceMonitor.labels | object | `{}` | |
| serviceMonitor.metricRelabelings | list | `[]` | |
| serviceMonitor.path | string | `"/metrics"` | |
| serviceMonitor.relabelings | list | `[]` | |
| service.annotations | object | `{}` | Annotations to add to the service. |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account. |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created. |
| serviceAccount.name | string | `""` | If not set and create is true, a name is generated using the fullname template. |
| serviceMonitor | object | `{"enabled":false,"honorLabels":false,"labels":{},"metricRelabelings":[],"path":"/metrics","relabelings":[]}` | https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md |
| serviceMonitor.enabled | bool | `false` | Ensure that servicemonitor is created, this will disable prometheus annotations |
| serviceMonitor.metricRelabelings | list | `[]` | Metric relabel configs to apply to samples before ingestion. [Metric Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs) |
| serviceMonitor.relabelings | list | `[]` | Relabel configs to apply to samples before ingestion. [Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config) |

## Maintainers

Expand Down
7 changes: 2 additions & 5 deletions stable/node-local-dns/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ metadata:
namespace: kube-system
labels:
{{- include "node-local-dns.labels" . | nindent 4 }}

{{- if and (not .Values.serviceMonitor.enabled) .Values.prometheusScraping.enabled }}
annotations:
prometheus.io/port: "9253"
prometheus.io/scrape: "true"
{{- with .Values.service.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
spec:
clusterIP: None
Expand Down
50 changes: 27 additions & 23 deletions stable/node-local-dns/values.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
image:
repository: registry.k8s.io/dns/k8s-dns-node-cache
# Overrides the image tag whose default is the chart appVersion.
# -- Overrides the image tag whose default is the chart appVersion.
tag: ""

config:
# Internal k8s DNS domain
# -- Internal k8s DNS domain
dnsDomain: "cluster.local"

# Main coredns service (kube-dns) ip, used on iptables-mode.
# -- Main coredns service (kube-dns) ip, used on iptables-mode.
dnsServer: "172.20.0.10"

# Virtual IP to be used by ipvs mode, to be used as --cluster-dns, must not collide.
# -- Virtual IP to be used by ipvs mode, to be used as --cluster-dns, must not collide.
localDns: "169.254.20.25"

# Use a custom upstreamsvc for -upstreamsvc
# -- Use a custom upstreamsvc for -upstreamsvc
customUpstreamsvc: ""

# If false, it will bind 0.0.0.0, otherwise dnsServer and localDns will be used. https://github.com/bottlerocket-os/bottlerocket/issues/3711#issuecomment-1907087528
# -- If false, it will bind 0.0.0.0, otherwise dnsServer and localDns will be used. https://github.com/bottlerocket-os/bottlerocket/issues/3711#issuecomment-1907087528
bindIp: false

# Set communication protocol. Options are `prefer_udp` or `force_tcp`
# -- Set communication protocol. Options are `prefer_udp` or `force_tcp`
commProtocol: "force_tcp"

# If true, return NOERROR when attempting to resolve an IPv6 address
# -- If true, return NOERROR when attempting to resolve an IPv6 address
noIPv6Lookups: false

# If enabled, coredns will prefetch popular items when they are about to be expunged from the cache. https://coredns.io/plugins/cache/
# -- If enabled, coredns will prefetch popular items when they are about to be expunged from the cache. https://coredns.io/plugins/cache/
prefetch:
enabled: false
amount: 3
duration: 30s
percentage: 20%

# Port used for the health endpoint
# -- Port used for the health endpoint
healthPort: 8080

setupInterface: true
Expand All @@ -41,21 +41,25 @@ config:

skipTeardown: false

# Overrides the generated configuration with specified one.
# -- Overrides the generated configuration with specified one.
customConfig: ""

nameOverride: ""
fullnameOverride: ""

serviceAccount:
# Specifies whether a service account should be created.
# -- Specifies whether a service account should be created.
create: true
# Annotations to add to the service account.
# -- Annotations to add to the service account.
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template.
# -- The name of the service account to use.
# -- If not set and create is true, a name is generated using the fullname template.
name: ""

service:
# -- Annotations to add to the service.
annotations: {}

podAnnotations: {}

podLabels: {}
Expand All @@ -69,9 +73,9 @@ securityContext:
add:
- NET_ADMIN

# https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md
# -- https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md
serviceMonitor:
# Ensure that servicemonitor is created, this will disable prometheus annotations
# -- Ensure that servicemonitor is created, this will disable prometheus annotations
enabled: false
labels: {}
path: /metrics
Expand All @@ -82,15 +86,15 @@ serviceMonitor:
# Fallback to the prometheus default unless specified
# scrapeTimeout: 30s

# Metric relabel configs to apply to samples before ingestion.
# -- Metric relabel configs to apply to samples before ingestion.
# [Metric Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs)
metricRelabelings: []
# - action: keep
# regex: 'kube_(daemonset|deployment|pod|namespace|node|statefulset).+'
# sourceLabels: [__name__]

## Relabel configs to apply to samples before ingestion.
## [Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config)
# -- Relabel configs to apply to samples before ingestion.
# [Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config)
relabelings: []
# - sourceLabels: [__meta_kubernetes_pod_node_name]
# separator: ;
Expand All @@ -99,12 +103,12 @@ serviceMonitor:
# replacement: $1
# action: replace

# https://github.com/grafana/helm-charts/blob/main/charts/grafana/README.md
# -- https://github.com/grafana/helm-charts/blob/main/charts/grafana/README.md
dashboard:
enabled: false
# namespace where grafana sidecar is configured to look for dashboards. e.g. "monitoring"
# -- namespace where grafana sidecar is configured to look for dashboards. e.g. "monitoring"
namespace: kube-system
# label that grafana sidecar is configured to look for
# -- label that grafana sidecar is configured to look for
label: grafana_dashboard
annotations: {}

Expand Down

0 comments on commit b648d8b

Please sign in to comment.