Skip to content

Commit

Permalink
docs: Add "making changes" instructions for specific code areas
Browse files Browse the repository at this point in the history
Adding initial contribution guides for specific areas. Mainly instructions for
generating files, some of which I moved from the "development setup" page.

Signed-off-by: Anna Kapuscinska <[email protected]>
  • Loading branch information
lambdanis committed May 29, 2024
1 parent 2252857 commit b1bf723
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 36 deletions.
35 changes: 0 additions & 35 deletions docs/content/en/docs/contribution-guide/development-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,41 +68,6 @@ Notes:
with the `--btf` flag. See more about that
[in the FAQ]({{< ref "/docs/installation/faq#tetragon-failed-to-start-complaining-about-a-missing-btf-file" >}}).

## Running code generation

Tetragon uses code generation based on protoc to generate large amounts of
boilerplate code based on our protobuf API. We similarly use automatic
generation to maintain our k8s CRDs. Whenever you make changes to these files,
you will be required to re-run code generation before your PR can be accepted.

To run codegen from protoc, run the following command from the root of the
repository:
```shell
make protogen
```

And to run k8s CRD generation, run the following command from the root of the repository:
```shell
make crds
```

Finally, should you wish to modify any of the resulting codegen files (ending
in` .pb.go`), do not modify them directly. Instead, you can edit the files in
`cmd/protoc-gen-go-tetragon` and then re-run `make protogen`.

## Running vendor

Tetragon uses multiple modules to separate the main module, from `api` from
`pkg/k8s`. Depending on your changes you might need to vendor those changes,
you can use:

```shell
make vendor
```

Note that the `make protogen` and `make crds` commands already vendor
changes automatically.

## Building and running a Docker image

The base kernel should support [BTF](https://github.com/cilium/tetragon#btf-requirement)
Expand Down
57 changes: 56 additions & 1 deletion docs/content/en/docs/contribution-guide/making-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,63 @@ description: "Learn how to make your first changes to the project"

7. Build Tetragon with your changes included.

## Making changes to documentation

To improve Tetragon documentation ([https://tetragon.io/](https://tetragon.io/)), please follow the
[documentation contribution guide](/docs/contribution-guide/documentation).

## Adding dependencies

Tetragon vendors Go dependencies. If you add a new Go dependency (`go.mod`), run:

```shell
make vendor
```

Most dependencies are updated automatically using Renovate. If this is not the desired behavior, you will need to
update the Renovate configuration (`.github/renovate.json5`).

## Making changes to protobuf API

Tetragon contains a protobuf API and uses code generation based on protoc to generate large amounts of boilerplate
code. Whenever you make changes to these files (`api/`) you need to run code generation:

```shell
make protogen
```

Should you wish to modify any of the resulting codegen files (ending in `.pb.go`), do not modify them directly.
Instead, you can edit the files in `tools/protoc-gen-go-tetragon/` and then re-run `make protogen`.

## Making changes to CRDs

Kubernetes Custom Resource Definitions (CRDs) are defined using Kubebuilder framework and shipped with generated Go
client and helpers code. They are also included in the Helm chart for easy installation. Whenever you make changes to
these files (`pkg/k8s/`), you need to run code generation:

```shell
make crds
make -C install/kubernetes tetragon/crds-yaml
```

## Making changes to Helm chart

If you make changes to the Helm values (`install/kubernetes/tetragon/values.yaml`), you need to update the generated
Helm values reference:

```shell
make -C install/kubernetes docs
```

## Making changes to Prometheus metrics

If you add, change or delete metrics, you need to update the generated metrics reference:

```shell
make metrics-docs
```

## What's next

- See how to [run the tests of the project](/docs/contribution-guide/running-tests/).
- See how to [submit your first pull request](/docs/contribution-guide/submitting-a-pull-request/).

0 comments on commit b1bf723

Please sign in to comment.