Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Add automated image update examples to docs
Browse files Browse the repository at this point in the history
Use `fluxcd.io` annotations instead of `flux.weave.works`
  • Loading branch information
stefanprodan committed Aug 16, 2019
1 parent 368b5de commit d610d6e
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 6 deletions.
89 changes: 89 additions & 0 deletions docs/references/automated-image-update.md
@@ -0,0 +1,89 @@
# Automated deployment of new container images

Flux can be used to automate container image updates in your cluster.
Flux periodically scans the pods running in your cluster and builds a list of all container images.
Using the image pull secrets, it connects to the container registries, pulls the images metadata
and stores the image tag list in memcached.

You can enable the automate image tag updates by annotating your deployments, statefulsets,
daemonsets or cronjobs objects. You can also control what tags should be considered for an
update by using glob, regex or semantic version expressions.

**Note** that Flux only works with immutable image tags (`:latest` is not supported).
Every image tag must be unique, for this you can use the Git commit SHA or semver when tagging images.

## Examples

What follows is a list of examples on how you can control the image update automation.

Turn on automation based on timestamp:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
fluxcd.io/automated: "true"
spec:
template:
spec:
containers:
- name: app
image: docker.io/org/my-app:1.0.0
```

The above configuration will make Flux update the `app` container when you push
a new image tag, be it `my-app:1.0.1` or `my-app:9e3bdaf`.

Restrict image updates with sem ver:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
fluxcd.io/automated: "true"
fluxcd.io/tag.app: semver:~1.0
spec:
template:
spec:
containers:
- name: app
image: docker.io/org/my-app:1.0.0
```

The above configuration will make Flux update the image when you push
an image tag that matches the [semantic version](https://semver.org/)
expression e.g `my-app:1.0.1` but not `my-app:1.2.0`.

Restrict image updates with glob and regex expressions:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
fluxcd.io/automated: "true"
fluxcd.io/tag.sidecar: regex:^stg.*
fluxcd.io/tag.app: glob:dev-*
spec:
template:
spec:
containers:
- name: sidecar
image: docker.io/org/my-proxy:stg-4s7bsgv
- name: app
image: docker.io/org/my-app:dev-9e3bdaf
```

The above configuration will make Flux update the `sidecar` when you push
a tag for the `my-proxy` image that begins with `stg`.
For the `app` container, Flux will update it when you push a tag for the
`my-app` image that begins with `dev-`.

To target a specific container the annotation format is `fluxcd.io/tag.<CONTAINER>: <TYPE>:<EXPRESSION>`.

You can turn off the automation with `fluxcd.io/automated: "false"` or with `fluxcd.io/locked: "true"`.



12 changes: 6 additions & 6 deletions docs/references/helm-operator-integration.md
Expand Up @@ -91,8 +91,8 @@ Top level image example:
kind: HelmRelease
metadata:
annotations:
flux.weave.works/automated: "true"
flux.weave.works/tag.chart-image: semver:~4.0
fluxcd.io/automated: "true"
fluxcd.io/tag.chart-image: semver:~4.0
spec:
values:
image:
Expand All @@ -106,10 +106,10 @@ Sub-section images example:
kind: HelmRelease
metadata:
annotations:
flux.weave.works/automated: "true"
flux.weave.works/tag.prometheus: semver:~2.3
flux.weave.works/tag.alertmanager: glob:v0.15.*
flux.weave.works/tag.nats: regex:^0.6.*
fluxcd.io/automated: "true"
fluxcd.io/tag.prometheus: semver:~2.3
fluxcd.io/tag.alertmanager: glob:v0.15.*
fluxcd.io/tag.nats: regex:^0.6.*
spec:
values:
prometheus:
Expand Down
1 change: 1 addition & 0 deletions docs/references/index.rst
Expand Up @@ -13,5 +13,6 @@ References
fluxyaml-config-files
garbagecollection
git-gpg
automated-image-update
helm-operator-integration
monitoring

0 comments on commit d610d6e

Please sign in to comment.