Skip to content

Commit

Permalink
WIP: Adding beyla config map
Browse files Browse the repository at this point in the history
Signed-off-by: Pete Wall <[email protected]>
  • Loading branch information
petewall committed Oct 31, 2024
1 parent 3637d15 commit 6782311
Show file tree
Hide file tree
Showing 18 changed files with 787 additions and 7 deletions.
6 changes: 2 additions & 4 deletions charts/feature-annotation-autodiscovery/templates/_notes.tpl
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{{- define "feature.annotationAutodiscovery.notes.deployments" }}
* Grafana Beyla (Daemonset)
{{- end }}
{{- define "feature.annotationAutodiscovery.notes.deployments" }}{{- end }}

{{- define "feature.annotationAutodiscovery.notes.task" }}
Automatically instrument applications and services running in the cluster with Grafana Beyla
Scrape metrics from pods and services with the "{{.Values.annotations.scrape}}: true" annotation
{{- end }}

{{- define "feature.annotationAutodiscovery.notes.actions" }}{{- end }}
Expand Down
6 changes: 4 additions & 2 deletions charts/feature-auto-instrumentation/templates/_notes.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{{- define "feature.autoInstrumentation.notes.deployments" }}{{- end }}
{{- define "feature.autoInstrumentation.notes.deployments" }}
* Grafana Beyla (Daemonset)
{{- end }}

{{- define "feature.autoInstrumentation.notes.task" }}
Scrape metrics from pods and services with the "{{.Values.annotations.scrape}}: true" annotation
Automatically instrument applications and services running in the cluster with Grafana Beyla
{{- end }}

{{- define "feature.autoInstrumentation.notes.actions" }}{{- end }}
Expand Down
33 changes: 33 additions & 0 deletions charts/feature-auto-instrumentation/templates/beyla-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{- define "feature.autoInstrumentation.config.beyla" }}
{{- $clusterName := dict "attributes" (dict "kubernetes" (dict "cluster_name" .Values.cluster.name)) }}
{{- $endpoint := dict }}
{{- if .Values.receivers.grpc.enabled }}
{{- $endpoint = dict "otel_traces_export" (dict "endpoint" (include "kubernetes_monitoring.receiver.grpc" . | trim))}}
{{- else if .Values.receivers.http.enabled }}
{{- $endpoint = dict "otel_traces_export" (dict "endpoint" (include "kubernetes_monitoring.receiver.http" . | trim))}}
{{- end }}
{{- $preset := dict }}
{{- if and (eq .Values.beyla.preset "network") (not .Values.beyla.config.data.network) }}
{{- $preset = dict "network" (dict "enable" true)}}
{{- end }}
{{- if and (eq .Values.beyla.preset "application") (not .Values.beyla.config.data.discovery) }}
{{- $preset = dict "discovery" (dict "services" (list (dict "k8s_namespace" ".")))}}
{{- end }}
{{- merge .Values.beyla.config.data $clusterName $endpoint $preset | toYaml }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "beyla.fullname" .Subcharts.beyla }}
namespace: {{ include "beyla.namespace" .Subcharts.beyla }}
labels:
{{- include "beyla.labels" .Subcharts.beyla | nindent 4 }}
app.kubernetes.io/component: config
{{- with .Values.beyla.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
data:
beyla-config.yml: |-
{{- include "feature.autoInstrumentation.config.beyla" . | nindent 4 }}
14 changes: 14 additions & 0 deletions charts/feature-auto-instrumentation/tests/beyla_config_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# yamllint disable rule:document-start rule:line-length rule:trailing-spaces
suite: Test Beyla config values
templates:
- beyla-config.yaml
tests:
- it: creates a ConfigMap for Beyla
set:
deployAsConfigMap: true
asserts:
- isKind:
of: ConfigMap
- equal:
path: data["beyla-config.yml"]
value: ""

Check failure on line 14 in charts/feature-auto-instrumentation/tests/beyla_config_test.yaml

View workflow job for this annotation

GitHub Actions / runner / yamllint

[yamllint] reported by reviewdog 🐶 [error] no new line character at the end of file (new-line-at-end-of-file) Raw Output: ./charts/feature-auto-instrumentation/tests/beyla_config_test.yaml:14:20: [error] no new line character at the end of file (new-line-at-end-of-file)
2 changes: 1 addition & 1 deletion charts/k8s-monitoring/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ dependencies:
repository: https://grafana.github.io/helm-charts
version: 0.9.1
digest: sha256:56dd043a4fdf5eb79550e1e449aad71f4e0cd52eedf5b2d775d69d2a3b5d2191
generated: "2024-10-31T14:21:42.881831-05:00"
generated: "2024-10-31T14:30:07.675908-05:00"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!--
(NOTE: Do not edit README.md directly. It is a generated file!)
( To make changes, please modify values.yaml or description.txt and run `make examples`)
-->
# Example: features/auto-instrumentation/beyla-metrics/values.yaml

## Values

```yaml
---
cluster:
name: annotation-autodiscovery-cluster

destinations:
- name: prometheus
type: prometheus
url: http://prometheus.prometheus.svc:9090/api/v1/write

autoInstrumentation:
enabled: true

alloy-metrics:
enabled: true
```

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6782311

Please sign in to comment.