cert-manager/make
Ashley Davis 7ea4496dcb
Gracefully handle 404s when fetching old CRDs
If we're in the middle of a cert-manager release we'll have a git tag
created for that release, but won't have a GitHub release created yet.
That means that an attempt to download old CRDs for our versionchecker
test will fail for that version, with a 404 error.

An alternative approach would be to use the GitHub API to query for
existing non-draft releases - but that introduces a new point of failure
whereby we can easily hit a rate limit, or else introduces the need for
a GitHub API token.

The GitHub API also has the issue that it doesn't present every release
in one API call, which complicates fetching releases using curl and uses
even more rate-limit capacity.

The approach here is simple; we ignore tags for which the release 404s,
download manifests for which the release gives a 200, and bubble up any
other errors.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-03-30 15:16:17 +01:00
..
config make: add "make e2e-setup-kind-update-images" 2022-03-29 11:26:37 +02:00
base_images.mk bump base images to latest versions 2022-03-25 12:04:34 +00:00
ci.mk make: add the targets 'e2e-setup-kind', 'e2e-setup-kind', and 'e2e' 2022-03-13 12:32:08 +01:00
cluster.sh make: add "make e2e-setup-kind-update-images" 2022-03-29 11:26:37 +02:00
cmctl.mk make: tools version is now properly switched when switching branches 2022-03-25 18:03:35 +01:00
containers.mk make: add the targets 'e2e-setup-kind', 'e2e-setup-kind', and 'e2e' 2022-03-13 12:32:08 +01:00
e2e-setup.mk make: avoid the message "warning: undefined variable 'CI'" 2022-03-30 11:04:10 +02:00
e2e.sh make/e2e.sh: raise concurrency from 10 to 20 2022-03-29 10:45:08 +02:00
git.mk
help.mk make: add the targets 'e2e-setup-kind', 'e2e-setup-kind', and 'e2e' 2022-03-13 12:32:08 +01:00
licenses.mk
manifests.mk use absolute path of cmrel 2022-03-29 11:26:52 +01:00
README.md docs: suggest -j8 instead of -j to avoid fork bombs 2022-03-16 14:05:07 +01:00
release.mk make: in CI, copy binaries from "bin/downlaoded" to "bin/tools" 2022-03-25 18:01:54 +01:00
server.mk make: add the targets 'e2e-setup-kind', 'e2e-setup-kind', and 'e2e' 2022-03-13 12:32:08 +01:00
test.mk Gracefully handle 404s when fetching old CRDs 2022-03-30 15:16:17 +01:00
tools.mk use absolute path of cmrel 2022-03-29 11:26:52 +01:00

Development tooling

This directory contains tools and scripts used to create development and testing environments for cert-manager.

Tool dependencies

The scripts in this directory commonly require additional tooling, such as access to kubectl, helm, kind and a bunch of other things.

If you already have these tools available on your host system, the scripts should just work, so long as the versions you have installed are roughly compatible.

If you are running into issues with your host-installed tools, you can have them downloaded in bin/tools with the command:

# With "-j8", the tools are downloaded in parallel.
make -j8 tools

To setup your shell to use the tools, run the following from the root of the repository:

export PATH="$PWD/bin/tools:$PATH"

Tip: this change of PATH won't persist between shell sessions. To get this command executed automatically when you enter the cert-manager folder, put this command in an .envrc file in the cert-manager folder and install direnv.

Common usages

This section describes common usage patterns for development and testing.

Installing a development build of cert-manager

Once you have a kind cluster running, you can install a development version of cert-manager by running:

make -j8 e2e-setup-certmanager

This will create a kind cluster, build, load and install cert-manager from source into your kind development cluster.

Further invocations of this command will rebuild and upgrade the installed version of cert-manager, making it possible to iteratively work on the codebase and test changes.

Running end-to-end tests

Before running the end-to-end tests, you must install some additional components used during the tests into your kind cluster.

Run the following to setup cert-manager, Pebble, ingress-nginx, the sample DNS01 webhook and all the other components required for the end-to-end tests:

make -j8 e2e-setup

You only need to run this command once for the lifetime of your test cluster.

Finally, run the end-to-test tests using:

make e2e

You can run this command multiple times against the same cluster without adverse effects.

A common use-case is to run a single test case from the end-to-end tests. This is explained in the --help:

./make/e2e.sh --help

Deleting the test cluster

Once you have finished with your testing environment, or if you have encountered a strange state you cannot recover from, you can tear down the testing environment by using kind directly:

kind delete cluster [--name=$KIND_CLUSTER_NAME]