fluxcd / flagger

Progressive delivery Kubernetes operator (Canary, A/B Testing and Blue/Green deployments)
https://docs.flagger.app
Apache License 2.0
4.86k stars 726 forks source link

Ability to exclude annotations #1337

Open adamstrawson opened 1 year ago

adamstrawson commented 1 year ago

Describe the feature

This might already exist, please point me in the direction if it does.

I'd like to be able to exclude (or include) specific annotation prefixes from being copied over to the primary deployments.

I noticed similar functionality exists for labels with --include-label-prefix but nothing exists for annotations.

For context, we're looking to use stakater/Reloader which allows us to reload pods when configmap and/or secrets change. This works well for us at the moment, and flagger also handles this gracefully too.

However, since Reloader is annotation based, the Reloader annotation config that we include in the original Deployment resource is then copied over to the Primary Deployment resource, meaning that when a configmap and/or secret changes, Reloader will patch both the Original and Primary Deployments at the same time as both will now include the annotation, whereas we would only want the Original Deployment to be patched (which would then trigger a Flagger rollout naturally)

I'd like to specify that Flagger should not include Reloader annotations, or similar to --include-label-prefix specify which annotations should be included.

Proposed solution

Replicate the behaviour of --include-label-prefix to a new argument --include-annotation-prefix

Happy to PR if you see value in this.

aryan9600 commented 1 year ago

Hi, while I think it should be fine to add such a flag, I fail to understand its requirement for your specific problem. Flagger can automatically trigger rollouts when a ConfigMap and/or Secret changes. Why would you want the original Deployment pods to be reloaded with the new ConfigMap or Secret, since the purpose of Flagger is to test the Deployment pods with the changes? For more info about how Flagger does this, please refer: https://fluxcd.io/flagger/usage/how-it-works/#canary-target

adamstrawson commented 1 year ago

Our usage of Reloader isn't specific to Deployments that are managed by Flagger, and we also have secrets and/or configmaps used by Deployments that aren't seen by Flagger too, which is why we have a need to handle rollouts outside of Flagger.

aryan9600 commented 1 year ago

i think we can go ahead with such a flag (even if not for your case, then for symmetry's sake). i'm slightly worried about the fact that this adds an extra flag (there are already too many), @stefanprodan wdyt?