Skip to content

Commit

Permalink
chore: Improve local k8s developer experience
Browse files Browse the repository at this point in the history
Compile all commands listed for kind setup into one make command via make kind-setup and updated docs accordingly along removing minikube setup

Signed-off-by: sadath-12 <sadathsadu2002@gmail.com>
  • Loading branch information
sadath-12 committed Jan 4, 2024
1 parent a250225 commit 9d65459
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 25 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ GO_BUILD_HOOK = CGO_ENABLED=0 GOARCH=$(GOARCH) $(GO) -C contrib/rthooks/tetragon
.PHONY: all
all: tetragon-bpf tetragon tetra generate-flags test-compile tester-progs protoc-gen-go-tetragon tetragon-bench

.PHONY: kind
kind:
./contrib/localdev/bootstrap-kind-cluster.sh

.PHONY: kind-install-tetragon
kind-install-tetragon:
./contrib/localdev/install-tetragon.sh --image cilium/tetragon:latest --operator cilium/tetragon-operator:latest

.PHONY: kind-setup
kind-setup: images kind kind-install-tetragon

-include Makefile.docker
-include Makefile.cli

Expand Down Expand Up @@ -304,6 +315,9 @@ image-clang:
$(QUIET)@echo "Push like this when ready:"
$(QUIET)@echo "${CONTAINER_ENGINE} push cilium/clang:$(DOCKER_IMAGE_TAG)"

.PHONY: images
images: image image-operator

.PHONY: tarball tarball-release tarball-clean
# Share same build environment as docker image
tarball: tarball-clean image
Expand Down
28 changes: 3 additions & 25 deletions docs/content/en/docs/contribution-guide/development-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,11 @@ make tarball

### Running Tetragon in kind

The scripts in contrib/localdev will help you run Tetragon locally in a kind
cluster. First, ensure that docker, kind, kubectl, and helm are installed on
your system. Then, run the following commands:
This command will setup tetragon, kind cluster and install tetragon in it. Ensure docker, kind, kubectl, and helm are installed.

```shell
# Build Tetragon agent and operator images
make LOCAL_CLANG=0 image image-operator

# Bootstrap the cluster
contrib/localdev/bootstrap-kind-cluster.sh

# Install Tetragon
contrib/localdev/install-tetragon.sh --image cilium/tetragon:latest --operator cilium/tetragon-operator:latest
# Setup tetragon on kind
make kind-setup
```

Verify that Tetragon is installed by running:
Expand All @@ -146,20 +138,6 @@ If you are getting an error, you can try to run `sudo launchctl load
/Library/LaunchDaemons/org.virtualbox.startup.plist` (from [a Stackoverflow
answer](https://stackoverflow.com/questions/18149546/macos-vagrant-up-failed-dev-vboxnetctl-no-such-file-or-directory)).

### Local Development in Minikube

You can also run the tetragon agent directly (instead of in a pod). Here we
describe how this can be done in minikube:

```shell
minikube start --driver=kvm2
minikube mount $HOME:$HOME # so that we can use .kube/config
./tetragon-operator --kube-config ~/.kube/config
make STATIC=1 tetragon
minikube ssh -- 'sudo mkdir -p /var/run/cilium/tetragon'
minikube ssh sudo "sh -c 'NODE_NAME=minikube /home/kkourt/src/tetragon/tetragon --bpf-lib /home/kkourt/src/tetragon/bpf/objs --server-address unix:///var/run/cilium/tetragon/tetragon.sock --enable-k8s-api --k8s-kubeconfig-path /home/kkourt/.kube/config'"
```

### What's next

- See how to [make your first changes](/docs/contribution-guide/making-changes).
Expand Down

0 comments on commit 9d65459

Please sign in to comment.