See Automate image updates to Git | Flux.
Note: There is an argocd-image-updater, but it is very specific to Argo CD and supports Helm and Kustomize only. Flux supports any YAML file and is agnostic regarding the deployment solution.
kubectl patch ImageRepository \
--namespace=flux-system "${IMAGE_REPOSITORY}" \
--type=json --patch='[{ "op": "add", "path": "/spec/suspend", "value": true }]'
kubectl patch ImageRepository \
--namespace=flux-system "${IMAGE_REPOSITORY}" \
--type=json --patch='[{ "op": "remove", "path": "/spec/suspend" }]'
See also Image Repositories | Flux - Suspending and resuming
kubectl patch ImageUpdateAutomation \
--namespace=flux-system parca-dev-demo-deployments \
--type=json --patch='[{ "op": "add", "path": "/spec/suspend", "value": true }]'
kubectl patch ImageUpdateAutomation \
--namespace=flux-system parca-dev-demo-deployments \
--type=json --patch='[{ "op": "remove", "path": "/spec/suspend" }]'
See also Image Update Automations | Flux
Based on Git Repositories - SSH authentication | Flux.
-
Generate a new SSH key pair:
ssh-keygen -b 4096 -N '' -C fluxcdbot -f fluxcdbot
-
Create a new secret in the cluster:
PATCH="$(jq --null-input --arg identity "$(<fluxcdbot)" '[{ "op": "replace", "path": "/data/identity", "value": "\($identity|@base64)" }]')" kubectl patch secret \ --namespace=flux-system flux-ssh-credentials \ --type=json --patch="${PATCH}"
-
Add the
fluxcdbot.pub
public key to the repository's deploy keys with write access.
kubectl get secret --namespace=flux-system flux-ssh-credentials --output=json \
| jq --raw-output '.data.identity|@base64d' \
| ssh-keygen -y -f /dev/stdin