Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current Alerting template functions are very few and make it hard to do any kind of re-mapping/arithmetic for your templates. I found myself unable to do basic counters or uniques on lists for my alert groups.
This PR adds in the Sprig template pack which is used by many projects to add some basic useful arithmetic, dictionary, list, etc functions. You can find more info here:
http://masterminds.github.io/sprig/
This implementation adds the
alertmanager
functions after to make sure to overwrite any conflicts and keep all current templates stable.Here is also an example of where Helm is also importing these functions:
https://github.com/helm/helm/blob/main/pkg/engine/funcs.go#L44
I have also disable the env calls due to potential security risks (same as Helm).
With this addition I was able to spin up local Grafana and create a workable template like:
This is really nice for our usage and would be a great addition to our team.