Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Hepto
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ACIDES
Hepto
Commits
382f6007
Commit
382f6007
authored
1 year ago
by
kaiyou
Browse files
Options
Downloads
Patches
Plain Diff
Remove unnecessary hooks
parent
cdf9208e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cmd/hepto.go
+10
-4
10 additions, 4 deletions
cmd/hepto.go
cmd/hepto/hepto.go
+1
-1
1 addition, 1 deletion
cmd/hepto/hepto.go
cmd/hepto/hooks.go
+0
-12
0 additions, 12 deletions
cmd/hepto/hooks.go
with
11 additions
and
17 deletions
cmd/hepto.go
+
10
−
4
View file @
382f6007
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
cmd/hepto/hepto.go
+
1
−
1
View file @
382f6007
...
...
@@ -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
),
)
...
...
This diff is collapsed.
Click to expand it.
cmd/hepto/hooks.go
+
0
−
12
View file @
382f6007
...
...
@@ -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
,
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment