diff --git a/plugins/device-injector/device-injector.go b/plugins/device-injector/device-injector.go index df1d14dc..3c19cd2b 100644 --- a/plugins/device-injector/device-injector.go +++ b/plugins/device-injector/device-injector.go @@ -67,7 +67,7 @@ type plugin struct { } // CreateContainer handles container creation requests. -func (p *plugin) CreateContainer(pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) { +func (p *plugin) CreateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) { var ( ctrName string devices []device diff --git a/plugins/differ/nri-differ.go b/plugins/differ/nri-differ.go index b4519164..0e01935b 100644 --- a/plugins/differ/nri-differ.go +++ b/plugins/differ/nri-differ.go @@ -68,7 +68,7 @@ var ( indices map[int]pluginIndex ) -func (p *plugin) Configure(nriCfg string) (stub.EventMask, error) { +func (p *plugin) Configure(_ context.Context, nriCfg string) (stub.EventMask, error) { log.Infof("got configuration data: %q", nriCfg) if nriCfg == "" { return p.mask, nil @@ -177,7 +177,7 @@ func (p *plugin) differ(apifunc string, pod *api.PodSandbox, container *api.Cont } } -func (p *plugin) Synchronize(pods []*api.PodSandbox, containers []*api.Container) ([]*api.ContainerUpdate, error) { +func (p *plugin) Synchronize(_ context.Context, pods []*api.PodSandbox, containers []*api.Container) ([]*api.ContainerUpdate, error) { if cfg.VerboseLevel > 2 { p.dump("Synchronize", "pods", pods, "containers", containers) } @@ -185,26 +185,26 @@ func (p *plugin) Synchronize(pods []*api.PodSandbox, containers []*api.Container return nil, nil } -func (p *plugin) Shutdown() { +func (p *plugin) Shutdown(_ context.Context) { p.dump("Shutdown") } -func (p *plugin) RunPodSandbox(pod *api.PodSandbox) error { +func (p *plugin) RunPodSandbox(_ context.Context, pod *api.PodSandbox) error { p.differ("RunPodSandbox", pod, nil) return nil } -func (p *plugin) StopPodSandbox(pod *api.PodSandbox) error { +func (p *plugin) StopPodSandbox(_ context.Context, pod *api.PodSandbox) error { p.differ("StopPodSandbox", pod, nil) return nil } -func (p *plugin) RemovePodSandbox(pod *api.PodSandbox) error { +func (p *plugin) RemovePodSandbox(_ context.Context, pod *api.PodSandbox) error { p.differ("RemovePodSandbox", pod, nil) return nil } -func (p *plugin) CreateContainer(pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) { +func (p *plugin) CreateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) { p.differ("CreateContainer", pod, container) adjust := &api.ContainerAdjustment{} @@ -212,39 +212,39 @@ func (p *plugin) CreateContainer(pod *api.PodSandbox, container *api.Container) return adjust, nil, nil } -func (p *plugin) PostCreateContainer(pod *api.PodSandbox, container *api.Container) error { +func (p *plugin) PostCreateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error { p.differ("PostCreateContainer", pod, container) return nil } -func (p *plugin) StartContainer(pod *api.PodSandbox, container *api.Container) error { +func (p *plugin) StartContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error { p.differ("StartContainer", pod, container) return nil } -func (p *plugin) PostStartContainer(pod *api.PodSandbox, container *api.Container) error { +func (p *plugin) PostStartContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error { p.differ("PostStartContainer", pod, container) return nil } -func (p *plugin) UpdateContainer(pod *api.PodSandbox, container *api.Container) ([]*api.ContainerUpdate, error) { +func (p *plugin) UpdateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container, r *api.LinuxResources) ([]*api.ContainerUpdate, error) { p.differ("UpdateContainer", pod, container) return nil, nil } -func (p *plugin) PostUpdateContainer(pod *api.PodSandbox, container *api.Container) error { +func (p *plugin) PostUpdateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error { p.differ("PostUpdateContainer", pod, container) return nil } -func (p *plugin) StopContainer(pod *api.PodSandbox, container *api.Container) ([]*api.ContainerUpdate, error) { +func (p *plugin) StopContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) ([]*api.ContainerUpdate, error) { p.differ("StopContainer", pod, container) return nil, nil } -func (p *plugin) RemoveContainer(pod *api.PodSandbox, container *api.Container) error { +func (p *plugin) RemoveContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error { p.differ("RemoveContainer", pod, container) return nil } diff --git a/plugins/hook-injector/hook-injector.go b/plugins/hook-injector/hook-injector.go index e516e8fb..8d986032 100644 --- a/plugins/hook-injector/hook-injector.go +++ b/plugins/hook-injector/hook-injector.go @@ -43,7 +43,7 @@ type plugin struct { mgr *hooks.Manager } -func (p *plugin) CreateContainer(pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) { +func (p *plugin) CreateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) { ctrName := containerName(pod, container) if verbose { diff --git a/plugins/logger/nri-logger.go b/plugins/logger/nri-logger.go index 67240d51..66fcb4ad 100644 --- a/plugins/logger/nri-logger.go +++ b/plugins/logger/nri-logger.go @@ -50,7 +50,7 @@ var ( _ = stub.ConfigureInterface(&plugin{}) ) -func (p *plugin) Configure(config, runtime, version string) (stub.EventMask, error) { +func (p *plugin) Configure(_ context.Context, config, runtime, version string) (stub.EventMask, error) { log.Infof("got configuration data: %q from runtime %s %s", config, runtime, version) if config == "" { return p.mask, nil @@ -79,7 +79,7 @@ func (p *plugin) Configure(config, runtime, version string) (stub.EventMask, err return p.mask, nil } -func (p *plugin) Synchronize(pods []*api.PodSandbox, containers []*api.Container) ([]*api.ContainerUpdate, error) { +func (p *plugin) Synchronize(_ context.Context, pods []*api.PodSandbox, containers []*api.Container) ([]*api.ContainerUpdate, error) { dump("Synchronize", "pods", pods, "containers", containers) return nil, nil } @@ -88,22 +88,22 @@ func (p *plugin) Shutdown() { dump("Shutdown") } -func (p *plugin) RunPodSandbox(pod *api.PodSandbox) error { +func (p *plugin) RunPodSandbox(_ context.Context, pod *api.PodSandbox) error { dump("RunPodSandbox", "pod", pod) return nil } -func (p *plugin) StopPodSandbox(pod *api.PodSandbox) error { +func (p *plugin) StopPodSandbox(_ context.Context, pod *api.PodSandbox) error { dump("StopPodSandbox", "pod", pod) return nil } -func (p *plugin) RemovePodSandbox(pod *api.PodSandbox) error { +func (p *plugin) RemovePodSandbox(_ context.Context, pod *api.PodSandbox) error { dump("RemovePodSandbox", "pod", pod) return nil } -func (p *plugin) CreateContainer(pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) { +func (p *plugin) CreateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) { dump("CreateContainer", "pod", pod, "container", container) adjust := &api.ContainerAdjustment{} @@ -126,37 +126,37 @@ func (p *plugin) CreateContainer(pod *api.PodSandbox, container *api.Container) return adjust, nil, nil } -func (p *plugin) PostCreateContainer(pod *api.PodSandbox, container *api.Container) error { +func (p *plugin) PostCreateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error { dump("PostCreateContainer", "pod", pod, "container", container) return nil } -func (p *plugin) StartContainer(pod *api.PodSandbox, container *api.Container) error { +func (p *plugin) StartContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error { dump("StartContainer", "pod", pod, "container", container) return nil } -func (p *plugin) PostStartContainer(pod *api.PodSandbox, container *api.Container) error { +func (p *plugin) PostStartContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error { dump("PostStartContainer", "pod", pod, "container", container) return nil } -func (p *plugin) UpdateContainer(pod *api.PodSandbox, container *api.Container) ([]*api.ContainerUpdate, error) { - dump("UpdateContainer", "pod", pod, "container", container) +func (p *plugin) UpdateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container, r *api.LinuxResources) ([]*api.ContainerUpdate, error) { + dump("UpdateContainer", "pod", pod, "container", container, "resources", r) return nil, nil } -func (p *plugin) PostUpdateContainer(pod *api.PodSandbox, container *api.Container) error { +func (p *plugin) PostUpdateContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error { dump("PostUpdateContainer", "pod", pod, "container", container) return nil } -func (p *plugin) StopContainer(pod *api.PodSandbox, container *api.Container) ([]*api.ContainerUpdate, error) { +func (p *plugin) StopContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) ([]*api.ContainerUpdate, error) { dump("StopContainer", "pod", pod, "container", container) return nil, nil } -func (p *plugin) RemoveContainer(pod *api.PodSandbox, container *api.Container) error { +func (p *plugin) RemoveContainer(_ context.Context, pod *api.PodSandbox, container *api.Container) error { dump("RemoveContainer", "pod", pod, "container", container) return nil } diff --git a/plugins/template/plugin.go b/plugins/template/plugin.go index f87e3688..685741d4 100644 --- a/plugins/template/plugin.go +++ b/plugins/template/plugin.go @@ -43,7 +43,7 @@ var ( log *logrus.Logger ) -func (p *plugin) Configure(config, runtime, version string) (stub.EventMask, error) { +func (p *plugin) Configure(_ context.Context, config, runtime, version string) (stub.EventMask, error) { log.Infof("Connected to %s/%s...", runtime, version) if config == "" { @@ -60,31 +60,31 @@ func (p *plugin) Configure(config, runtime, version string) (stub.EventMask, err return 0, nil } -func (p *plugin) Synchronize(pods []*api.PodSandbox, containers []*api.Container) ([]*api.ContainerUpdate, error) { +func (p *plugin) Synchronize(_ context.Context, pods []*api.PodSandbox, containers []*api.Container) ([]*api.ContainerUpdate, error) { log.Info("Synchronizing state with the runtime...") return nil, nil } -func (p *plugin) Shutdown() { +func (p *plugin) Shutdown(_ context.Context) { log.Info("Runtime shutting down...") } -func (p *plugin) RunPodSandbox(pod *api.PodSandbox) error { +func (p *plugin) RunPodSandbox(_ context.Context, pod *api.PodSandbox) error { log.Infof("Started pod %s/%s...", pod.GetNamespace(), pod.GetName()) return nil } -func (p *plugin) StopPodSandbox(pod *api.PodSandbox) error { +func (p *plugin) StopPodSandbox(_ context.Context, pod *api.PodSandbox) error { log.Infof("Stopped pod %s/%s...", pod.GetNamespace(), pod.GetName()) return nil } -func (p *plugin) RemovePodSandbox(pod *api.PodSandbox) error { +func (p *plugin) RemovePodSandbox(_ context.Context, pod *api.PodSandbox) error { log.Infof("Removed pod %s/%s...", pod.GetNamespace(), pod.GetName()) return nil } -func (p *plugin) CreateContainer(pod *api.PodSandbox, ctr *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) { +func (p *plugin) CreateContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) { log.Infof("Creating container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName()) // @@ -105,22 +105,22 @@ func (p *plugin) CreateContainer(pod *api.PodSandbox, ctr *api.Container) (*api. return adjustment, updates, nil } -func (p *plugin) PostCreateContainer(pod *api.PodSandbox, ctr *api.Container) error { +func (p *plugin) PostCreateContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) error { log.Infof("Created container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName()) return nil } -func (p *plugin) StartContainer(pod *api.PodSandbox, ctr *api.Container) error { +func (p *plugin) StartContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) error { log.Infof("Starting container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName()) return nil } -func (p *plugin) PostStartContainer(pod *api.PodSandbox, ctr *api.Container) error { +func (p *plugin) PostStartContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) error { log.Infof("Started container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName()) return nil } -func (p *plugin) UpdateContainer(pod *api.PodSandbox, ctr *api.Container) ([]*api.ContainerUpdate, error) { +func (p *plugin) UpdateContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container, r *api.LinuxResources) ([]*api.ContainerUpdate, error) { log.Infof("Updating container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName()) // @@ -137,12 +137,12 @@ func (p *plugin) UpdateContainer(pod *api.PodSandbox, ctr *api.Container) ([]*ap return updates, nil } -func (p *plugin) PostUpdateContainer(pod *api.PodSandbox, ctr *api.Container) error { +func (p *plugin) PostUpdateContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) error { log.Infof("Updated container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName()) return nil } -func (p *plugin) StopContainer(pod *api.PodSandbox, ctr *api.Container) ([]*api.ContainerUpdate, error) { +func (p *plugin) StopContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) ([]*api.ContainerUpdate, error) { log.Infof("Stopped container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName()) // @@ -154,7 +154,7 @@ func (p *plugin) StopContainer(pod *api.PodSandbox, ctr *api.Container) ([]*api. return []*api.ContainerUpdate{}, nil } -func (p *plugin) RemoveContainer(pod *api.PodSandbox, ctr *api.Container) error { +func (p *plugin) RemoveContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) error { log.Infof("Removed container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName()) return nil } diff --git a/plugins/v010-adapter/v010-adapter.go b/plugins/v010-adapter/v010-adapter.go index 6c37daf8..e1b79e18 100644 --- a/plugins/v010-adapter/v010-adapter.go +++ b/plugins/v010-adapter/v010-adapter.go @@ -38,16 +38,16 @@ var ( log *logrus.Logger ) -func (p *plugin) Configure(config, runtime, version string) (stub.EventMask, error) { +func (p *plugin) Configure(_ context.Context, config, runtime, version string) (stub.EventMask, error) { log.Infof("Connected to %s/%s...", runtime, version) return 0, nil } -func (p *plugin) Shutdown() { +func (p *plugin) Shutdown(_ context.Context) { log.Info("Runtime shutting down...") } -func (p *plugin) RunPodSandbox(pod *api.PodSandbox) error { +func (p *plugin) RunPodSandbox(_ context.Context, pod *api.PodSandbox) error { log.Infof("Started pod %s/%s...", pod.GetNamespace(), pod.GetName()) nric, err := nri.New() @@ -72,7 +72,7 @@ func (p *plugin) RunPodSandbox(pod *api.PodSandbox) error { return nil } -func (p *plugin) StopPodSandbox(pod *api.PodSandbox) error { +func (p *plugin) StopPodSandbox(_ context.Context, pod *api.PodSandbox) error { log.Infof("Stopped pod %s/%s...", pod.GetNamespace(), pod.GetName()) nric, err := nri.New() @@ -97,7 +97,7 @@ func (p *plugin) StopPodSandbox(pod *api.PodSandbox) error { return nil } -func (p *plugin) StartContainer(pod *api.PodSandbox, ctr *api.Container) error { +func (p *plugin) StartContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) error { log.Infof("Starting container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName()) nric, err := nri.New() @@ -122,7 +122,7 @@ func (p *plugin) StartContainer(pod *api.PodSandbox, ctr *api.Container) error { return nil } -func (p *plugin) StopContainer(pod *api.PodSandbox, ctr *api.Container) ([]*api.ContainerUpdate, error) { +func (p *plugin) StopContainer(_ context.Context, pod *api.PodSandbox, ctr *api.Container) ([]*api.ContainerUpdate, error) { log.Infof("Stopped container %s/%s/%s...", pod.GetNamespace(), pod.GetName(), ctr.GetName()) nric, err := nri.New()