Skip to content

Commit f5d0f51

Browse files
committed
plugins: update plugins for stub changes.
Update plugin event handlers with the updated stub interfaces. Signed-off-by: Krisztian Litkey <[email protected]>
1 parent b4bd301 commit f5d0f51

6 files changed

Lines changed: 49 additions & 49 deletions

File tree

plugins/device-injector/device-injector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ type plugin struct {
6767
}
6868

6969
// CreateContainer handles container creation requests.
70-
func (p *plugin) CreateContainer(pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
70+
func (p *plugin) CreateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
7171
var (
7272
ctrName string
7373
devices []device

plugins/differ/nri-differ.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ var (
6868
indices map[int]pluginIndex
6969
)
7070

71-
func (p *plugin) Configure(nriCfg string) (stub.EventMask, error) {
71+
func (p *plugin) Configure(_ context.Context, nriCfg string) (stub.EventMask, error) {
7272
log.Infof("got configuration data: %q", nriCfg)
7373
if nriCfg == "" {
7474
return p.mask, nil
@@ -177,74 +177,74 @@ func (p *plugin) differ(apifunc string, pod *api.PodSandbox, container *api.Cont
177177
}
178178
}
179179

180-
func (p *plugin) Synchronize(pods []*api.PodSandbox, containers []*api.Container) ([]*api.ContainerUpdate, error) {
180+
func (p *plugin) Synchronize(_ context.Context, pods []*api.PodSandbox, containers []*api.Container) ([]*api.ContainerUpdate, error) {
181181
if cfg.VerboseLevel > 2 {
182182
p.dump("Synchronize", "pods", pods, "containers", containers)
183183
}
184184

185185
return nil, nil
186186
}
187187

188-
func (p *plugin) Shutdown() {
188+
func (p *plugin) Shutdown(_ context.Context) {
189189
p.dump("Shutdown")
190190
}
191191

192-
func (p *plugin) RunPodSandbox(pod *api.PodSandbox) error {
192+
func (p *plugin) RunPodSandbox(_ context.Context, pod *api.PodSandbox) error {
193193
p.differ("RunPodSandbox", pod, nil)
194194
return nil
195195
}
196196

197-
func (p *plugin) StopPodSandbox(pod *api.PodSandbox) error {
197+
func (p *plugin) StopPodSandbox(_ context.Context, pod *api.PodSandbox) error {
198198
p.differ("StopPodSandbox", pod, nil)
199199
return nil
200200
}
201201

202-
func (p *plugin) RemovePodSandbox(pod *api.PodSandbox) error {
202+
func (p *plugin) RemovePodSandbox(_ context.Context, pod *api.PodSandbox) error {
203203
p.differ("RemovePodSandbox", pod, nil)
204204
return nil
205205
}
206206

207-
func (p *plugin) CreateContainer(pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
207+
func (p *plugin) CreateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
208208
p.differ("CreateContainer", pod, container)
209209

210210
adjust := &api.ContainerAdjustment{}
211211

212212
return adjust, nil, nil
213213
}
214214

215-
func (p *plugin) PostCreateContainer(pod *api.PodSandbox, container *api.Container) error {
215+
func (p *plugin) PostCreateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error {
216216
p.differ("PostCreateContainer", pod, container)
217217
return nil
218218
}
219219

220-
func (p *plugin) StartContainer(pod *api.PodSandbox, container *api.Container) error {
220+
func (p *plugin) StartContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error {
221221
p.differ("StartContainer", pod, container)
222222
return nil
223223
}
224224

225-
func (p *plugin) PostStartContainer(pod *api.PodSandbox, container *api.Container) error {
225+
func (p *plugin) PostStartContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error {
226226
p.differ("PostStartContainer", pod, container)
227227
return nil
228228
}
229229

230-
func (p *plugin) UpdateContainer(pod *api.PodSandbox, container *api.Container) ([]*api.ContainerUpdate, error) {
230+
func (p *plugin) UpdateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) ([]*api.ContainerUpdate, error) {
231231
p.differ("UpdateContainer", pod, container)
232232

233233
return nil, nil
234234
}
235235

236-
func (p *plugin) PostUpdateContainer(pod *api.PodSandbox, container *api.Container) error {
236+
func (p *plugin) PostUpdateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error {
237237
p.differ("PostUpdateContainer", pod, container)
238238
return nil
239239
}
240240

241-
func (p *plugin) StopContainer(pod *api.PodSandbox, container *api.Container) ([]*api.ContainerUpdate, error) {
241+
func (p *plugin) StopContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) ([]*api.ContainerUpdate, error) {
242242
p.differ("StopContainer", pod, container)
243243

244244
return nil, nil
245245
}
246246

247-
func (p *plugin) RemoveContainer(pod *api.PodSandbox, container *api.Container) error {
247+
func (p *plugin) RemoveContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error {
248248
p.differ("RemoveContainer", pod, container)
249249
return nil
250250
}

plugins/hook-injector/hook-injector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type plugin struct {
4343
mgr *hooks.Manager
4444
}
4545

46-
func (p *plugin) CreateContainer(pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
46+
func (p *plugin) CreateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
4747
ctrName := containerName(pod, container)
4848

4949
if verbose {

plugins/logger/nri-logger.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var (
5050
_ = stub.ConfigureInterface(&plugin{})
5151
)
5252

53-
func (p *plugin) Configure(config, runtime, version string) (stub.EventMask, error) {
53+
func (p *plugin) Configure(_ context.Context, config, runtime, version string) (stub.EventMask, error) {
5454
log.Infof("got configuration data: %q from runtime %s %s", config, runtime, version)
5555
if config == "" {
5656
return p.mask, nil
@@ -79,7 +79,7 @@ func (p *plugin) Configure(config, runtime, version string) (stub.EventMask, err
7979
return p.mask, nil
8080
}
8181

82-
func (p *plugin) Synchronize(pods []*api.PodSandbox, containers []*api.Container) ([]*api.ContainerUpdate, error) {
82+
func (p *plugin) Synchronize(_ context.Context, pods []*api.PodSandbox, containers []*api.Container) ([]*api.ContainerUpdate, error) {
8383
dump("Synchronize", "pods", pods, "containers", containers)
8484
return nil, nil
8585
}
@@ -88,22 +88,22 @@ func (p *plugin) Shutdown() {
8888
dump("Shutdown")
8989
}
9090

91-
func (p *plugin) RunPodSandbox(pod *api.PodSandbox) error {
91+
func (p *plugin) RunPodSandbox(_ context.Context, pod *api.PodSandbox) error {
9292
dump("RunPodSandbox", "pod", pod)
9393
return nil
9494
}
9595

96-
func (p *plugin) StopPodSandbox(pod *api.PodSandbox) error {
96+
func (p *plugin) StopPodSandbox(_ context.Context, pod *api.PodSandbox) error {
9797
dump("StopPodSandbox", "pod", pod)
9898
return nil
9999
}
100100

101-
func (p *plugin) RemovePodSandbox(pod *api.PodSandbox) error {
101+
func (p *plugin) RemovePodSandbox(_ context.Context, pod *api.PodSandbox) error {
102102
dump("RemovePodSandbox", "pod", pod)
103103
return nil
104104
}
105105

106-
func (p *plugin) CreateContainer(pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
106+
func (p *plugin) CreateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
107107
dump("CreateContainer", "pod", pod, "container", container)
108108

109109
adjust := &api.ContainerAdjustment{}
@@ -126,37 +126,37 @@ func (p *plugin) CreateContainer(pod *api.PodSandbox, container *api.Container)
126126
return adjust, nil, nil
127127
}
128128

129-
func (p *plugin) PostCreateContainer(pod *api.PodSandbox, container *api.Container) error {
129+
func (p *plugin) PostCreateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error {
130130
dump("PostCreateContainer", "pod", pod, "container", container)
131131
return nil
132132
}
133133

134-
func (p *plugin) StartContainer(pod *api.PodSandbox, container *api.Container) error {
134+
func (p *plugin) StartContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error {
135135
dump("StartContainer", "pod", pod, "container", container)
136136
return nil
137137
}
138138

139-
func (p *plugin) PostStartContainer(pod *api.PodSandbox, container *api.Container) error {
139+
func (p *plugin) PostStartContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error {
140140
dump("PostStartContainer", "pod", pod, "container", container)
141141
return nil
142142
}
143143

144-
func (p *plugin) UpdateContainer(pod *api.PodSandbox, container *api.Container) ([]*api.ContainerUpdate, error) {
144+
func (p *plugin) UpdateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) ([]*api.ContainerUpdate, error) {
145145
dump("UpdateContainer", "pod", pod, "container", container)
146146
return nil, nil
147147
}
148148

149-
func (p *plugin) PostUpdateContainer(pod *api.PodSandbox, container *api.Container) error {
149+
func (p *plugin) PostUpdateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error {
150150
dump("PostUpdateContainer", "pod", pod, "container", container)
151151
return nil
152152
}
153153

154-
func (p *plugin) StopContainer(pod *api.PodSandbox, container *api.Container) ([]*api.ContainerUpdate, error) {
154+
func (p *plugin) StopContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) ([]*api.ContainerUpdate, error) {
155155
dump("StopContainer", "pod", pod, "container", container)
156156
return nil, nil
157157
}
158158

159-
func (p *plugin) RemoveContainer(pod *api.PodSandbox, container *api.Container) error {
159+
func (p *plugin) RemoveContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error {
160160
dump("RemoveContainer", "pod", pod, "container", container)
161161
return nil
162162
}

plugins/template/plugin.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var (
4343
log *logrus.Logger
4444
)
4545

46-
func (p *plugin) Configure(config, runtime, version string) (stub.EventMask, error) {
46+
func (p *plugin) Configure(_ context.Context, config, runtime, version string) (stub.EventMask, error) {
4747
log.Infof("Connected to %s/%s...", runtime, version)
4848

4949
if config == "" {
@@ -60,31 +60,31 @@ func (p *plugin) Configure(config, runtime, version string) (stub.EventMask, err
6060
return 0, nil
6161
}
6262

63-
func (p *plugin) Synchronize(pods []*api.PodSandbox, containers []*api.Container) ([]*api.ContainerUpdate, error) {
63+
func (p *plugin) Synchronize(_ context.Context, pods []*api.PodSandbox, containers []*api.Container) ([]*api.ContainerUpdate, error) {
6464
log.Info("Synchronizing state with the runtime...")
6565
return nil, nil
6666
}
6767

68-
func (p *plugin) Shutdown() {
68+
func (p *plugin) Shutdown(_ context.Context) {
6969
log.Info("Runtime shutting down...")
7070
}
7171

72-
func (p *plugin) RunPodSandbox(pod *api.PodSandbox) error {
72+
func (p *plugin) RunPodSandbox(_ context.Context, pod *api.PodSandbox) error {
7373
log.Infof("Started pod %s/%s...", pod.GetNamespace(), pod.GetName())
7474
return nil
7575
}
7676

77-
func (p *plugin) StopPodSandbox(pod *api.PodSandbox) error {
77+
func (p *plugin) StopPodSandbox(_ context.Context, pod *api.PodSandbox) error {
7878
log.Infof("Stopped pod %s/%s...", pod.GetNamespace(), pod.GetName())
7979
return nil
8080
}
8181

82-
func (p *plugin) RemovePodSandbox(pod *api.PodSandbox) error {
82+
func (p *plugin) RemovePodSandbox(_ context.Context, pod *api.PodSandbox) error {
8383
log.Infof("Removed pod %s/%s...", pod.GetNamespace(), pod.GetName())
8484
return nil
8585
}
8686

87-
func (p *plugin) CreateContainer(pod *api.PodSandbox, ctr *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
87+
func (p *plugin) CreateContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
8888
log.Infof("Creating container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName())
8989

9090
//
@@ -105,22 +105,22 @@ func (p *plugin) CreateContainer(pod *api.PodSandbox, ctr *api.Container) (*api.
105105
return adjustment, updates, nil
106106
}
107107

108-
func (p *plugin) PostCreateContainer(pod *api.PodSandbox, ctr *api.Container) error {
108+
func (p *plugin) PostCreateContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) error {
109109
log.Infof("Created container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName())
110110
return nil
111111
}
112112

113-
func (p *plugin) StartContainer(pod *api.PodSandbox, ctr *api.Container) error {
113+
func (p *plugin) StartContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) error {
114114
log.Infof("Starting container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName())
115115
return nil
116116
}
117117

118-
func (p *plugin) PostStartContainer(pod *api.PodSandbox, ctr *api.Container) error {
118+
func (p *plugin) PostStartContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) error {
119119
log.Infof("Started container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName())
120120
return nil
121121
}
122122

123-
func (p *plugin) UpdateContainer(pod *api.PodSandbox, ctr *api.Container) ([]*api.ContainerUpdate, error) {
123+
func (p *plugin) UpdateContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) ([]*api.ContainerUpdate, error) {
124124
log.Infof("Updating container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName())
125125

126126
//
@@ -137,12 +137,12 @@ func (p *plugin) UpdateContainer(pod *api.PodSandbox, ctr *api.Container) ([]*ap
137137
return updates, nil
138138
}
139139

140-
func (p *plugin) PostUpdateContainer(pod *api.PodSandbox, ctr *api.Container) error {
140+
func (p *plugin) PostUpdateContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) error {
141141
log.Infof("Updated container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName())
142142
return nil
143143
}
144144

145-
func (p *plugin) StopContainer(pod *api.PodSandbox, ctr *api.Container) ([]*api.ContainerUpdate, error) {
145+
func (p *plugin) StopContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) ([]*api.ContainerUpdate, error) {
146146
log.Infof("Stopped container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName())
147147

148148
//
@@ -154,7 +154,7 @@ func (p *plugin) StopContainer(pod *api.PodSandbox, ctr *api.Container) ([]*api.
154154
return []*api.ContainerUpdate{}, nil
155155
}
156156

157-
func (p *plugin) RemoveContainer(pod *api.PodSandbox, ctr *api.Container) error {
157+
func (p *plugin) RemoveContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) error {
158158
log.Infof("Removed container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName())
159159
return nil
160160
}

plugins/v010-adapter/v010-adapter.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ var (
3838
log *logrus.Logger
3939
)
4040

41-
func (p *plugin) Configure(config, runtime, version string) (stub.EventMask, error) {
41+
func (p *plugin) Configure(_ context.Context, config, runtime, version string) (stub.EventMask, error) {
4242
log.Infof("Connected to %s/%s...", runtime, version)
4343
return 0, nil
4444
}
4545

46-
func (p *plugin) Shutdown() {
46+
func (p *plugin) Shutdown(_ context.Context) {
4747
log.Info("Runtime shutting down...")
4848
}
4949

50-
func (p *plugin) RunPodSandbox(pod *api.PodSandbox) error {
50+
func (p *plugin) RunPodSandbox(_ context.Context, pod *api.PodSandbox) error {
5151
log.Infof("Started pod %s/%s...", pod.GetNamespace(), pod.GetName())
5252

5353
nric, err := nri.New()
@@ -72,7 +72,7 @@ func (p *plugin) RunPodSandbox(pod *api.PodSandbox) error {
7272
return nil
7373
}
7474

75-
func (p *plugin) StopPodSandbox(pod *api.PodSandbox) error {
75+
func (p *plugin) StopPodSandbox(_ context.Context, pod *api.PodSandbox) error {
7676
log.Infof("Stopped pod %s/%s...", pod.GetNamespace(), pod.GetName())
7777

7878
nric, err := nri.New()
@@ -97,7 +97,7 @@ func (p *plugin) StopPodSandbox(pod *api.PodSandbox) error {
9797
return nil
9898
}
9999

100-
func (p *plugin) StartContainer(pod *api.PodSandbox, ctr *api.Container) error {
100+
func (p *plugin) StartContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) error {
101101
log.Infof("Starting container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName())
102102

103103
nric, err := nri.New()
@@ -122,7 +122,7 @@ func (p *plugin) StartContainer(pod *api.PodSandbox, ctr *api.Container) error {
122122
return nil
123123
}
124124

125-
func (p *plugin) StopContainer(pod *api.PodSandbox, ctr *api.Container) ([]*api.ContainerUpdate, error) {
125+
func (p *plugin) StopContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) ([]*api.ContainerUpdate, error) {
126126
log.Infof("Stopped container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName())
127127

128128
nric, err := nri.New()

0 commit comments

Comments
 (0)