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

fix: Allow annotation templates for services that need them #1182

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

brow86
Copy link

@brow86 brow86 commented Sep 10, 2024

What does this PR do?

This fixes #1181 by doing the following:

  • Adds a templateAnnotations value to default values file and keeps it as true to keep existing behavior
  • Updates deployment template to leverage the new boolean
  • Add true/false test cases

Motivation

This should help avoid issues with Hashicorp Vault and agent injection and any other service which uses templates as a part of its annotations.

More

  • Yes, I updated the tests accordingly
  • Yes, I ran make test and all the tests passed

@mloiseleur
Copy link
Contributor

I understand your needs. I'm not sure of the correct way to fix it and it seems a really specific needs.

The tpl has been introduced last year with #972 from @ivankatliarchuk .

Don't you have a way to "print" template code with tpl ?

@brow86
Copy link
Author

brow86 commented Sep 13, 2024

@mloiseleur - Point taken on this being a specific use case but I can see this potentially being a problem with any other service that does template interpolation with annotations which-- moving forward-- may be a lot more than just this one case. In other words, I'd be shocked if this doesn't break something else moving forward. As for solving it, the PR introduces a boolean to flip it off and defaults it to the default behavior of running tpl, does that work?

The only other thing I'll mention is that we use this on a lot of our helm charts and traefik is the first chart I've run into that templates the values out-of-the-box. Chart templates on other popular repos like grafana and the nginx don't template out-of-the-box so, while I agree it is helpful and should be kept in, many other charts don't currently do this.

@brow86
Copy link
Author

brow86 commented Sep 27, 2024

@mloiseleur - Wanted to poke this again. Is the purposed PR not viable? Is there another suggested approach?

@mloiseleur
Copy link
Contributor

@brow86 It's explained in the README:
image

AFAIK, without any PR, one can set its template using a Configmap with Vault and agent injection.

@brow86
Copy link
Author

brow86 commented Oct 4, 2024

AFAIK, without any PR, one can set its template using a Configmap with Vault and agent injection.

I guess the question then is whether the following changes takes this from being simple to complex:

  • one extra variable in the values file
  • an if/else in the template value
  • two additional test cases for the change

This doesn't feel like a heavy change but do those changes break the philosophy? More importantly: could that same logic be used to argue that the original change to template annotations broke that mold? Looking at other popular helm chart annotations in the community, it does not look like the annotations use the template function.

@mloiseleur mloiseleur changed the title fix: Allow annotation templates for services that need them #1181 fix: Allow annotation templates for services that need them Oct 9, 2024
@mloiseleur
Copy link
Contributor

mloiseleur commented Oct 11, 2024

I understand your point. It's true it's not a big change.

I added no-merge label, in order to see if there is an interest about this use case.

We will reevaluate as people respond.

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

Successfully merging this pull request may close these issues.

Traefik and templating of pod annotations errors with Hashicorp Vault
2 participants