From 62912d248d9829c73110724641c1ab27b7133279 Mon Sep 17 00:00:00 2001 From: Alon Girmonsky <1990761+alongir@users.noreply.github.com> Date: Mon, 10 Feb 2025 13:53:42 -0800 Subject: [PATCH 1/2] for mac os compatibility --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9cbc96d71..0823a2e96 100644 --- a/Makefile +++ b/Makefile @@ -182,7 +182,11 @@ release: @cd ../tracer && git checkout master && git pull && git tag -d v$(VERSION); git tag v$(VERSION) && git push origin --tags @cd ../hub && git checkout master && git pull && git tag -d v$(VERSION); git tag v$(VERSION) && git push origin --tags @cd ../front && git checkout master && git pull && git tag -d v$(VERSION); git tag v$(VERSION) && git push origin --tags - @cd ../kubeshark && git checkout master && git pull && sed -i "s/^version:.*/version: \"$(shell echo $(VERSION) | sed -E 's/^([0-9]+\.[0-9]+)\..*/\1/')\"/" helm-chart/Chart.yaml && make && make generate-helm-values && make generate-manifests + @cd ../kubeshark && git checkout master && git pull && sed -i "s/^version:.*/version: \"$(shell echo $(VERSION) | sed -E 's/^([0-9]+\.[0-9]+)\..*/\1/')\"/" helm-chart/Chart.yaml && make + @if [ "$(shell uname)" = "Darwin" ]; then \ + codesign --sign - --force --preserve-metadata=entitlements,requirements,flags,runtime ./bin/kubeshark__; \ + fi + @make generate-helm-values && make generate-manifests @git add -A . && git commit -m ":bookmark: Bump the Helm chart version to $(VERSION)" && git push @git tag -d v$(VERSION); git tag v$(VERSION) && git push origin --tags @cd helm-chart && rm -r ../../kubeshark.github.io/charts/chart/* && cp -r . ../../kubeshark.github.io/charts/chart From 95d6655af67708120662cb6593a763f0f31f9c75 Mon Sep 17 00:00:00 2001 From: Alon Girmonsky <1990761+alongir@users.noreply.github.com> Date: Wed, 12 Feb 2025 12:28:52 -0800 Subject: [PATCH 2/2] finished templating `tap.mountBpf` option. (#1711) --- config/configStructs/tapConfig.go | 1 + helm-chart/README.md | 1 + helm-chart/values.yaml | 1 + manifests/complete.yaml | 14 ++++++++++++++ 4 files changed, 17 insertions(+) diff --git a/config/configStructs/tapConfig.go b/config/configStructs/tapConfig.go index 15277497c..aef362dc2 100644 --- a/config/configStructs/tapConfig.go +++ b/config/configStructs/tapConfig.go @@ -313,6 +313,7 @@ type TapConfig struct { Pprof PprofConfig `yaml:"pprof" json:"pprof"` Misc MiscConfig `yaml:"misc" json:"misc"` SecurityContext SecurityContextConfig `yaml:"securityContext" json:"securityContext"` + MountBpf bool `yaml:"mountBpf" json:"mountBpf" default:"true"` } func (config *TapConfig) PodRegex() *regexp.Regexp { diff --git a/helm-chart/README.md b/helm-chart/README.md index aba816ca0..1838302ed 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -205,6 +205,7 @@ Example for overriding image names: | `tap.globalFilter` | Prepends to any KFL filter and can be used to limit what is visible in the dashboard. For example, `redact("request.headers.Authorization")` will redact the appropriate field. Another example `!dns` will not show any DNS traffic. | `""` | | `tap.metrics.port` | Pod port used to expose Prometheus metrics | `49100` | | `tap.enabledDissectors` | This is an array of strings representing the list of supported protocols. Remove or comment out redundant protocols (e.g., dns).| The default list excludes: `udp` and `tcp` | +| `tap.mountBpf` | BPF filesystem needs to be mounted for eBPF to work properly. This helm value determines whether Kubeshark will attempt to mount the filesystem. This option is not required if filesystem is already mounts. │ `true`| | `logs.file` | Logs dump path | `""` | | `pcapdump.enabled` | Enable recording of all traffic captured according to other parameters. Whatever Kubeshark captures, considering pod targeting rules, will be stored in pcap files ready to be viewed by tools | `true` | | `pcapdump.maxTime` | The time window into the past that will be stored. Older traffic will be discarded. | `2h` | diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 257f8c298..900141b40 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -209,6 +209,7 @@ tap: - SYS_PTRACE - SYS_RESOURCE - IPC_LOCK + mountBpf: true logs: file: "" grep: "" diff --git a/manifests/complete.yaml b/manifests/complete.yaml index 8db5b820e..a40cbe676 100644 --- a/manifests/complete.yaml +++ b/manifests/complete.yaml @@ -523,6 +523,20 @@ spec: name: kubeshark-worker-daemon-set namespace: kubeshark spec: + initContainers: + - command: + - /bin/sh + - -c + - mkdir -p /sys/fs/bpf && mount | grep -q '/sys/fs/bpf' || mount -t bpf bpf /sys/fs/bpf + image: 'docker.io/kubeshark/worker:v52.4' + imagePullPolicy: Always + name: mount-bpf + securityContext: + privileged: true + volumeMounts: + - mountPath: /sys + name: sys + mountPropagation: Bidirectional containers: - command: - ./worker