From 74b24b47ecfffa13cb4673a733c5d1562e63ed3d Mon Sep 17 00:00:00 2001 From: elmer Date: Tue, 16 Aug 2022 15:35:10 +0800 Subject: [PATCH] add dataRoot configuration support for containerd --- pkg/container/module.go | 1 + pkg/container/templates/containerd_config.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/pkg/container/module.go b/pkg/container/module.go index 9a481553..3cb3a63f 100644 --- a/pkg/container/module.go +++ b/pkg/container/module.go @@ -201,6 +201,7 @@ func InstallContainerd(m *InstallContainerModule) []task.Interface { "InsecureRegistries": m.KubeConf.Cluster.Registry.InsecureRegistries, "SandBoxImage": images.GetImage(m.Runtime, m.KubeConf, "pause").ImageName(), "Auths": registry.DockerRegistryAuthEntries(m.KubeConf.Cluster.Registry.Auths), + "DataRoot": templates.DataRoot(m.KubeConf), }, }, Parallel: true, diff --git a/pkg/container/templates/containerd_config.go b/pkg/container/templates/containerd_config.go index ca4c55ea..1d2739ba 100644 --- a/pkg/container/templates/containerd_config.go +++ b/pkg/container/templates/containerd_config.go @@ -24,7 +24,11 @@ import ( var ContainerdConfig = template.Must(template.New("config.toml").Parse( dedent.Dedent(`version = 2 +{{- if .DataRoot }} +root = {{ .DataRoot }} +{{ else }} root = "/var/lib/containerd" +{{- end }} state = "/run/containerd" [grpc]