I'd like a Template to be able to use information the Agent collects during discovery/inventory (in-band attributes) — for example, reacting to something about the live hardware rather than only what was known when the Hardware object was created. Tracing through the code, I don't think this is actually possible today, and want to check that before assuming it's a real gap.
- Templates render once, at Workflow creation, using the Hardware object as it exists at that moment.
- The Agent's attributes only get written to the
tinkerbell.org/agent-attributes annotation later, on its first GetAction call — after the Template has already rendered.
So a Hardware object's first-ever Workflow renders with nothing in the annotation yet — nothing has reported anything. Any later Workflow against the same Hardware does see an annotation, but it's whatever an earlier run's Agent reported, not the one about to happen. I don't think a Template can ever use this data for the run that's actually producing it, only (at best) a stale snapshot from a previous one.
Checked around (issues/PRs/discussions, including closed) and didn't find this discussed — #636 introduced the annotation but for bookkeeping/UI purposes, not template consumption, and #844/#845 are about the separate out-of-band path.
An idea for fixing it, if this is a real gap worth closing: defer Template rendering from Workflow creation to the Agent's first check-in instead, so the render actually has access to whatever the Agent just reported. The tradeoff that gives me pause: right now a broken Template fails immediately at Workflow creation, before anything boots. Deferred, that same mistake would only surface after a real boot attempt. Wanted to raise the idea before going further, since it'd change when every Workflow renders, not just ones that would use this.
I'd like a Template to be able to use information the Agent collects during discovery/inventory (in-band attributes) — for example, reacting to something about the live hardware rather than only what was known when the Hardware object was created. Tracing through the code, I don't think this is actually possible today, and want to check that before assuming it's a real gap.
tinkerbell.org/agent-attributesannotation later, on its firstGetActioncall — after the Template has already rendered.So a Hardware object's first-ever Workflow renders with nothing in the annotation yet — nothing has reported anything. Any later Workflow against the same Hardware does see an annotation, but it's whatever an earlier run's Agent reported, not the one about to happen. I don't think a Template can ever use this data for the run that's actually producing it, only (at best) a stale snapshot from a previous one.
Checked around (issues/PRs/discussions, including closed) and didn't find this discussed — #636 introduced the annotation but for bookkeeping/UI purposes, not template consumption, and #844/#845 are about the separate out-of-band path.
An idea for fixing it, if this is a real gap worth closing: defer Template rendering from Workflow creation to the Agent's first check-in instead, so the render actually has access to whatever the Agent just reported. The tradeoff that gives me pause: right now a broken Template fails immediately at Workflow creation, before anything boots. Deferred, that same mistake would only surface after a real boot attempt. Wanted to raise the idea before going further, since it'd change when every Workflow renders, not just ones that would use this.