From c71dddcc3a32bf613dedabf0bb3a8980ad86986e Mon Sep 17 00:00:00 2001 From: Simon Kirsten <1972314+skirsten@users.noreply.github.com> Date: Mon, 31 Jul 2023 22:36:23 +0200 Subject: [PATCH] Add support for `{{ template "base" . }}` in etc/containerd/config.toml.tmpl (#7991) Signed-off-by: Simon Kirsten (cherry picked from commit 546dc247a09d8710c8748a492f435cefe7c4e7a1) Signed-off-by: Brad Davidson --- pkg/agent/templates/templates_linux.go | 1 + pkg/agent/templates/templates_windows.go | 1 + 2 files changed, 2 insertions(+) diff --git a/pkg/agent/templates/templates_linux.go b/pkg/agent/templates/templates_linux.go index 2cd4516f1cfa..4d0c52fc42a6 100644 --- a/pkg/agent/templates/templates_linux.go +++ b/pkg/agent/templates/templates_linux.go @@ -131,6 +131,7 @@ enable_keychain = true func ParseTemplateFromConfig(templateBuffer string, config interface{}) (string, error) { out := new(bytes.Buffer) t := template.Must(template.New("compiled_template").Parse(templateBuffer)) + template.Must(t.New("base").Parse(ContainerdConfigTemplate)) if err := t.Execute(out, config); err != nil { return "", err } diff --git a/pkg/agent/templates/templates_windows.go b/pkg/agent/templates/templates_windows.go index ce7190d34351..f52b5edbd7f0 100644 --- a/pkg/agent/templates/templates_windows.go +++ b/pkg/agent/templates/templates_windows.go @@ -179,6 +179,7 @@ func ParseTemplateFromConfig(templateBuffer string, config interface{}) (string, }, } t := template.Must(template.New("compiled_template").Funcs(funcs).Parse(templateBuffer)) + template.Must(t.New("base").Parse(ContainerdConfigTemplate)) if err := t.Execute(out, config); err != nil { return "", err }