Browse Source

Add automated image update examples to docs (#2369)

Add automated image update examples to docs
Hidde Beydals 10 months ago
parent
commit
501c3d206a
No account linked to committer's email address
2 changed files with 88 additions and 0 deletions
  1. 87
    0
      docs/references/automated-image-update.md
  2. 1
    0
      docs/references/index.rst

+ 87
- 0
docs/references/automated-image-update.md View File

@@ -0,0 +1,87 @@
1
+# Automated deployment of new container images
2
+
3
+Flux can be used to automate container image updates in your cluster.
4
+Flux periodically scans the pods running in your cluster and builds a list of all container images.
5
+Using the image pull secrets, it connects to the container registries, pulls the images metadata
6
+and stores the image tag list in memcached.
7
+
8
+You can enable the automate image tag updates by annotating your deployments, statefulsets,
9
+daemonsets or cronjobs objects. You can also control what tags should be considered for an
10
+update by using glob, regex or semantic version expressions.
11
+
12
+> **Note:** that Flux only works with immutable image tags (`:latest` is not supported).
13
+Every image tag must be unique, for this you can use the Git commit SHA or semver when tagging images.
14
+
15
+## Examples
16
+
17
+What follows is a list of examples on how you can control the image update automation. If you're using Helm releases 
18
+please see the [Helm operator integration docs](helm-operator-integration.md).
19
+
20
+Turn on automation based on timestamp:
21
+
22
+```yaml
23
+apiVersion: apps/v1
24
+kind: Deployment
25
+metadata:
26
+  annotations:
27
+    fluxcd.io/automated: "true"
28
+spec:
29
+  template:
30
+    spec:
31
+      containers:
32
+      - name: app
33
+        image: docker.io/org/my-app:1.0.0
34
+```
35
+
36
+The above configuration will make Flux update the `app` container when you push
37
+a new image tag, be it `my-app:1.0.1` or `my-app:9e3bdaf`.
38
+
39
+Restrict image updates with sem ver:
40
+
41
+```yaml
42
+apiVersion: apps/v1
43
+kind: Deployment
44
+metadata:
45
+  annotations:
46
+    fluxcd.io/automated: "true"
47
+    fluxcd.io/tag.app: semver:~1.0
48
+spec:
49
+  template:
50
+    spec:
51
+      containers:
52
+      - name: app
53
+        image: docker.io/org/my-app:1.0.0
54
+```
55
+
56
+The above configuration will make Flux update the image when you push
57
+an image tag that matches the [semantic version](https://semver.org/)
58
+expression e.g `my-app:1.0.1` but not `my-app:1.2.0`. 
59
+
60
+Restrict image updates with glob and regex expressions:
61
+
62
+```yaml
63
+apiVersion: apps/v1
64
+kind: Deployment
65
+metadata:
66
+  annotations:
67
+    fluxcd.io/automated: "true"
68
+    fluxcd.io/tag.sidecar: regex:^stg.*
69
+    fluxcd.io/tag.app: glob:dev-*
70
+spec:
71
+  template:
72
+    spec:
73
+      containers:
74
+      - name: sidecar
75
+        image: docker.io/org/my-proxy:stg-4s7bsgv
76
+      - name: app
77
+        image: docker.io/org/my-app:dev-9e3bdaf
78
+```
79
+
80
+The above configuration will make Flux update the `sidecar` when you push
81
+a tag for the `my-proxy` image that begins with `stg`.
82
+For the `app` container, Flux will update it when you push a tag for the
83
+`my-app` image that begins with `dev-`.
84
+
85
+To target a specific container the annotation format is `fluxcd.io/tag.<CONTAINER>: <TYPE>:<EXPRESSION>`.
86
+
87
+You can turn off the automation with `fluxcd.io/automated: "false"` or with `fluxcd.io/locked: "true"`.

+ 1
- 0
docs/references/index.rst View File

@@ -13,5 +13,6 @@ References
13 13
    fluxyaml-config-files
14 14
    garbagecollection
15 15
    git-gpg
16
+   automated-image-update
16 17
    helm-operator-integration
17 18
    monitoring

Loading…
Cancel
Save