Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rthooks: support NRI #2608

Merged
merged 32 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
94ae4a4
tetragon-oci-hook-setup: use slog
kkourt Jun 20, 2024
56cd432
rthooks: move conf patch code to tetragon-oci-hook
kkourt Jun 20, 2024
4c44601
rthooks: mv tetragon-oci-hook to tetragon-rthooks
kkourt Jun 20, 2024
e7f1722
tetragon-rthooks-setup: rename parseState
kkourt Jun 21, 2024
a8b51a8
patched-containerd-conf: deal with cr
kkourt Jun 21, 2024
43adcdb
patch-containerd-conf: enable NRI command
kkourt Jun 21, 2024
c2ecdf7
tetragon-hooks: rename hook to oci-hook
kkourt Jun 21, 2024
9e791ed
rthooks: introduce tetragon-nri-hook
kkourt Jun 24, 2024
54bc82a
rthooks: --nri to minikube-install-hook.sh
kkourt Jun 24, 2024
fa0dbc9
tetragon-oci-hook: add error message when failing
kkourt Jun 24, 2024
fe766fe
rthooks: improve Makefile
kkourt Jun 25, 2024
7eebfd3
contrib: remove rthooks folder
kkourt Jun 25, 2024
4c6c3c7
tetragon-rthooks: add Dockerfile
kkourt Jun 25, 2024
238b69d
gh: build rthooks image (CI)
kkourt Jun 25, 2024
fed61a5
docs: initial docs for runtime hooks
kkourt Jun 25, 2024
ec3549f
rthooks-setup: make --fail-allow-namespaces global
kkourt Jun 28, 2024
828c6c4
tetragon-rthooks-setup: add --daemonize
kkourt Jun 28, 2024
ece6ab3
make: add image-rthooks target
kkourt Jun 28, 2024
524b0a3
helm: add rthooks
kkourt Jun 28, 2024
5caca4d
tetragon-oci-setup: pass arbitrary args to hook
kkourt Jun 28, 2024
54aee4d
helm: add --grpc-address argument to oci hook
kkourt Jul 1, 2024
0367247
docs: add rthooks configuration
kkourt Jul 1, 2024
023dc77
tetragon-oci-hook-setup: prepare for nri interface
kkourt Jul 1, 2024
92fdb60
tetragon-oci-hook: setup add NRI interface
kkourt Jul 1, 2024
dd53a62
tetragon-oci-hook: also look for "config.json"
kkourt Jul 2, 2024
5bc78f8
tetragon-oci-hook: log failure to find spec
kkourt Jul 2, 2024
be0098c
rthooks: use createRuntime everywhere
kkourt Jul 2, 2024
8d2a2dc
helm: rthooks: add NRI support
kkourt Jul 2, 2024
fd04148
docs: rthooks: instructions for containerd
kkourt Jul 2, 2024
ede96d0
tetragon-oci-hook: add server-version command
kkourt Jul 2, 2024
36166c8
helm: rthooks: add docs link
kkourt Jul 4, 2024
986019b
tetragon-oci-hook: use grpc.NewClient
kkourt Jul 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"api/go.sum",
"pkg/k8s/go.mod",
"pkg/k8s/go.sum",
"contrib/rthooks/tetragon-oci-hook/go.mod",
"contrib/rthooks/tetragon-oci-hook/go.sum",
"contrib/tetragon-rthooks/go.mod",
"contrib/tetragon-rthooks/go.sum",
"*Dockerfile*",
"docs/hugo.toml",
"install/kubernetes/tetragon/values.yaml",
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build-images-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
- name: tetragon-operator
dockerfile: ./Dockerfile.operator

- name: tetragon-rthooks
dockerfile: ./Dockerfile.rthooks

