From d4c202438ceca54bc9395d194e07e93995f4b3cc Mon Sep 17 00:00:00 2001 From: Andrew Rynhard Date: Wed, 4 Dec 2019 23:20:17 +0000 Subject: [PATCH] refactor: set CRI config to /etc/cri/containerd.toml This changes the CRI specific containerd instance's config to a different path. Signed-off-by: Andrew Rynhard --- Dockerfile | 2 +- .../machined/pkg/system/runner/containerd/containerd_test.go | 2 +- internal/app/machined/pkg/system/runner/cri/cri_test.go | 2 +- internal/app/machined/pkg/system/services/containerd.go | 2 +- internal/pkg/containers/containerd/containerd_test.go | 2 +- internal/pkg/containers/cri/cri_test.go | 2 +- internal/pkg/cri/cri_test.go | 2 +- pkg/constants/constants.go | 3 +++ 8 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 229a9a035..1fbb2ac9f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -239,7 +239,7 @@ COPY images/networkd.tar /rootfs/usr/images/ # symlinks to avoid accidentally cleaning them up. COPY ./hack/cleanup.sh /toolchain/bin/cleanup.sh RUN cleanup.sh /rootfs -COPY hack/containerd.toml /rootfs/etc/containerd/cri.toml +COPY hack/containerd.toml /rootfs/etc/cri/containerd.toml RUN touch /rootfs/etc/resolv.conf RUN touch /rootfs/etc/hosts RUN touch /rootfs/etc/os-release diff --git a/internal/app/machined/pkg/system/runner/containerd/containerd_test.go b/internal/app/machined/pkg/system/runner/containerd/containerd_test.go index 9f11a8332..5d128186a 100644 --- a/internal/app/machined/pkg/system/runner/containerd/containerd_test.go +++ b/internal/app/machined/pkg/system/runner/containerd/containerd_test.go @@ -76,7 +76,7 @@ func (suite *ContainerdSuite) SetupSuite() { "--address", suite.containerdAddress, "--state", stateDir, "--root", rootDir, - "--config", "/etc/containerd/cri.toml", + "--config", constants.CRIContainerdConfig, }, } diff --git a/internal/app/machined/pkg/system/runner/cri/cri_test.go b/internal/app/machined/pkg/system/runner/cri/cri_test.go index b62a9886d..8bced5eb7 100644 --- a/internal/app/machined/pkg/system/runner/cri/cri_test.go +++ b/internal/app/machined/pkg/system/runner/cri/cri_test.go @@ -67,7 +67,7 @@ func (suite *CRISuite) SetupSuite() { "--address", suite.containerdAddress, "--state", stateDir, "--root", rootDir, - "--config", "/etc/containerd/cri.toml", + "--config", constants.CRIContainerdConfig, }, } diff --git a/internal/app/machined/pkg/system/services/containerd.go b/internal/app/machined/pkg/system/services/containerd.go index 9c94cefbe..bea2ff727 100644 --- a/internal/app/machined/pkg/system/services/containerd.go +++ b/internal/app/machined/pkg/system/services/containerd.go @@ -61,7 +61,7 @@ func (c *Containerd) Runner(config runtime.Configurator) (runner.Runner, error) "--address", constants.ContainerdAddress, "--config", - "/etc/containerd/cri.toml", + constants.CRIContainerdConfig, }, } diff --git a/internal/pkg/containers/containerd/containerd_test.go b/internal/pkg/containers/containerd/containerd_test.go index c9d2d95e1..17c29155c 100644 --- a/internal/pkg/containers/containerd/containerd_test.go +++ b/internal/pkg/containers/containerd/containerd_test.go @@ -92,7 +92,7 @@ func (suite *ContainerdSuite) SetupSuite() { "--address", suite.containerdAddress, "--state", stateDir, "--root", rootDir, - "--config", "/etc/containerd/cri.toml", + "--config", constants.CRIContainerdConfig, }, } diff --git a/internal/pkg/containers/cri/cri_test.go b/internal/pkg/containers/cri/cri_test.go index de096bab7..78e142806 100644 --- a/internal/pkg/containers/cri/cri_test.go +++ b/internal/pkg/containers/cri/cri_test.go @@ -75,7 +75,7 @@ func (suite *CRISuite) SetupSuite() { "--address", suite.containerdAddress, "--state", stateDir, "--root", rootDir, - "--config", "/etc/containerd/cri.toml", + "--config", constants.CRIContainerdConfig, }, } diff --git a/internal/pkg/cri/cri_test.go b/internal/pkg/cri/cri_test.go index f39f8cd5d..ee4fd81d6 100644 --- a/internal/pkg/cri/cri_test.go +++ b/internal/pkg/cri/cri_test.go @@ -65,7 +65,7 @@ func (suite *CRISuite) SetupSuite() { "--address", suite.containerdAddress, "--state", stateDir, "--root", rootDir, - "--config", "/etc/containerd/cri.toml", + "--config", constants.CRIContainerdConfig, }, } diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index a7b431700..131bbafdc 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -194,6 +194,9 @@ const ( // SystemContainerdAddress is the path to the system containerd socket. SystemContainerdAddress = SystemRunPath + "/containerd/containerd.sock" + // CRIContainerdConfig is the path to the config for the containerd instance that provides the CRI. + CRIContainerdConfig = "/etc/cri/containerd.toml" + // TalosConfigEnvVar is the environment variable for setting the Talos configuration file path. TalosConfigEnvVar = "TALOSCONFIG"