diff --git a/charts/beyla/Chart.yaml b/charts/beyla/Chart.yaml new file mode 100644 index 00000000..1496793a --- /dev/null +++ b/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 diff --git a/charts/beyla/README.md b/charts/beyla/README.md new file mode 100644 index 00000000..8190e0e3 --- /dev/null +++ b/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:** + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| nlamirault | | | + +## Source Code + +* + +## 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) diff --git a/charts/beyla/templates/_helpers.tpl b/charts/beyla/templates/_helpers.tpl new file mode 100644 index 00000000..eca2ebaf --- /dev/null +++ b/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 }} diff --git a/charts/beyla/templates/clusterrole.yaml b/charts/beyla/templates/clusterrole.yaml new file mode 100644 index 00000000..a6501db1 --- /dev/null +++ b/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 }} diff --git a/charts/beyla/templates/clusterrolebinding.yaml b/charts/beyla/templates/clusterrolebinding.yaml new file mode 100644 index 00000000..551374e3 --- /dev/null +++ b/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 }} diff --git a/charts/beyla/templates/configmap.yaml b/charts/beyla/templates/configmap.yaml new file mode 100644 index 00000000..ff864bad --- /dev/null +++ b/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 }} diff --git a/charts/beyla/templates/daemonset.yaml b/charts/beyla/templates/daemonset.yaml new file mode 100644 index 00000000..7604efc8 --- /dev/null +++ b/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 }} \ No newline at end of file diff --git a/charts/beyla/templates/service.yaml b/charts/beyla/templates/service.yaml new file mode 100644 index 00000000..c1a828e0 --- /dev/null +++ b/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 diff --git a/charts/beyla/templates/serviceaccount.yaml b/charts/beyla/templates/serviceaccount.yaml new file mode 100644 index 00000000..c2bf0b8e --- /dev/null +++ b/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 -}} diff --git a/charts/beyla/templates/servicemonitor.yaml b/charts/beyla/templates/servicemonitor.yaml new file mode 100644 index 00000000..36dffc6c --- /dev/null +++ b/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 }} diff --git a/charts/beyla/values.yaml b/charts/beyla/values.yaml new file mode 100644 index 00000000..9cd0ea03 --- /dev/null +++ b/charts/beyla/values.yaml @@ -0,0 +1,95 @@ +--- +# -- Additional labels to add to all resources +additionalLabels: {} + # app: beyla + +# -- Additional annotations to add to all resources +additionalAnnotations: {} + +# -- Docker image +image: + repository: grafana/beyla + tag: 1.2.0 + pullPolicy: IfNotPresent + pullSecrets: + +## For RBAC support: +rbac: + # -- Specifies whether RBAC resources should be created + create: true + +serviceAccount: + # -- Specifies whether a ServiceAccount should be created + create: true + + # The name of the ServiceAccount to use. + # If not set and create is true, a name is generated using the fullname template + name: + +# -- Container resources: requests and limits for CPU, Memory +resources: {} + # limits: + # memory: 300Mi + # requests: + # memory: 50Mi + +service: + type: ClusterIP + port: 9090 + +beyla: + # -- Specify an existing configMap containing Beyla configuration. If non-empty, overrides `beyla.config` + existingConfig: "" + config: + # # this is required to enable kubernetes discovery and metadata + attributes: + kubernetes: + enable: true + + print_traces: true + log_level: debug + + # this will provide automatic routes report while minimizing cardinality + routes: + unmatched: heuristic + + # # let's instrument only Grafana + # discovery: + # services: + # - k8s_namespace: observability + # - k8s_pod_name: grafana-0 + + # # # Instrument any process using the ports from 8080 to 8089 + # # - open_ports: 8080-8089 + # # # Instrument any process whose executable contains "http" + # # - exe_path: "http" + # # # Instrument any process with an executable containing "nginx" + # # # and using the port 443 (both conditions must be fulfilled) + # # - open_ports: 443 + # # exe_path: "nginx" + + prometheus_export: + port: 9090 + path: /metrics + internal_metrics: + port: 9090 + path: /internal/metrics + # otel_metrics_export: + # endpoint: "" + # otel_traces_export: + # endpoint: "" + +serviceMonitor: + # -- Enable this if you're using https://github.com/coreos/prometheus-operator + enabled: true + # -- Namespace to deploy the ServiceMonitor + namespace: "" + # -- Fallback to the prometheus default unless specified + interval: 30s + # -- Add custom labels to the ServiceMonitor resource + additionalLabels: {} + honorLabels: false + # -- Path to scrape metrics + path: /metrics + # -- Timeout for scrape metrics request + scrapeTimeout: 10s