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

doc: add makefile helpers #1631

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
- [Using envtest in integration tests](./reference/envtest.md)

- [Metrics](./reference/metrics.md)
- [Makefile Helpers](makefile-helpers.md)

---

Expand Down
37 changes: 37 additions & 0 deletions docs/book/src/reference/makefile-helpers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Makefile Helpers

By default, the projects are scaffolded with a `Makefile`. You can customize and update this file as please you. Here, you will find some helpers that can be useful.

## To debug with go-delve

The projects are built with Go and you have a lot of ways to do that. One of the options would be use [go-delve](https://github.com/go-delve/delve) for it:

```sh
# Run with Delve for development purposes against the configured Kubernetes cluster in ~/.kube/config
# Delve is a debugger for the Go programming language. More info: https://github.com/go-delve/delve
run-delve: generate fmt vet manifests
go build -gcflags "all=-trimpath=$(shell go env GOPATH)" -o bin/manager main.go
dlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient exec ./bin/manager
```

## To change the version of CRDs

The tool generate the CRDs by using [controller-tools](https://github.com/kubernetes-sigs/controller-tools), see in the manifests target:

```sh
# Generate manifests e.g. CRD, RBAC etc.
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
```

In this way, update `CRD_OPTIONS` to define the version of the CRDs manifests which will be generated in the `config/crd/bases` directory:

```sh
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"
```

| CRD_OPTIONS | API version |
|--- |--- |
| `"crd:trivialVersions=true"` | `apiextensions.k8s.io/v1beta1` |
| `"crd:trivialVersions=true"` | `apiextensions.k8s.io/v1` |
Comment on lines +36 to +37

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these CRD_OPTIONS are the same

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The v1 value is : crd:crdVersions=v1.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 changes: 2 additions & 1 deletion docs/book/src/reference/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@
- [completion](completion.md)
- [Artifacts](artifacts.md)
- [Writing controller tests](writing-tests.md)
- [Metrics](metrics.md)
- [Metrics](metrics.md)
- [Makefile Helpers](makefile-helpers.md)