From 04412945099e004d9c57e0d3ad4c0328e452ba29 Mon Sep 17 00:00:00 2001 From: Claudia Beresford Date: Mon, 6 Dec 2021 14:58:22 +0000 Subject: [PATCH] feat: remove option to set volume snapshotter Flintlock does not handle other snapshotters well, so we should be opinionated about this. There is no real reason to support others. --- infrastructure/containerd/config.go | 2 +- internal/command/flags/flags.go | 6 ------ internal/config/config.go | 2 -- internal/inject/wire.go | 3 ++- internal/inject/wire_gen.go | 3 ++- pkg/defaults/defaults.go | 2 +- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/infrastructure/containerd/config.go b/infrastructure/containerd/config.go index 45dbb5d7..6b579a22 100644 --- a/infrastructure/containerd/config.go +++ b/infrastructure/containerd/config.go @@ -4,7 +4,7 @@ const ( supportedSnapshotters = "overlayfs,native,devmapper" ) -// Config holds the contaierd configuration. +// Config holds the containerd configuration. type Config struct { // SnapshotterKernel is the name of the containerd snapshotter to use for kernel images. SnapshotterKernel string diff --git a/internal/command/flags/flags.go b/internal/command/flags/flags.go index 416aa4a9..4f55bc7f 100644 --- a/internal/command/flags/flags.go +++ b/internal/command/flags/flags.go @@ -18,7 +18,6 @@ const ( firecrackerBinFlag = "firecracker-bin" firecrackerDetachFlag = "firecracker-detach" containerdSocketFlag = "containerd-socket" - volSnapshotterFlag = "containerd-volume-ss" kernelSnapshotterFlag = "containerd-kernel-ss" containerdNamespace = "containerd-ns" maximumRetryFlag = "maximum-retry" @@ -115,11 +114,6 @@ func AddContainerDFlagsToCommand(cmd *cobra.Command, cfg *config.Config) error { defaults.ContainerdKernelSnapshotter, "The name of the snapshotter to use with containerd for kernel/initrd images.") - cmd.Flags().StringVar(&cfg.CtrSnapshotterVolume, - volSnapshotterFlag, - defaults.ContainerdVolumeSnapshotter, - "The name of the snapshotter to use with containerd for volume images.") - cmd.Flags().StringVar(&cfg.CtrNamespace, containerdNamespace, defaults.ContainerdNamespace, diff --git a/internal/config/config.go b/internal/config/config.go index 444d904f..7879ef56 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -26,8 +26,6 @@ type Config struct { ParentIface string // CtrSnapshotterKernel is the name of the containerd snapshotter to use for kernel images. CtrSnapshotterKernel string - // CtrSnapshotterVolume is the name of the containerd snapshotter to use for volume (inc initrd) images. - CtrSnapshotterVolume string // CtrSocketPath is the path to the containerd socket. CtrSocketPath string // CtrNamespace is the default containerd namespace to use diff --git a/internal/inject/wire.go b/internal/inject/wire.go index 525d5bef..26e61862 100644 --- a/internal/inject/wire.go +++ b/internal/inject/wire.go @@ -19,6 +19,7 @@ import ( "github.com/weaveworks/flintlock/infrastructure/network" "github.com/weaveworks/flintlock/infrastructure/ulid" "github.com/weaveworks/flintlock/internal/config" + "github.com/weaveworks/flintlock/pkg/defaults" ) func InitializePorts(cfg *config.Config) (*ports.Collection, error) { @@ -58,7 +59,7 @@ func InitializeGRPCServer(app application.App) ports.MicroVMGRPCService { func containerdConfig(cfg *config.Config) *containerd.Config { return &containerd.Config{ SnapshotterKernel: cfg.CtrSnapshotterKernel, - SnapshotterVolume: cfg.CtrSnapshotterVolume, + SnapshotterVolume: defaults.ContainerdVolumeSnapshotter, SocketPath: cfg.CtrSocketPath, Namespace: cfg.CtrNamespace, } diff --git a/internal/inject/wire_gen.go b/internal/inject/wire_gen.go index a7c6f2eb..4e47d7c7 100644 --- a/internal/inject/wire_gen.go +++ b/internal/inject/wire_gen.go @@ -18,6 +18,7 @@ import ( "github.com/weaveworks/flintlock/infrastructure/network" "github.com/weaveworks/flintlock/infrastructure/ulid" "github.com/weaveworks/flintlock/internal/config" + "github.com/weaveworks/flintlock/pkg/defaults" "time" ) @@ -72,7 +73,7 @@ func InitializeGRPCServer(app application.App) ports.MicroVMGRPCService { func containerdConfig(cfg *config.Config) *containerd.Config { return &containerd.Config{ SnapshotterKernel: cfg.CtrSnapshotterKernel, - SnapshotterVolume: cfg.CtrSnapshotterVolume, + SnapshotterVolume: defaults.ContainerdVolumeSnapshotter, SocketPath: cfg.CtrSocketPath, Namespace: cfg.CtrNamespace, } diff --git a/pkg/defaults/defaults.go b/pkg/defaults/defaults.go index 3652abf6..d190418c 100644 --- a/pkg/defaults/defaults.go +++ b/pkg/defaults/defaults.go @@ -14,7 +14,7 @@ const ( // ContainerdSocket is the defaults path for the containerd socket. ContainerdSocket = "/run/containerd/containerd.sock" - // ContainerdVolumeSnapshotter is the name of the default snapshotter to use for volumes. + // ContainerdVolumeSnapshotter is the name of the snapshotter used for volumes. ContainerdVolumeSnapshotter = "devmapper" // ContainerdKernelSnapshotter is the name of the default snapshotter to use for kernek/initrd.