Problem
Consider the following template:
version: '3.3'
services:
swarm-sync:
image: nginx:{{ nginx_tag }}
deploy:
labels:
- "swarm-sync.managed=true"
- "swarm-sync.image-pattern={{ nginx_tag_pattern }}"
We want the following:
-
swarm-pack can deploy it manually, and fill the value for nginx_tag (nginx_tag_pattern could be optional) from static values
-
swarm-sync can deploy it using swarm-pack, it could get the value of nginx_tag using the pattern to get the lastest tag
-
swarm-sync should be able to keep the image up to date later using the pattern (for now, it is in the label swarm-sync.image-pattern)
Using the current strategy, we define the stack file like this:
packs:
- pack: nginx
values:
my_value: foo
nginx_tag_pattern: 1.4.*
autovalues:
nginx_tag:
type: image_tag_pattern
image: nginx
tag_pattern: 1.4.*
(n.b. autovalues represents types of values which can be created automatically based on the type and other values. In this case it is image_tag_pattern type which means it will hit docker registry for the latest value.
Problem: tag_pattern: 1.4.* & nginx_tag_pattern: 1.4.* are duplicates, and could be a problem when we change it we must remember to change it in both places.
More interesting stuff from Flux:
If the chart you're using in a HelmRelease lets you specify the particular images to run, you will usually be able to update them with Flux, the same way you can with Deployments and so on.
Flux interprets certain commonly used structures in the values section of a HelmRelease as referring to images. The following are understood (showing just the values section):
These can appear at the top level (immediately under values:), or in a subsection (under a key, itself under values:). Other values may be mixed in arbitrarily. Here's an example of a values section that specifies two images, along with some other configuration: