Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pr: [beyla] Init of the Grafana Beyla helm chart #3101 #3102

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions charts/beyla/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
28 changes: 28 additions & 0 deletions charts/beyla/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: v2
name: beyla
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.5.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.5.2"

maintainers:
- name: "Vitaly Fedorov"
email: "obsessionsys@gmail.com"
50 changes: 50 additions & 0 deletions charts/beyla/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# grafana-beyla

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

A Helm chart for Kubernetes

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| Vitaly Fedorov | <obsessionsys@gmail.com> | |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Affinity for pod assignment. See: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity |
| annotations | object | `{}` | General annotation for the daemonset |
| config | string | Dynamically generated beyla configmap | Beyla configuration file contents |
| extraEnvs | list | `[]` | Extra environment variables to add |
| fullnameOverride | string | `""` | Overrides the chart's computed fullname |
| hostAliases | list | `[]` | hostAliases to add |
| hostPID | bool | `true` | Mandatory for eBPF probes |
| image.pullPolicy | string | `"IfNotPresent"` | pullPolicy to use for pulling the image |
| image.repository | string | `"grafana/beyla"` | Repository to pull from |
| image.tag | string | `""` | |
| imagePullSecrets | list | `[]` | |
| nameOverride | string | `""` | Overrides the chart's name |
| nodeSelector | object | `{}` | Node labels for pod assignment. See: https://kubernetes.io/docs/user-guide/node-selection/ |
| otlp.endpoint | string | `"http://localhost"` | For correct operation, this endpoint must be installed and point to the opentelemtry collector service or ingress |
| otlp.headers | object | `{}` | Headers for OTLP Collector Example: Authorization=Basic ...rest of the secret header value... |
| otlp.insecure | bool | `false` | |
| otlp.protocol | string | `nil` | Protocol OTLP Collector (http or grpc) |
| podAnnotations | object | `{}` | Pod Annotations |
| podLabels | object | `{}` | Pod (extra) Labels |
| podSecurityContext | object | `{}` | podSecurityContext |
| resources | object | `{}` | |
| securityContext.privileged | bool | `true` | Defaults to privileged = true |
| securityContext.readOnlyRootFilesystem | bool | `true` | |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.automount | bool | `true` | Automatically mount a ServiceAccount's API credentials? |
| 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 |
| terminationMessagePolicy | string | `nil` | See https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/ |
| tolerations | list | `[]` | Tolerations for pod assignment. See: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ |
| volumeMounts | list | `[]` | Additional volumeMounts on the output Deployment definition. |
| volumes | list | `[]` | Additional volumes on the output Deployment definition. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.8.1](https://github.com/norwoodj/helm-docs/releases/v1.8.1)
62 changes: 62 additions & 0 deletions charts/beyla/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "chart.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "chart.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "chart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "chart.labels" -}}
helm.sh/chart: {{ include "chart.chart" . }}
{{ include "chart.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "chart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "chart.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "chart.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
17 changes: 17 additions & 0 deletions charts/beyla/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- $fullName := include "chart.fullname" . -}}
{{- $name := "beyla" -}}
{{- $data := dict "name" $name "Chart" .Chart "Release" .Release "Values" .Values -}}
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ .Release.Namespace }}
name: {{ $fullName }}-{{ $name }}-config
labels:
{{- include "chart.labels" $data | nindent 4 }}
annotations:
{{- if .Values.annotations }}
{{- toYaml .Values.annotations | nindent 4 }}
{{- end }}
data:
beyla-config.yml: |
{{- .Values.config | nindent 6 }}
93 changes: 93 additions & 0 deletions charts/beyla/templates/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{{- $fullName := include "chart.fullname" . -}}
{{- $serviceAccountName := include "chart.serviceAccountName" . -}}
{{- $name := "beyla" -}}
{{- $data := dict "name" $name "Chart" .Chart "Release" .Release "Values" .Values -}}
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
namespace: {{ .Release.Namespace }}
name: {{ $fullName }}-{{ $name }}
labels:
{{- include "chart.labels" $data | nindent 4 }}
{{- if .Values.podAnnotations -}}
annotations:
{{- toYaml .Values.podAnnotations | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "chart.selectorLabels" $data | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations -}}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "chart.selectorLabels" $data | nindent 8 }}
spec:
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.hostAliases }}
hostAliases:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "chart.serviceAccountName" . }}
hostPID: {{ .Values.hostPID }}
containers:
- name: beyla
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.terminationMessagePolicy }}
terminationMessagePolicy: {{ .Values.terminationMessagePolicy }}
{{- end }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
volumeMounts:
- mountPath: /config
name: beyla-config
- mountPath: /var/run/beyla
name: var-run-beyla
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
env:
- name: BEYLA_CONFIG_PATH
value: "/config/beyla-config.yml"
- name: OTEL_EXPORTER_OTLP_ENDPOINT
valueFrom:
secretKeyRef:
name: {{ $fullName }}-{{ $name }}-credentials
key: otlp-endpoint
{{- if .Values.otlp.headers }}
- name: OTEL_EXPORTER_OTLP_HEADERS
valueFrom:
secretKeyRef:
name: {{ $fullName }}-{{ $name }}-credentials
key: otlp-headers
{{- end }}
{{- if .Values.extraEnvs -}}
{{- toYaml .Values.extraEnvs | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: beyla-config
configMap:
name: {{ $fullName }}-{{ $name }}-config
- name: var-run-beyla
emptyDir: {}
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
30 changes: 30 additions & 0 deletions charts/beyla/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- $fullName := include "chart.fullname" . -}}
{{- $serviceAccountName := include "chart.serviceAccountName" . -}}
{{- $name := "beyla" -}}
{{- $data := dict "name" $name "Chart" .Chart "Release" .Release "Values" .Values -}}
{{- if .Values.serviceAccount.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ $fullName }}-{{ $name }}-role
rules:
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["list", "watch"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ $fullName }}-{{ $name }}-role-binding
subjects:
- kind: ServiceAccount
name: {{ $serviceAccountName }}
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ $fullName }}-{{ $name }}-role
{{- end }}
26 changes: 26 additions & 0 deletions charts/beyla/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- $fullName := include "chart.fullname" . -}}
{{- $name := "beyla" -}}
{{- $data := dict "name" $name "Chart" .Chart "Release" .Release "Values" .Values -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ $fullName }}-{{ $name }}-credentials
namespace: {{ .Release.Namespace }}
labels:
{{- include "chart.labels" $data | nindent 4 }}
annotations:
{{- if .Values.annotations }}
{{- toYaml .Values.annotations | nindent 4 }}
{{- end }}
type: Opaque
stringData:
otlp-endpoint: {{ .Values.otlp.endpoint | quote }}
{{- if .Values.otlp.protocol -}}
otlp-protocol: {{ .Values.otlp.protocol | quote }}
{{- end }}
{{- if .Values.otlp.insecure -}}
otlp-insecure: "true"
{{- end }}
{{- if .Values.otlp.headers -}}
otlp-headers: {{ .Values.otlp.headers | quote }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/beyla/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- $serviceAccountName := include "chart.serviceAccountName" . -}}
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ $serviceAccountName }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "chart.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}
5 changes: 5 additions & 0 deletions charts/beyla/templates/warnings.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{/* this file is for generating warnings about incorrect usage of the chart */}}

{{- if not .Values.otlp.endpoint }}
{{ fail ".Values.otlp.endpoint must be set" }}
{{- end }}