Skip to content
Snippets Groups Projects
Commit 382f6007 authored by kaiyou's avatar kaiyou
Browse files

Remove unnecessary hooks

parent cdf9208e
No related branches found
No related tags found
No related merge requests found
......@@ -9,12 +9,18 @@ import (
)
func main() {
fn := hepto.Hepto
var err error
program := filepath.Base(os.Args[0])
if hook, ok := hepto.Hooks[program]; ok {
fn = hook
switch program {
case "runc":
err = hepto.Runc()
case "kubectl":
err = hepto.Kubectl()
case "containerd-shim-runc-v2":
err = hepto.Shim()
default:
err = hepto.Hepto()
}
err := fn()
if err != nil {
fmt.Println(err)
os.Exit(1)
......
......@@ -45,7 +45,7 @@ func Hepto() error {
dolly.NewBind(dataPath, config.Cluster.DataDir),
dolly.PrefixEnv("HEPTO_"),
dolly.NewEnv("PATH", "/bin"),
dolly.MountSelf("/bin", "runc", "containerd-shim-runc-v2", "mount", "umount"),
dolly.MountSelf("/bin", "runc", "containerd-shim-runc-v2"),
dolly.NewDevicesOrPanic(requiredDevices...),
dolly.NewBinds(config.Mounts),
)
......
......@@ -5,7 +5,6 @@ import (
"os"
"strings"
containerd "github.com/containerd/containerd/cmd/containerd/command"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/plugin"
"github.com/containerd/containerd/runtime/v2/runc/manager"
......@@ -19,10 +18,6 @@ import (
kubectl "k8s.io/kubectl/pkg/cmd"
)
func Containerd() error {
return containerd.App().Run(os.Args)
}
func Shim() error {
ctx := context.Background()
plugins := plugin.Graph(func(*plugin.Registration) bool { return false })
......@@ -51,10 +46,3 @@ func Runc() error {
func Kubectl() error {
return kubectl.NewDefaultKubectlCommand().Execute()
}
var Hooks = map[string]func() error{
"kubectl": Kubectl,
"runc": Runc,
"containerd-shim-runc-v2": Shim,
"containerd": Containerd,
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment