Skip to content

Commit

Permalink
Merge pull request #1631 from camilamacedo86/new-target-devel
Browse files Browse the repository at this point in the history
doc: add makefile helpers
  • Loading branch information
k8s-ci-robot committed Aug 14, 2020
2 parents ac7b576 + fa400ee commit 9ae42de
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
- [Configuring EnvTest](./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` |
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)

0 comments on commit 9ae42de

Please sign in to comment.