steps:
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ RUN mkdir /var/lib/tetragon/ && \
apk add --no-cache --update bash
COPY --from=tetragon-builder /go/src/github.com/cilium/tetragon/tetragon /usr/bin/
COPY --from=tetragon-builder /go/src/github.com/cilium/tetragon/tetra /usr/bin/
COPY --from=tetragon-builder /go/src/github.com/cilium/tetragon/contrib/rthooks/tetragon-oci-hook/tetragon-oci-hook /usr/bin/
COPY --from=tetragon-builder /go/src/github.com/cilium/tetragon/contrib/rthooks/tetragon-oci-hook/tetragon-oci-hook-setup /usr/bin/
COPY --from=tetragon-builder /go/src/github.com/cilium/tetragon/contrib/tetragon-rthooks/tetragon-oci-hook /usr/bin/
COPY --from=tetragon-builder /go/src/github.com/cilium/tetragon/contrib/tetragon-rthooks/tetragon-oci-hook-setup /usr/bin/
COPY --from=gops /gops/gops /usr/bin/
COPY --from=bpf-builder /go/src/github.com/cilium/tetragon/bpf/objs/*.o /var/lib/tetragon/
ENTRYPOINT ["/usr/bin/tetragon"]
Expand Down
33 changes: 33 additions & 0 deletions Dockerfile.rthooks
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SPDX-License-Identifier: Apache-2.0

ARG GOLANG_IMAGE=docker.io/library/golang:1.22.4@sha256:c2010b9c2342431a24a2e64e33d9eb2e484af49e72c820e200d332d214d5e61f
ARG BASE_IMAGE=docker.io/library/alpine:3.20.0@sha256:77726ef6b57ddf65bb551896826ec38bc3e53f75cdde31354fbffb4f25238ebd

# BUILDPLATFORM is an automatic platform ARG enabled by Docker BuildKit.
# Represents the plataform where the build is happening, do not mix with
# TARGETARCH
FROM --platform=${BUILDPLATFORM} ${GOLANG_IMAGE} as builder
# TARGETOS is an automatic platform ARG enabled by Docker BuildKit.
ARG TARGETOS
# TARGETARCH is an automatic platform ARG enabled by Docker BuildKit.
ARG TARGETARCH
WORKDIR /go/src/github.com/cilium/tetragon
RUN --mount=type=bind,readwrite,target=/go/src/github.com/cilium/tetragon \
--mount=target=/root/.cache,type=cache \
--mount=target=/go/pkg/mod,type=cache \
make GOARCH=${TARGETARCH} tetragon-oci-hook tetragon-oci-hook-setup tetragon-nri-hook \
&& mkdir -p /out/${TARGETOS}/${TARGETARCH}/usr/bin \
&& mv ./contrib/tetragon-rthooks/tetragon-oci-hook /out/${TARGETOS}/${TARGETARCH}/usr/bin \
&& mv ./contrib/tetragon-rthooks/tetragon-oci-hook-setup /out/${TARGETOS}/${TARGETARCH}/usr/bin \
&& mv ./contrib/tetragon-rthooks/tetragon-nri-hook /out/${TARGETOS}/${TARGETARCH}/usr/bin

FROM ${BASE_IMAGE} as image
# TARGETOS is an automatic platform ARG enabled by Docker BuildKit.
ARG TARGETOS
# TARGETARCH is an automatic platform ARG enabled by Docker BuildKit.
ARG TARGETARCH
LABEL maintainer="[email protected]"
COPY --from=builder /out/${TARGETOS}/${TARGETARCH}/usr/bin/tetragon-oci-hook /usr/bin/
COPY --from=builder /out/${TARGETOS}/${TARGETARCH}/usr/bin/tetragon-oci-hook-setup /usr/bin/
COPY --from=builder /out/${TARGETOS}/${TARGETARCH}/usr/bin/tetragon-nri-hook /usr/bin/
WORKDIR /
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ifdef EXTRA_GO_BUILD_FLAGS
endif

GO_BUILD = CGO_ENABLED=0 GOARCH=$(GOARCH) $(GO) build $(GO_BUILD_FLAGS)
GO_BUILD_HOOK = CGO_ENABLED=0 GOARCH=$(GOARCH) $(GO) -C contrib/rthooks/tetragon-oci-hook build $(GO_BUILD_FLAGS)
GO_BUILD_HOOK = CGO_ENABLED=0 GOARCH=$(GOARCH) $(GO) -C contrib/tetragon-rthooks build $(GO_BUILD_FLAGS)

.PHONY: all
all: tetragon-bpf tetragon tetra generate-flags test-compile tester-progs protoc-gen-go-tetragon tetragon-bench
Expand Down Expand Up @@ -188,7 +188,10 @@ tetragon-operator:
$(GO_BUILD) -o $@ ./operator

tetragon-oci-hook:
$(GO_BUILD_HOOK) -o $@ ./cmd/hook
$(GO_BUILD_HOOK) -o $@ ./cmd/oci-hook

tetragon-nri-hook:
$(GO_BUILD_HOOK) -o $@ ./cmd/nri-hook

tetragon-oci-hook-setup:
$(GO_BUILD_HOOK) -o $@ ./cmd/setup
Expand All @@ -211,7 +214,7 @@ install:
vendor:
$(MAKE) -C ./api vendor
$(MAKE) -C ./pkg/k8s vendor
$(MAKE) -C ./contrib/rthooks/tetragon-oci-hook vendor
$(MAKE) -C ./contrib/tetragon-rthooks vendor
$(GO) mod tidy
$(GO) mod vendor
$(GO) mod verify
Expand Down Expand Up @@ -301,6 +304,11 @@ image-operator:
$(QUIET)@echo "Push like this when ready:"
$(QUIET)@echo "${CONTAINER_ENGINE} push cilium/tetragon-operator:$(DOCKER_IMAGE_TAG)"

image-rthooks:
$(CONTAINER_ENGINE) build -f Dockerfile.rthooks -t "cilium/tetragon-rthooks:${DOCKER_IMAGE_TAG}" --platform=linux/${TARGET_ARCH} .
$(QUIET)@echo "Push like this when ready:"
$(QUIET)@echo "${CONTAINER_ENGINE} push cilium/tetragon-rthooks:$(DOCKER_IMAGE_TAG)"

image-test: image-clang
$(CONTAINER_ENGINE) build -f Dockerfile.test -t "cilium/tetragon-test:${DOCKER_IMAGE_TAG}" .
$(QUIET)@echo "Push like this when ready:"
Expand Down
222 changes: 0 additions & 222 deletions contrib/rthooks/patch-containerd-conf.go

This file was deleted.

30 changes: 0 additions & 30 deletions contrib/rthooks/tetragon-oci-hook/Makefile

This file was deleted.

Loading
Loading