Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions charts/opentelemetry-ebpf-instrumentation/.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/
14 changes: 14 additions & 0 deletions charts/opentelemetry-ebpf-instrumentation/Chart.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the github workflows so that this chart is tested? chart-testing will do a default install if there is no ci folder

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: v2
name: opentelemetry-ebpf-instrumentation
version: 0.1.0
description: OpenTelemetry eBPF instrumentation Helm chart for Kubernetes
type: application
home: https://opentelemetry.io/
sources:
- https://github.com/coralogix/opentelemetry-helm-charts
- https://github.com/open-telemetry/opentelemetry-helm-charts
icon: https://opentelemetry.io/img/logos/opentelemetry-logo-nav.png
maintainers:
- name: nimrodavni78
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: nimrodavni78
- name: dmitryax
- name: jaronoff97
- name: TylerHelmuth
- name: nimrodavni78

appVersion: 0.1.0
23 changes: 23 additions & 0 deletions charts/opentelemetry-ebpf-instrumentation/README.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a section detailing requirements

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenTelemetry Collector eBPF Helm Chart

The helm chart installs [OpenTelemetry eBPF Instrumentation](https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation)
in kubernetes cluster.

## Installing the Chart

Add OpenTelemetry Helm repository:

```console
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
```

To install the chart with the release name my-opentelemetry-ebpf, run the following command:

```console
helm install my-opentelemetry-ebpf-instrumentation open-telemetry/opentelemetry-ebpf-instrumentation
```

### Other configuration options

The [values.yaml](./values.yaml) file contains information about all other configuration
options for this chart.
135 changes: 135 additions & 0 deletions charts/opentelemetry-ebpf-instrumentation/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "obi.name" -}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please prefix all the templates with the chart's name instead of obi

