Skip to content

Commit f8a1502

Browse files
authored
Opentelemetry ebpf instrumentation (#211)
add opentelemetry-ebpf-instrumentation helm chart
1 parent 36f2de5 commit f8a1502

15 files changed

Lines changed: 1039 additions & 0 deletions
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Coralogix-OpenTelemetry-ebpf-instrumentation-Helm-Chart
2+
on:
3+
push:
4+
branches: main
5+
paths:
6+
- 'charts/opentelemetry-ebpf-instrumentation/**'
7+
8+
env:
9+
CHART_VERSION: $(yq eval '.version' charts/opentelemetry-ebpf-instrumentation/Chart.yaml)
10+
CHART_NAME: opentelemetry-ebpf-instrumentation
11+
ARTIFACTORY_URL: https://cgx.jfrog.io/artifactory/
12+
ARTIFACTORY_USERNAME: integrations-actions
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
-
19+
name: Checkout
20+
uses: actions/checkout@v4
21+
-
22+
name: Setup Helm Repo
23+
run: |
24+
cd charts/opentelemetry-ebpf-instrumentation
25+
helm package .
26+
-
27+
name: Setup JFrog CLI
28+
uses: jfrog/setup-jfrog-cli@v2.1.0
29+
with:
30+
version: 2.12.1
31+
-
32+
name: use-jfrog-cli
33+
run: |
34+
cd charts/opentelemetry-ebpf-instrumentation
35+
jfrog rt upload --access-token ${{ secrets.ARTIFACTORY_NONUSER_ACCESS_TOKEN }} "${{ env.CHART_NAME }}-*.tgz" coralogix-charts --url ${{ env.ARTIFACTORY_URL }}
36+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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/
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: v2
3+
name: opentelemetry-ebpf-instrumentation
4+
version: 0.1.0
5+
description: OpenTelemetry eBPF instrumentation Helm chart for Kubernetes
6+
type: application
7+
home: https://opentelemetry.io/
8+
sources:
9+
- https://github.com/coralogix/opentelemetry-helm-charts
10+
- https://github.com/open-telemetry/opentelemetry-helm-charts
11+
icon: https://opentelemetry.io/img/logos/opentelemetry-logo-nav.png
12+
maintainers:
13+
- name: nimrodavni78
14+
appVersion: 0.1.0
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenTelemetry Collector eBPF Helm Chart
2+
3+
The helm chart installs [OpenTelemetry eBPF Instrumentation](https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation)
4+
in kubernetes cluster.
5+
6+
## Installing the Chart
7+
8+
Add OpenTelemetry Helm repository:
9+
10+
```console
11+
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
12+
```
13+
14+
To install the chart with the release name my-opentelemetry-ebpf, run the following command:
15+
16+
```console
17+
helm install my-opentelemetry-ebpf-instrumentation open-telemetry/opentelemetry-ebpf-instrumentation
18+
```
19+
20+
### Other configuration options
21+
22+
The [values.yaml](./values.yaml) file contains information about all other configuration
23+
options for this chart.
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "obi.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 "obi.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 "obi.namespace" -}}
30+
{{- if .Values.namespaceOverride }}
31+
{{- .Values.namespaceOverride }}
32+
{{- else }}
33+
{{- .Release.Namespace }}
34+
{{- end }}
35+
{{- end }}
36+
37+
{{/*
38+
Create chart name and version as used by the chart label.
39+
*/}}
40+
{{- define "obi.chart" -}}
41+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
42+
{{- end }}
43+
44+
{{/*
45+
Common labels
46+
*/}}
47+
{{- define "obi.labels" -}}
48+
helm.sh/chart: {{ include "obi.chart" . }}
49+
{{ include "obi.selectorLabels" . }}
50+
{{- if .Chart.AppVersion }}
51+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
52+
{{- end }}
53+
app.kubernetes.io/managed-by: {{ .Release.Service }}
54+
app.kubernetes.io/part-of: obi
55+
{{- end }}
56+
57+
{{/*
58+
Selector (pod) labels
59+
*/}}
60+
{{- define "obi.selectorLabels" -}}
61+
app.kubernetes.io/name: {{ include "obi.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 "obi.serviceAccountName" -}}
72+
{{- if .Values.serviceAccount.create }}
73+
{{- default (include "obi.fullname" .) .Values.serviceAccount.name }}
74+
{{- else }}
75+
{{- default "default" .Values.serviceAccount.name }}
76+
{{- end }}
77+
{{- end }}
78+
79+
{{/*
80+
Calculate name of image ID to use for "obi".
81+
*/}}
82+
{{- define "obi.imageId" -}}
83+
{{- if .Values.image.digest }}
84+
{{- $digest := .Values.image.digest }}
85+
{{- if not (hasPrefix "sha256:" $digest) }}
86+
{{- $digest = printf "sha256:%s" $digest }}
87+
{{- end }}
88+
{{- printf "@%s" $digest }}
89+
{{- else if .Values.image.tag }}
90+
{{- printf ":%s" .Values.image.tag }}
91+
{{- else }}
92+
{{- printf ":%s" .Chart.AppVersion }}
93+
{{- end }}
94+
{{- end }}
95+
96+
{{/*
97+
Calculate name of image ID to use for "obi-cache".
98+
*/}}
99+
{{- define "obi.k8sCache.imageId" -}}
100+
{{- if .Values.k8sCache.image.digest }}
101+
{{- $digest := .Values.k8sCache.image.digest }}
102+
{{- if not (hasPrefix "sha256:" $digest) }}
103+
{{- $digest = printf "sha256:%s" $digest }}
104+
{{- end }}
105+
{{- printf "@%s" $digest }}
106+
{{- else if .Values.k8sCache.image.tag }}
107+
{{- printf ":%s" .Values.k8sCache.image.tag }}
108+
{{- else }}
109+
{{- printf ":%s" .Chart.AppVersion }}
110+
{{- end }}
111+
{{- end }}
112+
113+
{{/*
114+
Common kube cache labels
115+
*/}}
116+
{{- define "obi.cache.labels" -}}
117+
helm.sh/chart: {{ include "obi.chart" . }}
118+
{{ include "obi.cache.selectorLabels" . }}
119+
{{- if .Chart.AppVersion }}
120+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
121+
{{- end }}
122+
app.kubernetes.io/managed-by: {{ .Release.Service }}
123+
app.kubernetes.io/part-of: obi
124+
{{- end }}
125+
126+
{{/*
127+
Selector (pod) labels
128+
*/}}
129+
{{- define "obi.cache.selectorLabels" -}}
130+
app.kubernetes.io/name: {{ .Values.k8sCache.service.name }}
131+
app.kubernetes.io/instance: {{ .Release.Name }}
132+
{{- with .Values.k8sCache.podLabels }}
133+
{{ toYaml . }}
134+
{{- end }}
135+
{{- end }}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{{- if .Values.k8sCache.replicas }}
2+
{{- $root := . }}
3+
apiVersion: apps/v1
4+
kind: Deployment
5+
metadata:
6+
name: {{ .Values.k8sCache.service.name }}
7+
namespace: {{ include "obi.namespace" .}}
8+
labels:
9+
{{- include "obi.cache.labels" . | nindent 4 }}
10+
app.kubernetes.io/component: workload
11+
{{- with .Values.k8sCache.annotations }}
12+
annotations:
13+
{{- toYaml . | nindent 4 }}
14+
{{- end }}
15+
spec:
16+
replicas: {{ .Values.k8sCache.replicas }}
17+
selector:
18+
matchLabels:
19+
app.kubernetes.io/name: {{ .Values.k8sCache.service.name }}
20+
template:
21+
metadata:
22+
{{- with .Values.k8sCache.podAnnotations }}
23+
annotations:
24+
{{- tpl (toYaml . | nindent 8) $root }}
25+
{{- end }}
26+
labels:
27+
{{- include "obi.cache.labels" . | nindent 8 }}
28+
spec:
29+
{{- if .Values.serviceAccount.create }}
30+
serviceAccountName: {{ include "obi.serviceAccountName" . }}
31+
{{- end }}
32+
{{- if or .Values.global.image.pullSecrets .Values.image.pullSecrets }}
33+
imagePullSecrets:
34+
{{- if .Values.global.image.pullSecrets }}
35+
{{- toYaml .Values.global.image.pullSecrets | nindent 8 }}
36+
{{- else }}
37+
{{- toYaml .Values.image.pullSecrets | nindent 8 }}
38+
{{- end }}
39+
{{- end }}
40+
containers:
41+
- name: obi-k8s-cache
42+
image: {{ .Values.global.image.registry | default .Values.k8sCache.image.registry }}/{{ .Values.k8sCache.image.repository }}{{ include "obi.k8sCache.imageId" . }}
43+
imagePullPolicy: {{ .Values.k8sCache.image.pullPolicy }}
44+
ports:
45+
- containerPort: {{ .Values.k8sCache.service.port }}
46+
protocol: TCP
47+
name: grpc
48+
{{- if .Values.k8sCache.profilePort }}
49+
- name: profile
50+
containerPort: {{ .Values.k8sCache.profilePort }}
51+
protocol: TCP
52+
{{- end }}
53+
{{- if .Values.k8sCache.internalMetrics.port }}
54+
- name: {{ .Values.k8sCache.internalMetrics.portName }}
55+
containerPort: {{ .Values.k8sCache.internalMetrics.port }}
56+
protocol: TCP
57+
{{- end }}
58+
{{- with .Values.k8sCache.resources }}
59+
resources:
60+
{{- toYaml . | nindent 12 }}
61+
{{- end }}
62+
env:
63+
- name: OTEL_EBPF_K8S_CACHE_PORT
64+
value: "{{ .Values.k8sCache.service.port }}"
65+
{{- if .Values.k8sCache.profilePort }}
66+
- name: OTEL_EBPF_K8S_CACHE_PROFILE_PORT
67+
value: "{{ .Values.k8sCache.profilePort }}"
68+
{{- end }}
69+
{{- if .Values.k8sCache.internalMetrics.port }}
70+
- name: OTEL_EBPF_K8S_CACHE_INTERNAL_METRICS_PROMETHEUS_PORT
71+
value: "{{ .Values.k8sCache.internalMetrics.port }}"
72+
{{- end }}
73+
{{- range $key, $value := .Values.k8sCache.env }}
74+
- name: {{ $key }}
75+
value: "{{ $value }}"
76+
{{- end }}
77+
{{- range $key, $value := .Values.k8sCache.envValueFrom }}
78+
- name: {{ $key | quote }}
79+
valueFrom:
80+
{{- tpl (toYaml $value) $ | nindent 16 }}
81+
{{- end }}
82+
{{- end }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{- if .Values.k8sCache.replicas }}
2+
{{- $root := . }}
3+
apiVersion: v1
4+
kind: Service
5+
metadata:
6+
name: {{ .Values.k8sCache.service.name }}
7+
namespace: {{ include "obi.namespace" .}}
8+
labels:
9+
{{- include "obi.cache.labels" . | nindent 4 }}
10+
app.kubernetes.io/component: networking
11+
{{- with .Values.k8sCache.service.labels }}
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
{{- with .Values.service.annotations }}
15+
annotations:
16+
{{- tpl (toYaml . | nindent 4) $root }}
17+
{{- end }}
18+
spec:
19+
ports:
20+
- port: {{ .Values.k8sCache.service.port }}
21+
protocol: TCP
22+
targetPort: grpc
23+
name: grpc
24+
selector:
25+
app.kubernetes.io/name: {{ .Values.k8sCache.service.name }}
26+
{{- end }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- if .Values.rbac.create }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRoleBinding
4+
metadata:
5+
name: {{ include "obi.fullname" . }}
6+
labels:
7+
{{- include "obi.labels" . | nindent 4 }}
8+
app.kubernetes.io/component: rbac
9+
{{- with .Values.annotations }}
10+
annotations:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
subjects:
14+
- kind: ServiceAccount
15+
name: {{ include "obi.serviceAccountName" . }}
16+
namespace: {{ include "obi.namespace" .}}
17+
roleRef:
18+
apiGroup: rbac.authorization.k8s.io
19+
kind: ClusterRole
20+
name: {{ include "obi.fullname" . }}
21+
{{- end }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{{- if .Values.rbac.create }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: {{ include "obi.fullname" . }}
6+
labels:
7+
{{- include "obi.labels" . | nindent 4 }}
8+
app.kubernetes.io/component: rbac
9+
{{- with .Values.annotations }}
10+
annotations:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
rules:
14+
- apiGroups: [ "apps" ]
15+
resources: [ "replicasets" ]
16+
verbs: [ "list", "watch" ]
17+
- apiGroups: [ "" ]
18+
resources: [ "pods", "services", "nodes" ]
19+
verbs: [ "list", "watch", "get" ]
20+
{{- with .Values.rbac.extraClusterRoleRules }}
21+
{{- toYaml . | nindent 2 }}
22+
{{- end}}
23+
{{- end }}

0 commit comments

Comments
 (0)