From 4feb94ca099746e3a90106522b920a77cfe77ce0 Mon Sep 17 00:00:00 2001 From: Artem Chernyshev Date: Wed, 29 May 2024 17:44:14 +0300 Subject: [PATCH] feat: add multidoc check to the Talos quirks module Make it report true for Talos >= 1.5.0. Signed-off-by: Artem Chernyshev --- pkg/machinery/imager/quirks/quirks.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/machinery/imager/quirks/quirks.go b/pkg/machinery/imager/quirks/quirks.go index 7d516e9ffc..5c942e8b2e 100644 --- a/pkg/machinery/imager/quirks/quirks.go +++ b/pkg/machinery/imager/quirks/quirks.go @@ -74,3 +74,15 @@ func (q Quirks) UseZSTDCompression() bool { return q.v.GTE(minVersionZstd) } + +var minVersionMultidoc = semver.MustParse("1.5.0") + +// SupportsMultidoc returns true if the Talos version supports multidoc machine configs. +func (q Quirks) SupportsMultidoc() bool { + // if the version doesn't parse, we assume it's latest Talos + if q.v == nil { + return true + } + + return q.v.GTE(minVersionMultidoc) +}