Skip to content

Commit

Permalink
Beyla: new chart (#675)
Browse files Browse the repository at this point in the history
* feat(beyla): new chart
---------

Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
  • Loading branch information
nlamirault committed Jan 22, 2024
1 parent 2ec407a commit 795df16
Show file tree
Hide file tree
Showing 11 changed files with 434 additions and 0 deletions.
34 changes: 34 additions & 0 deletions charts/beyla/Chart.yaml
@@ -0,0 +1,34 @@
---
apiVersion: v2
description: Beyla
name: beyla
version: 0.1.0
appVersion: 1.2.0
home: https://github.com/grafana/beyla
sources:
- https://github.com/grafana/beyla
keywords:
- grafana
- beyla
- ebpf

maintainers:
- name: nlamirault
email: nicolas.lamirault@gmail.com
url: https://github.com/nlamirault

# https://artifacthub.io/docs/topics/repositories/
annotations:
artifacthub.io/license: Apache-2.0
artifacthub.io/links: |
- name: Beyla
url: https://github.com/grafana/beyla
artifacthub.io/maintainers: |
- name: nlamirault
email: nicolas.lamirault@gmail.com
artifacthub.io/signKey: |
fingerprint: C39918B3EBDE35C23B8D0B8E5F99269A6FCA437C
url: https://keybase.io/nlamirault/pgp_keys.asc
artifacthub.io/changes: |
- kind: added
description: Init
50 changes: 50 additions & 0 deletions charts/beyla/README.md
@@ -0,0 +1,50 @@
# beyla

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

Beyla

**Homepage:** <https://github.com/grafana/beyla>

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| nlamirault | <nicolas.lamirault@gmail.com> | <https://github.com/nlamirault> |

## Source Code

* <https://github.com/grafana/beyla>

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| additionalAnnotations | object | `{}` | Additional annotations to add to all resources |
| additionalLabels | object | `{}` | Additional labels to add to all resources |
| beyla.config.attributes.kubernetes.enable | bool | `true` | |
| beyla.config.internal_metrics.path | string | `"/internal/metrics"` | |
| beyla.config.internal_metrics.port | int | `9090` | |
| beyla.config.log_level | string | `"debug"` | |
| beyla.config.print_traces | bool | `true` | |
| beyla.config.prometheus_export.path | string | `"/metrics"` | |
| beyla.config.prometheus_export.port | int | `9090` | |
| beyla.config.routes.unmatched | string | `"heuristic"` | |
| beyla.existingConfig | string | `""` | Specify an existing configMap containing Beyla configuration. If non-empty, overrides `beyla.config` |
| image | object | `{"pullPolicy":"IfNotPresent","pullSecrets":null,"repository":"grafana/beyla","tag":"1.2.0"}` | Docker image |
| rbac.create | bool | `true` | Specifies whether RBAC resources should be created |
| resources | object | `{}` | Container resources: requests and limits for CPU, Memory |
| service.port | int | `9090` | |
| service.type | string | `"ClusterIP"` | |
| serviceAccount.create | bool | `true` | Specifies whether a ServiceAccount should be created |
| serviceAccount.name | string | `nil` | |
| serviceMonitor.additionalLabels | object | `{}` | Add custom labels to the ServiceMonitor resource |
| serviceMonitor.enabled | bool | `true` | Enable this if you're using https://github.com/coreos/prometheus-operator |
| serviceMonitor.honorLabels | bool | `false` | |
| serviceMonitor.interval | string | `"30s"` | Fallback to the prometheus default unless specified |
| serviceMonitor.namespace | string | `""` | Namespace to deploy the ServiceMonitor |
| serviceMonitor.path | string | `"/metrics"` | Path to scrape metrics |
| serviceMonitor.scrapeTimeout | string | `"10s"` | Timeout for scrape metrics request |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.3](https://github.com/norwoodj/helm-docs/releases/v1.11.3)
66 changes: 66 additions & 0 deletions charts/beyla/templates/_helpers.tpl
@@ -0,0 +1,66 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "beyla.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).
*/}}
{{- define "beyla.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 "beyla.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "beyla.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "beyla.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "beyla.labels" }}
helm.sh/chart: {{ include "beyla.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/part-of: {{ template "beyla.name" . }}
{{- include "beyla.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
{{- if .Values.additionalLabels }}
{{ toYaml .Values.additionalLabels }}
{{- end }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "beyla.selectorLabels" }}
app.kubernetes.io/name: {{ include "beyla.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
22 changes: 22 additions & 0 deletions charts/beyla/templates/clusterrole.yaml
@@ -0,0 +1,22 @@
{{- if .Values.rbac.create }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
{{- if .Values.additionalAnnotations }}
annotations:
{{ toYaml .Values.additionalAnnotations | indent 4 }}
{{- end }}
labels:
{{- include "beyla.labels" . | indent 4 }}
app.kubernetes.io/component: rbac
name: {{ template "beyla.fullname" . }}
namespace: {{ .Release.Namespace }}
rules:
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["list", "watch"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["list", "watch"]
{{- end }}
23 changes: 23 additions & 0 deletions charts/beyla/templates/clusterrolebinding.yaml
@@ -0,0 +1,23 @@
{{- if .Values.rbac.create }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
{{- if .Values.additionalAnnotations }}
annotations:
{{ toYaml .Values.additionalAnnotations | indent 4 }}
{{- end }}
labels:
{{- include "beyla.labels" . | indent 4 }}
app.kubernetes.io/component: rbac
name: {{ template "beyla.fullname" . }}
namespace: {{ .Release.Namespace }}
subjects:
- kind: ServiceAccount
name: {{ template "beyla.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "beyla.fullname" . }}
{{- end }}
18 changes: 18 additions & 0 deletions charts/beyla/templates/configmap.yaml
@@ -0,0 +1,18 @@
{{- if not .Values.beyla.existingConfig -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
{{- if .Values.additionalAnnotations }}
annotations:
{{ toYaml .Values.additionalAnnotations | indent 4 }}
{{- end }}
labels:
{{- include "beyla.labels" . | indent 4 }}
app.kubernetes.io/component: config
name: {{ template "beyla.fullname" . }}
namespace: {{ .Release.Namespace }}
data:
beyla-config.yml: |
{{- toYaml .Values.beyla.config | nindent 4 }}
{{- end }}
57 changes: 57 additions & 0 deletions charts/beyla/templates/daemonset.yaml
@@ -0,0 +1,57 @@
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
{{- if .Values.additionalAnnotations }}
annotations:
{{ toYaml .Values.additionalAnnotations | indent 4 }}
{{- end }}
labels:
{{- include "beyla.labels" . | indent 4 }}
app.kubernetes.io/component: workload
name: {{ template "beyla.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
{{- include "beyla.selectorLabels" . | indent 6 }}
app.kubernetes.io/component: workload
template:
metadata:
labels:
{{- include "beyla.labels" . | indent 8 }}
app.kubernetes.io/component: workload
spec:
serviceAccountName: {{ template "beyla.serviceAccountName" . }}
hostPID: true # mandatory!
{{- if .Values.image.pullSecrets }}
imagePullSecrets: {{- .Values.image.pullSecrets }}
{{- toYaml .Values.beyla.image.pullSecrets | nindent 8 }}
{{- end }}
containers:
- name: beyla
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
env:
- name: BEYLA_CONFIG_PATH
value: "/config/beyla-config.yml"
ports:
- name: metrics
containerPort: {{ .Values.beyla.config.prometheus_export.port }}
{{- with .Values.beyla.resources }}
resources:
{{- toYaml . | nindent 10 }}
{{- end }}
securityContext:
runAsUser: 0
privileged: true # mandatory!
volumeMounts:
- mountPath: /config
name: beyla-config
volumes:
- name: beyla-config
configMap:
{{- if not .Values.beyla.existingConfig }}
name: beyla-config
{{- else }}
name: {{ .Values.beyla.existingConfig }}
{{- end }}
23 changes: 23 additions & 0 deletions charts/beyla/templates/service.yaml
@@ -0,0 +1,23 @@
---
apiVersion: v1
kind: Service
metadata:
{{- if .Values.additionalAnnotations }}
annotations:
{{ toYaml .Values.additionalAnnotations | indent 4 }}
{{- end }}
labels:
{{- include "beyla.labels" . | indent 4 }}
app.kubernetes.io/component: network
name: {{ template "beyla.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
ports:
- name: metrics
port: {{ .Values.beyla.config.prometheus_export.port }}
protocol: TCP
targetPort: {{ .Values.beyla.config.prometheus_export.port }}
selector:
{{- include "beyla.selectorLabels" . | indent 4 }}
app.kubernetes.io/component: workload
type: ClusterIP
15 changes: 15 additions & 0 deletions charts/beyla/templates/serviceaccount.yaml
@@ -0,0 +1,15 @@
{{ if .Values.serviceAccount.create }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
{{- if .Values.additionalAnnotations }}
annotations:
{{ toYaml .Values.additionalAnnotations | indent 4 }}
{{- end }}
labels:
{{- include "beyla.labels" . | indent 4 }}
app.kubernetes.io/component: rbac
name: {{ template "beyla.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
31 changes: 31 additions & 0 deletions charts/beyla/templates/servicemonitor.yaml
@@ -0,0 +1,31 @@
{{- if .Values.serviceMonitor.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
{{- if .Values.additionalAnnotations }}
annotations:
{{ toYaml .Values.additionalAnnotations | indent 4 }}
{{- end }}
labels:
{{- include "beyla.labels" . | indent 4 }}
app.kubernetes.io/component: rbac
{{- if .Values.serviceMonitor.additionalLabels }}
{{ toYaml .Values.serviceMonitor.additionalLabels }}
{{- end }}
name: {{ template "beyla.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
endpoints:
- path: /metrics
port: metrics
- path: /internal/metrics
port: metrics
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "beyla.selectorLabels" . | indent 6 }}
app.kubernetes.io/component: workload
{{- end }}

0 comments on commit 795df16

Please sign in to comment.