Templating in Helm Values Files

Issue

Helm does not support templating within values files, even though it can significantly improve the readability and maintainability of charts in some cases.

For example, default values might depend on other values or chart metadata.

Solution

  • A helper template is included in each chart template to expand the values (unfortunately, Helm does not support pre-render hooks to run a template first).
  • The template recursively applies the tpl function to values until no further changes occur
  • The number of iterations is limited. If the limit is exceeded, templating fails to prevent infinite loops caused by circular references.

Telegram Notifications From AlertManager With Respect to 4096 Chars Limit

Issue

  • Telegram API has limit of 4096 characters per message
  • AlertManager sending notifications truncates text of message to fit this limit
  • As result markdown(or HTML depending on the parse_mode specified in telegram_configs of AlertManager config) may be broken and telegram API responses with Status Code 400

Solution

Telegram notification template should generate message that is always less than 4096 characters and has consistent markdown/html

Template below:

  • Builds full notification message with all alerts
  • If it is too big falls back to less verbose single alert format (no labels)
  • If even with less verbose format the message appears to be too big
    • removes some alerts to fit the size limit (alerts are removed as a whole, so telegram does not complain about broken markdown)
    • add notice about truncation to the message