Skip to content

Commit 5849163

Browse files
committed
Grafana Beyla helm chart
1 parent ceb3879 commit 5849163

File tree

11 files changed

+641
-0
lines changed

11 files changed

+641
-0
lines changed

charts/beyla/.helmignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
24+
.github

charts/beyla/Chart.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v2
2+
name: beyla
3+
version: 1.0.0
4+
appVersion: 1.5.0
5+
description: eBPF-based autoinstrumentation HTTP, HTTP2 and gRPC services, as well as network metrics.
6+
home: https://grafana.com/oss/beyla-ebpf/
7+
icon: https://grafana.com/static/img/logos/beyla-logo.svg
8+
sources:
9+
- https://github.com/grafana/beyla
10+
type: application
11+
keywords:
12+
- observability
13+
- autoinstrumentation
14+
- eBPF-based

charts/beyla/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# beyla
2+
3+
![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.5.0](https://img.shields.io/badge/AppVersion-1.5.0-informational?style=flat-square)
4+
5+
eBPF-based autoinstrumentation HTTP, HTTP2 and gRPC services, as well as network metrics.
6+
7+
**Homepage:** <https://grafana.com/oss/beyla-ebpf/>
8+
9+
## Source Code
10+
11+
* <https://github.com/grafana/beyla>
12+
13+
## Values
14+
15+
| Key | Type | Default | Description |
16+
|-----|------|---------|-------------|
17+
| affinity | object | `{}` | used for scheduling of pods based on affinity rules |
18+
| config.create | bool | `true` | set to true, to use the below default configurations |
19+
| config.data | object | `{"attributes":{"kubernetes":{"enable":true}},"prometheus_export":{"path":"/metrics","port":9090}}` | default value of beyla configuration |
20+
| config.name | string | `""` | |
21+
| env | object | `{}` | extra environment variables |
22+
| envValueFrom | object | `{}` | extra environment variables to be set from resources such as k8s configMaps/secrets |
23+
| fullnameOverride | string | `""` | Overrides the chart's computed fullname. |
24+
| global.image.pullSecrets | list | `[]` | Optional set of global image pull secrets. |
25+
| global.image.registry | string | `""` | Global image registry to use if it needs to be overridden for some specific use cases (e.g local registries, custom images, ...) |
26+
| image.digest | string | `nil` | Beyla image's SHA256 digest (either in format "sha256:XYZ" or "XYZ"). When set, will override `image.tag`. |
27+
| image.pullPolicy | string | `"IfNotPresent"` | Beyla image pull policy. |
28+
| image.pullSecrets | list | `[]` | Optional set of image pull secrets. |
29+
| image.registry | string | `"docker.io"` | Beyla image registry (defaults to docker.io) |
30+
| image.repository | string | `"grafana/beyla"` | Beyla image repository. |
31+
| image.tag | string | `nil` | Beyla image tag. When empty, the Chart's appVersion is used. |
32+
| nameOverride | string | `""` | Overrides the chart's name |
33+
| namespaceOverride | string | `""` | Override the deployment namespace |
34+
| nodeSelector | object | `{}` | The nodeSelector field allows user to constrain which nodes your DaemonSet pods are scheduled to based on labels on the node |
35+
| podAnnotations | object | `{}` | Adds custom annotations to the Beyla Pods. |
36+
| podLabels | object | `{}` | Adds custom labels to the Beyla Pods. |
37+
| podSecurityContext | object | `{}` | |
38+
| preset | string | `"application"` | Preconfigures some default properties for network or application observability. Accepted values are "network" or "application". |
39+
| rbac.create | bool | `true` | Whether to create RBAC resources for Belya |
40+
| rbac.extraClusterRoleRules | list | `[]` | Extra custer roles to be created for Belya |
41+
| resources | object | `{}` | |
42+
| securityContext | object | `{}` | |
43+
| service.annotations | object | `{}` | Service annotations. |
44+
| service.appProtocol | string | `""` | Adds the appProtocol field to the service. This allows to work with istio protocol selection. Ex: "http" or "tcp" |
45+
| service.clusterIP | string | `""` | cluster IP |
46+
| service.enabled | bool | `false` | whether to create a service for internal metrics |
47+
| service.labels | object | `{}` | Service labels. |
48+
| service.loadBalancerClass | string | `""` | loadbalancer class name |
49+
| service.loadBalancerIP | string | `""` | loadbalancer IP |
50+
| service.loadBalancerSourceRanges | list | `[]` | source ranges for loadbalancer |
51+
| service.port | int | `80` | service port |
52+
| service.portName | string | `"service"` | name of the port for internal metrics service. |
53+
| service.targetPort | int | `9090` | targetPort has to be configured based on the values of `BEYLA_INTERNAL_METRICS_PROMETHEUS_PORT` environment variable or the value of `prometheus_export.port` from beyla configuration file. see more at https://grafana.com/docs/beyla/latest/configure/options/#internal-metrics-reporter |
54+
| service.type | string | `"ClusterIP"` | type of the service |
55+
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
56+
| serviceAccount.automount | bool | `true` | Automatically mount a ServiceAccount's API credentials? |
57+
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
58+
| serviceAccount.labels | object | `{}` | ServiceAccount labels. |
59+
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
60+
| tolerations | list | `[]` | Tolerations allow pods to be scheduled on nodes with specific taints |
61+
| updateStrategy.type | string | `"RollingUpdate"` | update strategy type |
62+
| volumeMounts | list | `[]` | Additional volumeMounts on the output Deployment definition. |
63+
| volumes | list | `[]` | Additional volumes on the output daemonset definition. |
64+

charts/beyla/templates/_helpers.tpl

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "beyla.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "beyla.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
28+
*/}}
29+
{{- define "beyla.namespace" -}}
30+
{{- if .Values.namespaceOverride }}
31+
{{- .Values.namespaceOverride }}
32+
{{- else }}
33+
{{- .Release.Namespace }}
34+
{{- end }}
35+
{{- end }}
36+
37+
38+
{{/*
39+
Create chart name and version as used by the chart label.
40+
*/}}
41+
{{- define "beyla.chart" -}}
42+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
43+
{{- end }}
44+
45+
{{/*
46+
Common labels
47+
*/}}
48+
{{- define "beyla.labels" -}}
49+
helm.sh/chart: {{ include "beyla.chart" . }}
50+
{{ include "beyla.selectorLabels" . }}
51+
{{- if .Chart.AppVersion }}
52+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
53+
{{- end }}
54+
app.kubernetes.io/managed-by: {{ .Release.Service }}
55+
{{- end }}
56+
57+
{{/*
58+
Selector (pod) labels
59+
*/}}
60+
{{- define "beyla.selectorLabels" -}}
61+
app.kubernetes.io/name: {{ include "beyla.name" . }}
62+
app.kubernetes.io/instance: {{ .Release.Name }}
63+
{{- with .Values.podLabels }}
64+
{{ toYaml . }}
65+
{{- end }}
66+
{{- end }}
67+
68+
{{/*
69+
Create the name of the service account to use
70+
*/}}
71+
{{- define "beyla.serviceAccountName" -}}
72+
{{- if .Values.serviceAccount.create }}
73+
{{- default (include "beyla.fullname" .) .Values.serviceAccount.name }}
74+
{{- else }}
75+
{{- default "default" .Values.serviceAccount.name }}
76+
{{- end }}
77+
{{- end }}
78+
79+
80+
{{/*
81+
Calculate name of image ID to use for "beyla".
82+
*/}}
83+
{{- define "beyla.imageId" -}}
84+
{{- if .Values.image.digest }}
85+
{{- $digest := .Values.image.digest }}
86+
{{- if not (hasPrefix "sha256:" $digest) }}
87+
{{- $digest = printf "sha256:%s" $digest }}
88+
{{- end }}
89+
{{- printf "@%s" $digest }}
90+
{{- else if .Values.image.tag }}
91+
{{- printf ":%s" .Values.image.tag }}
92+
{{- else }}
93+
{{- printf ":%s" .Chart.AppVersion }}
94+
{{- end }}
95+
{{- end }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{{- if .Values.rbac.create }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRoleBinding
4+
metadata:
5+
name: {{ include "beyla.fullname" . }}
6+
labels:
7+
{{- include "beyla.labels" . | nindent 4 }}
8+
{{- with .Values.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
subjects:
13+
- kind: ServiceAccount
14+
name: {{ include "beyla.serviceAccountName" . }}
15+
namespace: {{ include "beyla.namespace" .}}
16+
roleRef:
17+
apiGroup: rbac.authorization.k8s.io
18+
kind: ClusterRole
19+
name: {{ include "beyla.fullname" . }}
20+
{{- end }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{- if .Values.rbac.create }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: {{ include "beyla.fullname" . }}
6+
labels:
7+
{{- include "beyla.labels" . | nindent 4 }}
8+
{{- with .Values.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
rules:
13+
- apiGroups: [ "apps" ]
14+
resources: [ "replicasets" ]
15+
verbs: [ "list", "watch" ]
16+
- apiGroups: [ "" ]
17+
{{- if eq .Values.preset "network" }}
18+
resources: [ "pods", "services", "nodes" ]
19+
{{- else }}
20+
resources: [ "pods" ]
21+
{{- end }}
22+
verbs: [ "list", "watch" ]
23+
{{- with .Values.rbac.extraClusterRoleRules }}
24+
{{- toYaml . | nindent 2 }}
25+
{{- end}}
26+
{{- end }}

charts/beyla/templates/configmap.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{- if and (not .Values.config.create) (eq .Values.config.name "") }}
2+
{{- fail "if .Values.config.name is not set, then .Values.config.create should be set to true to use default configuration" }}
3+
{{- end }}
4+
{{- if and (.Values.config.create) (eq .Values.config.name "") }}
5+
apiVersion: v1
6+
kind: ConfigMap
7+
metadata:
8+
name: {{ include "beyla.fullname" . }}
9+
namespace: {{ include "beyla.namespace" . }}
10+
labels:
11+
{{- include "beyla.labels" . | nindent 4 }}
12+
{{- with .Values.annotations }}
13+
annotations:
14+
{{- toYaml . | nindent 4 }}
15+
{{- end }}
16+
data:
17+
beyla-config.yml: |
18+
{{- if eq .Values.preset "network" }}
19+
{{- if not .Values.config.data.network }}
20+
network:
21+
enable: true
22+
{{- end }}
23+
{{- end }}
24+
{{- if eq .Values.preset "application" }}
25+
{{- if not .Values.config.data.discovery }}
26+
discovery:
27+
services:
28+
- k8s_namespace: .
29+
{{- end }}
30+
{{- end }}
31+
{{- toYaml .Values.config.data | nindent 4}}
32+
{{- end }}

charts/beyla/templates/daemon-set.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: {{ include "beyla.fullname" . }}
5+
namespace: {{ include "beyla.namespace" .}}
6+
labels:
7+
{{- include "beyla.labels" . | nindent 4 }}
8+
{{- with .Values.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
spec:
13+
selector:
14+
matchLabels:
15+
{{ include "beyla.selectorLabels" . | indent 6 }}
16+
{{- with .Values.updateStrategy }}
17+
updateStrategy:
18+
{{- toYaml . | trim | nindent 4 }}
19+
{{- end }}
20+
template:
21+
metadata:
22+
annotations:
23+
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
24+
{{- with .Values.podAnnotations }}
25+
{{- toYaml . | nindent 8 }}
26+
{{- end }}
27+
labels:
28+
{{ include "beyla.selectorLabels" . | indent 8 }}
29+
spec:
30+
{{- if .Values.serviceAccount.create }}
31+
serviceAccountName: {{ include "beyla.serviceAccountName" . }}
32+
{{- end }}
33+
{{- if eq .Values.preset "application" }}
34+
hostPID: true
35+
{{- end }}
36+
{{- if eq .Values.preset "network" }}
37+
hostNetwork: true
38+
{{- end }}
39+
containers:
40+
- name: beyla
41+
image: {{ .Values.global.image.registry | default .Values.image.registry }}/{{ .Values.image.repository }}{{ include "beyla.imageId" . }}
42+
imagePullPolicy: {{ .Values.image.pullPolicy }}
43+
securityContext:
44+
privileged: true
45+
ports:
46+
- containerPort: {{ .Values.service.targetPort }}
47+
protocol: TCP
48+
env:
49+
- name: BEYLA_CONFIG_PATH
50+
value: "/etc/beyla/config/beyla-config.yml"
51+
{{- range $key, $value := .Values.env }}
52+
- name: {{ $key }}
53+
value: "{{ $value }}"
54+
{{- end }}
55+
{{- range $key, $value := .Values.envValueFrom }}
56+
- name: {{ $key | quote }}
57+
valueFrom:
58+
{{- tpl (toYaml $value) $ | nindent 16 }}
59+
{{- end }}
60+
{{- with .Values.nodeSelector }}
61+
nodeSelector:
62+
{{- toYaml . | nindent 12 }}
63+
{{- end }}
64+
{{- with .Values.affinity }}
65+
affinity:
66+
{{- tpl (toYaml .) $ | nindent 12 }}
67+
{{- end }}
68+
{{- with .Values.tolerations }}
69+
tolerations:
70+
{{- toYaml . | nindent 12 }}
71+
{{- end }}
72+
volumeMounts:
73+
- mountPath: /etc/beyla/config
74+
name: beyla-config
75+
{{- if or .Values.global.image.pullSecrets .Values.image.pullSecrets }}
76+
imagePullSecrets:
77+
{{- if .Values.global.image.pullSecrets }}
78+
{{- toYaml .Values.global.image.pullSecrets | nindent 4 }}
79+
{{- else }}
80+
{{- toYaml .Values.image.pullSecrets | nindent 4 }}
81+
{{- end }}
82+
{{- end }}
83+
volumes:
84+
- name: beyla-config
85+
configMap:
86+
name: {{ default (include "beyla.fullname" .) .Values.config.name }}

0 commit comments

Comments
 (0)