From: "Lukas Wagner" <l.wagner@proxmox.com>
To: "Proxmox VE development discussion" <pve-devel@lists.proxmox.com>,
"Thomas Lamprecht" <thomas@lamprecht.org>,
"Gabriel Goller" <g.goller@proxmox.com>
Cc: pve-devel <pve-devel-bounces@lists.proxmox.com>
Subject: Re: [pve-devel] [RFC network/ve-rs 0/8] Template-based FRR config generation
Date: Thu, 09 Oct 2025 11:57:05 +0200 [thread overview]
Message-ID: <DDDPABIGTGVG.1BCGFT7QVV2TD@proxmox.com> (raw)
In-Reply-To: <ffe63d3f-d4ac-468d-b759-0cc9b277cc24@proxmox.com>
On Tue Oct 7, 2025 at 5:09 PM CEST, Stefan Hanreich wrote:
> Alternatively, there's the Northbound API [4] which uses YANG for its
> configuration language, but it doesn't seem ready yet and lacks support
> for e.g. bgpd.
>
>> The third option of using two template engines is naturally also one, but actively
>> and knowingly planing a schism is not something I'd promote much either tbh.
>
> Fully agree that using one templating engine across all our codebase
> instead of using FOTM templating language seems far better. I don't
> think minijinja could bring any upside that would outweigh that.
>
Some thoughts from my side.
From what I've seen so far, minijinja seems quite promising. It wasn't
really on my radar when I implemented the initial version of the
notification stack -- we already used handlebars in PBS and minijinja
was not released yet (or in a rather early version).
While it would be a bit of work, I would generally be okay with the
idea of switching to minijinja in the long term. At this moment,
handlebars is used for the following parts of the notification stack:
- Notification title/body
- Webhook headers and body
For some transition period we would need to support both engines. For
the notification body/title we could decide which engine to use based on
the template filename extension (either .hbs or .j2). For the webhook
body, where the template string is part of the configuration, we would
probably need to add a configuration flag which allows the user to
choose between Handlebars syntax and jinja syntax.
Some of the benefits I see with minijinja:
- minijinja provides a large number of built-in helpers [1], many of
which could be very useful when writing notification templates /
webhook body templates. For the current handlebars impl I've
implemented a tiny subset of these by hand (escape, json, etc.).
Indeed, just today I've helped a user in the forum [2] for which the
'map' function could be potentially useful, in order to set up a
custom severity mapping for their webhook body payload.
In bugzilla, somebody has also requested a 'truncate' helper to limit
the webhook body length; this one would also come for free with
minijinja.
- I don't have concrete evidence to support this, but I'd assume the
average sysadmin is likely to be more familiar with the j2 syntax than
the Handlebars one, mostly due to the popularity of Ansible.
- The minijinja maintainer is the same person as the original author of
jinja [3] - so the chances of syntax incompatibilities between
minijinja and the reference implementation should hopefully be small.
On the other hand, with handlebars-rs, we recently ran into breaking
changes in template rendering when switching to a new major version,
which was due to the handlebars-rs fixing inconsistencies with the
reference implementation (JS) [4].
- minijinja explicitly supports being compiled to WebAssembly. Could be
useful in the future for having a 'notification template editor' with
a rendered preview and/or live syntax checking for the template.
(That being said, seems like handlebars-rs also supports
wasm-compilation now, so this is not really a deciding factor
anymore)
Some of the downsides:
- As mentioned above, additional work to support a second template
engine for a while
- Potential for user error/confusion in the transitory period (using the wrong
syntax in the wrong template type)
- Potential disruption for the user when we eventually phase out
handlebars. The number of users using custom notification templates
is probably rather small, but it seems like quite a lot of our
homelab users use the webhook integration.
[1] https://docs.rs/minijinja/latest/minijinja/filters/index.html#functions
[2] https://forum.proxmox.com/threads/webhook-notifications-empty-fields-and-pagerduty.173503/post-807200
[3] https://jinja.palletsprojects.com/en/stable/
[4] https://git.proxmox.com/?p=proxmox-backup.git;a=commit;h=085b6c0e5ea3ed2634657221dae5fa121a636541
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
prev parent reply other threads:[~2025-10-09 9:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-19 9:41 Gabriel Goller
2025-09-19 9:41 ` [pve-devel] [PATCH ve-rs 1/4] frr: add templates and structs to represent the frr config Gabriel Goller
2025-09-19 9:41 ` [pve-devel] [PATCH ve-rs 2/4] sdn-types: forward serialize to display for NET Gabriel Goller
2025-09-19 9:41 ` [pve-devel] [PATCH ve-rs 3/4] ve-config: fabrics: use new proxmox-frr structs to generate frr config Gabriel Goller
2025-09-19 9:41 ` [pve-devel] [PATCH ve-rs 4/4] tests: always prepend the frr delimiter/comment "!" to the block Gabriel Goller
2025-09-19 9:41 ` [pve-devel] [PATCH network 1/4] sdn: remove duplicate comment line '!' in frr config Gabriel Goller
2025-09-19 9:41 ` [pve-devel] [PATCH network 2/4] sdn: add trailing newline " Gabriel Goller
2025-09-19 9:41 ` [pve-devel] [PATCH network 3/4] sdn: tests: add missing comment '!' " Gabriel Goller
2025-09-19 9:41 ` [pve-devel] [PATCH network 4/4] tests: use Test::Differences to make test assertions Gabriel Goller
2025-10-03 15:46 ` [pve-devel] [RFC network/ve-rs 0/8] Template-based FRR config generation Gabriel Goller
2025-10-04 11:58 ` Thomas Lamprecht
2025-10-07 15:09 ` Stefan Hanreich
2025-10-09 9:57 ` Lukas Wagner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DDDPABIGTGVG.1BCGFT7QVV2TD@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=g.goller@proxmox.com \
--cc=pve-devel-bounces@lists.proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=thomas@lamprecht.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.