Skip to content
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
16 changes: 5 additions & 11 deletions deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@ The Tracker project uses [Flux](https://fluxcd.io/), to enable [pull based](http

The directory here is laid out to allow the patching of a basic flux install. It is based on [the example](https://docs.fluxcd.io/en/1.18.0/tutorials/get-started-kustomize.html) in the documentation.

## Creating credentials for Flux

Tracker uses SSH deploy keys, and uses kustomize to [generate secrets](https://github.com/kubernetes-sigs/kustomize/blob/master/examples/secretGeneratorPlugin.md#secret-values-from-local-files). To create the keys, use the following commands.

```bash
ssh-keygen -q -N "" -C "flux-read-only" -f ./deploy/creds/readonly/identity
ssh-keyscan github.com > ./deploy/creds/readonly/known_hosts
```

With keys in hand, take the output of `cat deploy/creds/readonly/identity.pub` and [add a new deploy key](https://github.com/canada-ca/tracker/settings/keys/new) to the Tracker repo. Obviously only select "Allow write access" if you are creating a read/write key to allow Flux to automate deployments. Typically we'd only want read/write in production, and everything else using read.

## Testing config changes

Config changes can be pretty high impact, so trying it out somewhere is pretty useful. To that end, we have a few ways to bring up a "non-prod" version of the app; basically, using a self signed cert and requesting its own IP address.
Expand Down Expand Up @@ -51,11 +40,16 @@ kustomize build deploy/aks | kubectl apply -f -

Deploying to prod is a little anticlimactic. You'll want some read/write credentials for Flux so that it can [update our config](https://toolkit.fluxcd.io/components/image/imageupdateautomations/#update-strategy) with new image tags, but everything else is the same.

Tracker uses SSH deploy keys to allow those updates, and uses kustomize to [generate secrets](https://github.com/kubernetes-sigs/kustomize/blob/master/examples/secretGeneratorPlugin.md#secret-values-from-local-files). To create the keys, use the following commands.

```bash
ssh-keygen -q -N "" -C "flux-read-write" -f ./deploy/creds/readwrite/identity
ssh-keyscan github.com > ./deploy/creds/readwrite/known_hosts
```

[Add the new deploy key](https://github.com/canada-ca/tracker/settings/keys/new) to the Tracker repo, and select "Allow write access".
After that it's basically the same:

```bash
kustomize build platform/creds/prod | kubectl apply -f -
kustomize build app/creds/prod | kubectl apply -f -
Expand Down
2 changes: 0 additions & 2 deletions deploy/aks/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ resources:
patchesStrategicMerge:
- app-kustomization.yaml
- platform-kustomization.yaml
components:
- ../creds/readonly
4 changes: 1 addition & 3 deletions deploy/bases/tracker-repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ spec:
interval: 1m0s
ref:
branch: master
secretRef:
name: flux-credentials
url: ssh://git@github.com/canada-ca/tracker
url: https://github.com/canada-ca/tracker

13 changes: 0 additions & 13 deletions deploy/creds/readonly/kustomization.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions deploy/gke/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ resources:
- api-image-policy.yaml
- frontend-image-policy.yaml
- update-automation.yaml
components:
- ../creds/readwrite
patches:
- path: tracker-repo.yaml
14 changes: 14 additions & 0 deletions deploy/gke/tracker-repo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
name: tracker
namespace: flux-system
spec:
interval: 1m0s
ref:
branch: master
secretRef:
name: flux-credentials
url: ssh://git@github.com/canada-ca/tracker

2 changes: 0 additions & 2 deletions deploy/minikube/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ resources:
patchesStrategicMerge:
- app-kustomization.yaml
- platform-kustomization.yaml
components:
- ../creds/readonly
2 changes: 0 additions & 2 deletions deploy/test/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ resources:
patchesStrategicMerge:
- app-kustomization.yaml
- platform-kustomization.yaml
components:
- ../creds/readonly