Skip to content

Commit

Permalink
[fluentd-elasticsearch] Issue 86: Configure PrometheusRules to match …
Browse files Browse the repository at this point in the history
…metrics service job name (#87)

* Issue 86: Configure PrometheusRules to match metrics service job name

Signed-off-by: Jared Burns <[email protected]>

* fix ci

Signed-off-by: André Bauer <[email protected]>

* update several github actions

Signed-off-by: André Bauer <[email protected]>

Co-authored-by: André Bauer <[email protected]>
  • Loading branch information
Ghazgkull and monotek authored Aug 13, 2021
1 parent 07e6936 commit 772dbb4
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/kubeval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
set -o errexit
set -o pipefail

CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/main -- zammad | grep '[cC]hart.yaml' | sed -e 's#/[Cc]hart.yaml##g')"
CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/main -- charts | grep '[cC]hart.yaml' | sed -e 's#/[Cc]hart.yaml##g')"
SCHEMA_LOCATION="https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/"

# install kubeval
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'charts/**/**'

env:
helm-version: "v3.6.2"
helm-version: "v3.6.3"
kubeval-version: "v0.16.1"

jobs:
Expand All @@ -33,14 +33,14 @@ jobs:
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v1
uses: azure/setup-helm@v1.1
with:
version: "${{ env.helm-version }}"
- uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.0.1
uses: helm/chart-testing-action@v2.1.0
- name: Run chart-testing (lint)
run: ct lint --config .github/ct.yaml

Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v1
uses: azure/setup-helm@v1.1
with:
version: "${{ env.helm-version }}"
- name: Run kubeval
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v1
uses: azure/setup-helm@v1.1
with:
version: "${{ env.helm-version }}"
- uses: actions/setup-python@v2
Expand All @@ -125,7 +125,7 @@ jobs:
echo "::set-output name=changed::true"
fi
- name: Create kind cluster
uses: helm/kind-action@v1.1.0
uses: helm/kind-action@v1.2.0
if: steps.list-changed.outputs.changed == 'true'
with:
config: .github/kind-config.yaml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

env:
helm-version: "v3.6.2"
helm-version: "v3.6.3"

jobs:
release:
Expand Down
2 changes: 1 addition & 1 deletion charts/fluentd-elasticsearch/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: fluentd-elasticsearch
version: 11.13.0
version: 11.14.0
appVersion: 3.2.0
type: application
home: https://www.fluentd.org/
Expand Down
2 changes: 1 addition & 1 deletion charts/fluentd-elasticsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ The following table lists the configurable parameters of the Fluentd elasticsear
| `serviceMonitor.labels` | Optional labels for serviceMonitor | `{}` |
| `serviceMonitor.metricRelabelings` | Optional metric relabel configs to apply to samples before ingestion | `[]` |
| `serviceMonitor.relabelings` | Optional relabel configs to apply to samples before scraping | `[]` |
| `serviceMonitor.jobLabel` | Label whose value will define the job name | `app.kubernetes.io/instance` |
| `serviceMonitor.jobLabel` | PrometheusRule jobLabel. Uses the created metrics service name if not set. | Not Set |
| `serviceMonitor.type` | Optional the type of the metrics service | `ClusterIP` |
| `tolerations` | Optional daemonset tolerations | `[]` |
| `updateStrategy` | Optional daemonset update strategy | `type: RollingUpdate` |
Expand Down
7 changes: 7 additions & 0 deletions charts/fluentd-elasticsearch/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,10 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create the name of the metrics service
*/}}
{{- define "fluentd-elasticsearch.metricsServiceName" -}}
{{- include "fluentd-elasticsearch.fullname" . }}-metrics
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "fluentd-elasticsearch.fullname" $ }}-metrics
name: {{ include "fluentd-elasticsearch.metricsServiceName" . }}
labels:
{{- include "fluentd-elasticsearch.labels" . | nindent 4 }}
addonmanager.kubernetes.io/mode: Reconcile
Expand Down
9 changes: 4 additions & 5 deletions charts/fluentd-elasticsearch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ serviceMonitor:
labels: {}
metricRelabelings: []
relabelings: []
jobLabel: "app.kubernetes.io/instance"
type: ClusterIP

serviceMetric:
Expand All @@ -301,7 +300,7 @@ prometheusRule:
labels: {}
rules:
- alert: FluentdNodeDown
expr: up{job="{{ include "fluentd-elasticsearch.fullname" . }}"} == 0
expr: up{job="{{ include "fluentd-elasticsearch.metricsServiceName" . }}"} == 0
for: 10m
labels:
service: fluentd
Expand All @@ -310,7 +309,7 @@ prometheusRule:
summary: fluentd cannot be scraped
description: Prometheus could not scrape {{ "{{ $labels.job }}" }} for more than 10 minutes
- alert: FluentdNodeDown
expr: up{job="{{ include "fluentd-elasticsearch.fullname" . }}"} == 0
expr: up{job="{{ include "fluentd-elasticsearch.metricsServiceName" . }}"} == 0
for: 30m
labels:
service: fluentd
Expand Down Expand Up @@ -338,8 +337,8 @@ prometheusRule:
description: In the last 5 minutes, fluentd queues increased 50%. Current value is {{ "{{ $value }}" }}
- alert: FluentdRecordsCountsHigh
expr: >
sum(rate(fluentd_output_status_emit_records{job="{{ tpl .Release.Name . }}"}[5m]))
BY (instance) > (3 * sum(rate(fluentd_output_status_emit_records{job="{{ tpl .Release.Name . }}"}[15m]))
sum(rate(fluentd_output_status_emit_records{job="{{ include "fluentd-elasticsearch.metricsServiceName" . }}"}[5m]))
BY (instance) > (3 * sum(rate(fluentd_output_status_emit_records{job="{{ include "fluentd-elasticsearch.metricsServiceName" . }}"}[15m]))
BY (instance))
for: 1m
labels:
Expand Down

0 comments on commit 772dbb4

Please sign in to comment.