Flux for the IT4Change clusters, installed with helmfile from the community Helm chart — the same layout as IT4Change/prometheus.
This repo installs the Flux controllers and says which deployments a cluster runs
(clusters/<cluster>/). What a deployment consists of (HelmRelease, ImagePolicy, Receiver, …) lives
in that deployment's own repo.
Deployments are pulled by the cluster instead of pushed from GitHub, so no kubeconfig has to live on GitHub, not even sops-encrypted. A GitHub workflow only builds images and may send a webhook that says "check now"; Flux decides by each deployment's rollout rule whether a new version goes out.
helmfile -e default apply # staging cluster
helmfile -e production apply # production clusterCheck: kubectl -n flux-system get pods, or flux check with the Flux CLI.
The chart version is pinned in helmfile.yaml. Upgrading Flux means raising it there, reading the
chart's and Flux's release notes, and applying.
Each cluster has its own age key. Its private half is in environments/<env>.secrets.yaml
(sops-encrypted to the team's keys in .sops.yaml); the release puts it into the Secret
sops-age in flux-system, which a deployment's Kustomization names as its decryption key:
decryption:
provider: sops
secretRef:
name: sops-ageFor Flux to decrypt a deployment's Secrets, add the cluster's public key to that deployment's
.sops.yaml and re-encrypt (sops updatekeys <file>):
| Environment | Cluster | Public key |
|---|---|---|
default |
staging | age1nu7ls2fj54f7zmlj329zfx3smv098tz7y6shl9r0yxz5fl83243qv44mra |
production |
production | age19crepcun9rw5yrskfzu2gwlcrdn7egwz9skl9qk9g6s0an8ehsesns59f6 |
A new key for a cluster:
set env default # or production
set secret (age-keygen 2>/dev/null | string match "AGE-SECRET-KEY-*")
echo $secret | age-keygen -y # the public key, for the table above
printf "sops_age:\n AGE_KEY: %s\n" $secret \
| sops encrypt --filename-override environments/$env.secrets.yaml /dev/stdin \
> environments/$env.secrets.yaml
set -e secretThe release flux-sync (charts/flux-sync) makes Flux follow this repo: everything under
clusters/staging/ (environment default) or clusters/production/ is applied by Flux. Each
deployment has one file there, a GitRepository on its repo plus a Kustomization on its folder:
| Cluster | Deployment | Repo, folder |
|---|---|---|
| staging | paxfamily.social | IT4Change/paxfamily.social, flux/staging/ |
A new deployment is a commit here, nothing is applied by hand. Secrets in clusters/<cluster>/ are
named *.sops.yaml and are encrypted to the team and to that cluster's key (.sops.yaml).
The cluster holds no credential for GitHub: the deployments' repos are public, and Flux only reads them. Which image runs is written into the repo by the repo's own build workflow.
GitHub tells Flux "check now" at https://<webhook.DOMAIN>/hook/<path of the Receiver>
(environments/<env>.yaml.gotmpl; staging: deploy.it4c.org). The DNS name has to point at the
cluster's ingress. The certificate comes from Let's Encrypt (charts/flux-sync/templates/issuer.yaml)
and needs an ACME e-mail address in environments/<env>.secrets.yaml:
sops set environments/default.secrets.yaml '["acme"]["EMAIL"]' '"you@example.org"'Without webhook.DOMAIN there is no ingress, and Flux finds changes by polling.