Skip to content

Better plugin registration/imports #2134

@AkihiroSuda

Description

@AkihiroSuda

continuation of #1615 #2131

Problem

With #2131 (merged), a thirdparty can build a daemon with custom plugin configuration like this:

package main

import (
        "fmt"
        "os"

	"github.com/containerd/containerd/cmd/containerd/command"
	// default plugins
	_ "github.com/containerd/containerd/diff/walking/plugin"
	_ "github.com/containerd/containerd/gc/scheduler"
	_ "github.com/containerd/containerd/services/containers"
        ...
	_ "github.com/containerd/containerd/services/version"
	_ "github.com/containerd/containerd/linux"
	_ "github.com/containerd/containerd/metrics/cgroups"
	_ "github.com/containerd/containerd/snapshots/overlay"

	// optional plugins
	_ "github.com/containerd/containerd/snapshots/btrfs"

	// custom plugins
	_ "github.com/containerd/aufs"
	_ "github.com/containerd/zfs"
	_ "github.com/containerd/cri"
	_ "github.com/containerd/continuity/c8dplugins" // not yet available
	_ "github.com/AkihiroSuda/containerd-ipfs-contentstore" // not yet available
)

func main() {
        app := command.App()
        if err := app.Run(os.Args); err != nil {
                fmt.Fprintf(os.Stderr, "containerd: %s\n", err)
                os.Exit(1)
        }
}

However, it is not easy to configure these plugins.
Especially, most users don't want to list up a bunch of these "default" plugins.

Proposal

I suggest creating github.com/containerd/containerd/cmd/containerd/defaultplugins package and put "default" plugin imports (not plugin packages itself) into this.
Probably the "default" set should not contain btrfs/aufs/zfs and cri.

Third parties just need to import this package and additional ones.

Other ideas

  • Promote DLL plugins (again), and create a custom tool that builds a plugin package with correctly vendored packages. This seems the most ideal solution but it might not be easy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions