fluxcd/helm-operator-get-started

Docker Images Filtering Question

leoblanc opened this issue · 4 comments

Hello Stefan, first of all, thanks for your work. We are testing the Helm Flux operator and works very well. We are using the following image: quay.io/weaveworks/helm-operator:0.2.1. Actually, this GitHub issue I'm creating is more like a question than a bug report (I think).

This is our scenario: we have created 2 namespaces: prod and qa (under "namespaces"). Then, under the "releases" directories we have created 2 releases for the same application (one per each environment).

This is the "prod" release (I'm obfuscating the AWS account number, we are using ECR):

---
apiVersion: helm.integrations.flux.weave.works/v1alpha2
kind: FluxHelmRelease
metadata:
  name: hello-prod
  namespace: prod
  annotations:
    flux.weave.works/automated: "true"
    flux.weave.works/tag.hello: glob:master-*
  labels:
    chart: hello
spec:
  chartGitPath: hello
  releaseName: hello-prod
  values:
    image: 999999999999.dkr.ecr.us-west-2.amazonaws.com/eks-bgl_dev:master-v1
    persistence:
      enabled: false

This is the "qa" release:

---
apiVersion: helm.integrations.flux.weave.works/v1alpha2
kind: FluxHelmRelease
metadata:
  name: hello-qa
  namespace: qa
  annotations:
    flux.weave.works/automated: "true"
    flux.weave.works/tag.hello: glob:qa-*
  labels:
    chart: hello
spec:
  chartGitPath: hello
  releaseName: hello-qa
  values:
    image: 999999999999.dkr.ecr.us-west-2.amazonaws.com/eks-bgl_dev:qa-v1
    persistence:
      enabled: false

So, manual upgrades (by editing the image version on the Yaml) works like a charm. Now we are trying to test the automated upgrades. For that reason we have added the annotations "automated: true" and "tag.hello: glob--*"

What we can see is that Flux is not applying such filters. So, if you push a Docker image tagged as "master-v2", both the "prod" and "qa" deployments are automatically upgraded. If you push a new Docker image tagged as "qa-v2", both the "prod" and "qa" environments are also upgraded. What we want to do is just upgrade one of both environments at the same time, based on these annotations.

On the Flux logs I see something like this (some info obfuscated):

ts=2018-09-13T15:16:01.833847609Z caller=images.go:79 component=sync-loop service=test:fluxhelmrelease/hello container=chart-image [...] pattern=glob:* [...] info="added update to automation run" new=[...] reason="latest v1 (2018-09-13 11:37:08.020861429 +0000 UTC) > current v5 (2018-09-13 11:37:08.020861429 +0000 UTC)"

I see that it says "pattern=glob:*". I guess that here is where I should see my branch filter instead right?

I have been trying to emulate what you did at https://github.com/stefanprodan/gitops-helm/blob/master/releases/dev/podinfo.yaml for example. Do you think that my configuration is wrong? Or it can be a bug?

Thank you very much in advance.

Cheers,
Leo

The tag filter is wrong since the tag.hello would require a different values structure.

When you have values.image the filter should be flux.weave.works/tag.chart-image

If you want a named tag you need to change your values to:

  values:
    hello:
       image: 999999999999.dkr.ecr.us-west-2.amazonaws.com/eks-bgl_dev:qa-v1

@stefanprodan Great, thank you so much!

@leoblanc there is a flux channel on Weavework Slack, if you have any questions or ideas I'll be happy to talk there. Here is the invite link https://slack.weave.works

@stefanprodan Great! I will join that channel, thanks again!