20
20
defaultOOMScoreAdj = 1000
21
21
)
22
22
23
- const (
24
- cmdMountProc = "mount-proc"
25
- cmdUnmountProc = "unmount-proc"
26
- )
27
-
28
23
func main () {
29
24
log := logrus .New ()
30
25
log .SetLevel (logrus .DebugLevel )
@@ -66,12 +61,7 @@ func createAndRunc(runcPath string) error {
66
61
}
67
62
68
63
cfg .Process .OOMScoreAdj = & defaultOOMScoreAdj
69
- replaceProcMount (& cfg )
70
64
replaceSysMount (& cfg )
71
- err = addHooks (& cfg )
72
- if err != nil {
73
- return fmt .Errorf ("canot add hooks: %w" , err )
74
- }
75
65
76
66
fc , err = json .Marshal (cfg )
77
67
if err != nil {
@@ -91,30 +81,6 @@ func createAndRunc(runcPath string) error {
91
81
return nil
92
82
}
93
83
94
- func replaceProcMount (cfg * specs.Spec ) {
95
- var n int
96
- for _ , m := range cfg .Mounts {
97
- if m .Destination == "/proc" {
98
- continue
99
- }
100
-
101
- cfg .Mounts [n ] = m
102
- n ++
103
- }
104
-
105
- cfg .Mounts = cfg .Mounts [:n ]
106
- // TODO(cw): add daemon-mounted proc
107
- cfg .Mounts = append (cfg .Mounts , specs.Mount {
108
- Destination : "/proc" ,
109
- Options : []string {
110
- "rbind" ,
111
- "rprivate" ,
112
- },
113
- Source : "/proc" ,
114
- Type : "bind" ,
115
- })
116
- }
117
-
118
84
func replaceSysMount (cfg * specs.Spec ) {
119
85
var n int
120
86
for _ , m := range cfg .Mounts {
@@ -137,20 +103,3 @@ func replaceSysMount(cfg *specs.Spec) {
137
103
Type : "bind" ,
138
104
})
139
105
}
140
-
141
- func addHooks (cfg * specs.Spec ) error {
142
- self , err := os .Executable ()
143
- if err != nil {
144
- return err
145
- }
146
-
147
- cfg .Hooks .Prestart = append (cfg .Hooks .Prestart , specs.Hook {
148
- Path : self ,
149
- Args : []string {cmdMountProc },
150
- })
151
- cfg .Hooks .Poststop = append (cfg .Hooks .Poststop , specs.Hook {
152
- Path : self ,
153
- Args : []string {cmdUnmountProc },
154
- })
155
- return nil
156
- }
0 commit comments