{{- 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 "obi.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 }}

{{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
*/}}
{{- define "obi.namespace" -}}
{{- if .Values.namespaceOverride }}
{{- .Values.namespaceOverride }}
{{- else }}
{{- .Release.Namespace }}
{{- end }}
{{- end }}

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

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

{{/*
Selector (pod) labels
*/}}
{{- define "obi.selectorLabels" -}}
app.kubernetes.io/name: {{ include "obi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- with .Values.podLabels }}
{{ toYaml . }}
{{- end }}
{{- end }}

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

{{/*
Calculate name of image ID to use for "obi".
*/}}
{{- define "obi.imageId" -}}
{{- if .Values.image.digest }}
{{- $digest := .Values.image.digest }}
{{- if not (hasPrefix "sha256:" $digest) }}
{{- $digest = printf "sha256:%s" $digest }}
{{- end }}
{{- printf "@%s" $digest }}
{{- else if .Values.image.tag }}
{{- printf ":%s" .Values.image.tag }}
{{- else }}
{{- printf ":%s" .Chart.AppVersion }}
{{- end }}
{{- end }}

{{/*
Calculate name of image ID to use for "obi-cache".
*/}}
{{- define "obi.k8sCache.imageId" -}}
{{- if .Values.k8sCache.image.digest }}
{{- $digest := .Values.k8sCache.image.digest }}
{{- if not (hasPrefix "sha256:" $digest) }}
{{- $digest = printf "sha256:%s" $digest }}
{{- end }}
{{- printf "@%s" $digest }}
{{- else if .Values.k8sCache.image.tag }}
{{- printf ":%s" .Values.k8sCache.image.tag }}
{{- else }}
{{- printf ":%s" .Chart.AppVersion }}
{{- end }}
{{- end }}

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

{{/*
Selector (pod) labels
*/}}
{{- define "obi.cache.selectorLabels" -}}
app.kubernetes.io/name: {{ .Values.k8sCache.service.name }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- with .Values.k8sCache.podLabels }}
{{ toYaml . }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{{- if .Values.k8sCache.replicas }}
{{- $root := . }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.k8sCache.service.name }}
namespace: {{ include "obi.namespace" .}}
labels:
{{- include "obi.cache.labels" . | nindent 4 }}
app.kubernetes.io/component: workload
{{- with .Values.k8sCache.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.k8sCache.replicas }}
selector:
matchLabels:
app.kubernetes.io/name: {{ .Values.k8sCache.service.name }}
template:
metadata:
{{- with .Values.k8sCache.podAnnotations }}
annotations:
{{- tpl (toYaml . | nindent 8) $root }}
{{- end }}
labels:
{{- include "obi.cache.labels" . | nindent 8 }}
spec:
{{- if .Values.serviceAccount.create }}
serviceAccountName: {{ include "obi.serviceAccountName" . }}
{{- end }}
{{- if or .Values.global.image.pullSecrets .Values.image.pullSecrets }}
imagePullSecrets:
{{- if .Values.global.image.pullSecrets }}
{{- toYaml .Values.global.image.pullSecrets | nindent 8 }}
{{- else }}
{{- toYaml .Values.image.pullSecrets | nindent 8 }}
{{- end }}
{{- end }}
containers:
- name: obi-k8s-cache
image: {{ .Values.global.image.registry | default .Values.k8sCache.image.registry }}/{{ .Values.k8sCache.image.repository }}{{ include "obi.k8sCache.imageId" . }}
imagePullPolicy: {{ .Values.k8sCache.image.pullPolicy }}
ports:
- containerPort: {{ .Values.k8sCache.service.port }}
protocol: TCP
name: grpc
{{- if .Values.k8sCache.profilePort }}
- name: profile
containerPort: {{ .Values.k8sCache.profilePort }}
protocol: TCP
{{- end }}
{{- if .Values.k8sCache.internalMetrics.port }}
- name: {{ .Values.k8sCache.internalMetrics.portName }}
containerPort: {{ .Values.k8sCache.internalMetrics.port }}
protocol: TCP
{{- end }}
{{- with .Values.k8sCache.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
env:
- name: OTEL_EBPF_K8S_CACHE_PORT
value: "{{ .Values.k8sCache.service.port }}"
{{- if .Values.k8sCache.profilePort }}
- name: OTEL_EBPF_K8S_CACHE_PROFILE_PORT
value: "{{ .Values.k8sCache.profilePort }}"
{{- end }}
{{- if .Values.k8sCache.internalMetrics.port }}
- name: OTEL_EBPF_K8S_CACHE_INTERNAL_METRICS_PROMETHEUS_PORT
value: "{{ .Values.k8sCache.internalMetrics.port }}"
{{- end }}
{{- range $key, $value := .Values.k8sCache.env }}
- name: {{ $key }}
value: "{{ $value }}"
{{- end }}
{{- range $key, $value := .Values.k8sCache.envValueFrom }}
- name: {{ $key | quote }}
valueFrom:
{{- tpl (toYaml $value) $ | nindent 16 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- if .Values.k8sCache.replicas }}
{{- $root := . }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.k8sCache.service.name }}
namespace: {{ include "obi.namespace" .}}
labels:
{{- include "obi.cache.labels" . | nindent 4 }}
app.kubernetes.io/component: networking
{{- with .Values.k8sCache.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.service.annotations }}
annotations:
{{- tpl (toYaml . | nindent 4) $root }}
{{- end }}
spec:
ports:
- port: {{ .Values.k8sCache.service.port }}
protocol: TCP
targetPort: grpc
name: grpc
selector:
app.kubernetes.io/name: {{ .Values.k8sCache.service.name }}
{{- end }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename to clusterrolebinding.yaml

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "obi.fullname" . }}
labels:
{{- include "obi.labels" . | nindent 4 }}
app.kubernetes.io/component: rbac
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: {{ include "obi.serviceAccountName" . }}
namespace: {{ include "obi.namespace" .}}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "obi.fullname" . }}
{{- end }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename to clusterrole.yaml

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "obi.fullname" . }}
labels:
{{- include "obi.labels" . | nindent 4 }}
app.kubernetes.io/component: rbac
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
- apiGroups: [ "apps" ]
resources: [ "replicasets" ]
verbs: [ "list", "watch" ]
- apiGroups: [ "" ]
resources: [ "pods", "services", "nodes" ]
verbs: [ "list", "watch", "get" ]
{{- with .Values.rbac.extraClusterRoleRules }}
{{- toYaml . | nindent 2 }}
{{- end}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{{- if not .Values.config.skipConfigMapCheck }}
{{- if and (not .Values.config.create) (eq .Values.config.name "") }}
{{- fail "if .Values.config.name is not set, then .Values.config.create should be set to true to use default configuration" }}
{{- end }}
{{- end }}
{{- if and (.Values.config.create) (eq .Values.config.name "") }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "obi.fullname" . }}
namespace: {{ include "obi.namespace" . }}
labels:
{{- include "obi.labels" . | nindent 4 }}
app.kubernetes.io/component: config
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
data:
ebpf-instrument-config.yml: |
{{- if eq .Values.preset "network" }}
{{- if not .Values.config.data.network }}
network:
enable: true
{{- end }}
{{- end }}
{{- if eq .Values.preset "application" }}
{{- if not .Values.config.data.discovery }}
discovery:
services:
- k8s_namespace: .
exclude_services:
- exe_path: ".*ebpf-instrument.*|.*otelcol.*"
{{- end }}
{{- end }}
{{- toYaml .Values.config.data | nindent 4}}
{{- end }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets move the configmap logic into a helper template like the other charts do

Loading