From 292d457124b677029b8268efb66ba5b52ef79fe2 Mon Sep 17 00:00:00 2001 From: Michael Bridgen Date: Tue, 28 Jul 2020 07:54:00 +0100 Subject: [PATCH] Fill out run-through in README.md The README now gives a full run-through, starting with installing the controllers, and ending with the automation making a commit. --- README.md | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 167 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d563420..61af7ad 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,174 @@ or, in a clone of this repository, ## How to use it - TODO +Here is a quick example of configuring an automation. I'm going to use +[cuttlefacts-app][cuttlefacts-app-repo] because it's minimal and +thereby, easy to follow. + +### Image policy + +[The deployment][cuttlefacts-app-deployment] in cuttlefacts-app uses +the image `cuttlefacts/cuttlefacts-app`. We'll automate that so it +gets updated when there's a semver-tagged image, e.g., +`cuttlefacts/cuttlefacts-app:v1.0.0`. + +Keeping track of the most recent image takes two resources: an +`ImageRepository`, to scan DockerHub for the image's tags, and an +`ImagePolicy`, to give the particular policy for selecting an image +(here, a semver range). + +The `ImageRepository`: + +```bash +$ cat > image.yaml < policy.yaml < known_hosts + ssh-keygen -l -f known_hosts + +Check that the fingerprint matches one [published by +GitHub][github-fingerprints]. + +Now you can make a secret with the deploy key and known_hosts file: + + kubectl create secret generic cuttlefacts-deploy --from-file=identity --from-file=known_hosts + +Those two filenames -- `identity` and `known_hosts` -- are what the +source controller library code expects, which makes it easier for the +automation controller to use the `GitRepository` type. + +You also need to install the deploy key in GitHub. Copy it from +`identity.pub` (that's the _public_ part of the key): + +```bash +$ cat identity.pub +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDKM2wTSz5VyL2UCLh3ke9XUO1WUmAf +[...]w2FFnV24AGhWdP5lPOS/Jv64+OfMSF5E/e4dwVs= mikeb@laptop.lan +``` + +... and add under `Settings / Deploy keys` for your fork on GitHub, +giving it write access. + +Now you can create a `GitRepository` which will provide access to the +git repository within the cluster. Remember to change the URL; it's +probably easiest, if you're copying & pasting, to run the following +then edit `repo.yaml` afterwards. + +```bash +$ cat > repo.yaml < update.yaml <