Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support different labeling for canary and primary deployments #1115

Open
tetsundo opened this issue Feb 18, 2022 · 5 comments
Open

Support different labeling for canary and primary deployments #1115

tetsundo opened this issue Feb 18, 2022 · 5 comments

Comments

@tetsundo
Copy link

Describe the feature

Hi, I was wondering if there is a function to set different labels for canary and primary objects as per this proposed solution(#1032). I have a different problem than this, but the proposed solution was the same.
Unfortunately, the final update(#1092 ) wasn't what I was looking for.

I want to set different labels for canary and primary deployment to distinguish between those traffic.
In the current implementation, the primary object will be copied from the canary object with same labels after a canary analysis to promote the new version. There is no way to set different labels for primary objects.

Proposed solution

I want flagger to allow labels override on the primary deployment. As proposed in the other previous request(#1032), this would be a change to be the canary spec in a form similar to how service overrides work today.

  deployment:
    primary:
      annotations:
        key1: value1
      labels:
        key1: value1
@pclalv
Copy link

pclalv commented Aug 18, 2022

I was disappointed to discover that Flagger totally mangles my pod labels when it creates the -primary resources.

I was further disappointed to discover that Flagger's default behavior is to mangle the app.kubernetes.io/name label in a way that's inconsistent with the recommendations from the official k8s docs. in particular, Flagger's behavior is to append -primary to the value of that label, resulting in, for example, app.kubernetes.io/name: mysql-primary. it seems to me that it would be more consistent with the documentation to append -primary to the app.kubernetes.io/instance label (for example, app.kubernetes.io/instance: mysql-abcxyz-primary).

ultimately I would really like for Flagger to not mess with my labels at all, or i. I think that the most conservative labeling strategy that flagger could take would be to copy labels and selectors verbatim and transform them very specifically by adding a label like canary.flagger.io/primary: true or something. with this approach, my original labels would select both the canary and primary and resources, and then I could further select the primary only or canary only with the canary.flagger.io/primary label.

it would be a nice to have more control over this, or to be able to trust Flagger to make only additive, non-destructive changes to my sets of labels and selectors.

@eloo
Copy link

eloo commented Oct 26, 2022

Hi, just stumbled of this issue while working with Kyverno and here we see another use case for specific canary/primary labels.
As we want for example to not background check our canaries.. we are mostly interesting in checking the primaries with our Kyverno policies.
Using labels here to exclude the canaries would be the best solution for our use case.

@AshDerTest
Copy link

Hi

Just wanted to find out of there was any update to the above, as we are attempting to achieve a similar outcome.
I require the labels from my initial pod to be carried over into the primary and canary pods

@pizzqc
Copy link

pizzqc commented Jul 11, 2023

Is there a way to statically specify the labels we want in the deployment generated by Flagger for now? (i.e.: *-primary)

Our use-case is a label we need for the backstage kubernetes plugin that requires a label matching its selector. For example: backstage.io/kubernetes-id: greeter-service. The issue we are having now is that the only deployment that keeps the label properly is the one defined in our initial deployment (i.e.: the canary one) leaving the deployment *-primary with none of our labels.

I found there was some extra stuff added to the canary spec allowing us to configure the apex, primary and canary labels for kind=service that are managed by Flagger... maybe something similar for kind=deployments? (ref: #538)

@tferrari92
Copy link

Is there a way to statically specify the labels we want in the deployment generated by Flagger for now? (i.e.: *-primary)

Our use-case is a label we need for the backstage kubernetes plugin that requires a label matching its selector. For example: backstage.io/kubernetes-id: greeter-service. The issue we are having now is that the only deployment that keeps the label properly is the one defined in our initial deployment (i.e.: the canary one) leaving the deployment *-primary with none of our labels.

I found there was some extra stuff added to the canary spec allowing us to configure the apex, primary and canary labels for kind=service that are managed by Flagger... maybe something similar for kind=deployments? (ref: #538)

having the exact same issue. Did you find any solution for this? @pizzqc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants