From 5a1e0aadffadb3470092ac1e8d99f1cf002de32b Mon Sep 17 00:00:00 2001 From: Alessandro Thea Date: Thu, 2 Nov 2023 10:25:47 +0100 Subject: [PATCH 1/6] backup --- flx-dev-plugin.yaml | 4 ++-- flx-plugin/go.mod | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flx-dev-plugin.yaml b/flx-dev-plugin.yaml index 18c42c6..e37a9df 100644 --- a/flx-dev-plugin.yaml +++ b/flx-dev-plugin.yaml @@ -16,7 +16,7 @@ spec: spec: initContainers: - name: flx-driver - image: np04docker.cern.ch/dunedaq-local/flx-driver:v0.3 + image: np04docker.cern.ch/ghcr/dune-daq/flx-init-driver-alma9:latest securityContext: privileged: true volumeMounts: @@ -27,7 +27,7 @@ spec: readOnly: true containers: - name: flx-plugin - image: np04docker.cern.ch/dunedaq-local/flx-plugin:v0.3 + image: np04docker.cern.ch/ghcr/dune-daq/flx-device-plugin:latest securityContext: allowPrivilegeEscalation: false volumeMounts: diff --git a/flx-plugin/go.mod b/flx-plugin/go.mod index bbadd76..2d94be7 100644 --- a/flx-plugin/go.mod +++ b/flx-plugin/go.mod @@ -1,6 +1,6 @@ module flx-dev-plugin -go 1.17 +go 1.23 require ( github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b From b7ac9a16fc504ab3de75920a329038662d7d4983 Mon Sep 17 00:00:00 2001 From: Alessandro Thea Date: Thu, 2 Nov 2023 11:15:06 +0100 Subject: [PATCH 2/6] Printouts --- flx-plugin/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flx-plugin/main.go b/flx-plugin/main.go index 89f7df7..d784bc5 100644 --- a/flx-plugin/main.go +++ b/flx-plugin/main.go @@ -47,7 +47,7 @@ const ( // ListAndWatch returns a stream of List of Devices // Whenever a Device state changes or a Device disappears, ListAndWatch // returns the new list -func (p *Plugin) ListAndWatch(e *pluginapi.Empty, s pluginapi.DevicePlugin_ListAndWatchServer) error { +func (p *Plugin) ListAndWatch(e *pluginapi.Empty, s pluginapi.x``) error { fmt.Println("ListAndWatch()", p.name) var devs []*pluginapi.Device @@ -112,6 +112,8 @@ func (p *Plugin) Allocate(ctx context.Context, r *pluginapi.AllocateRequest) (*p // GetDevicePluginOptions returns options to be communicated with Device Manager func (Plugin) GetDevicePluginOptions(context.Context, *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error) { + fmt.Println("GetDevicePluginOptions()", p.name) + return nil, nil } @@ -119,6 +121,8 @@ func (Plugin) GetDevicePluginOptions(context.Context, *pluginapi.Empty) (*plugin // before each container start. Device plugin can run device specific operations // such as reseting the device before making devices available to the container func (Plugin) PreStartContainer(context.Context, *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error) { + fmt.Println("GetDevicePluginOptions()", p.name) + return nil, nil } From 464ed891fe60d2f0403218554a73bf7590bad919 Mon Sep 17 00:00:00 2001 From: Alessandro Thea Date: Thu, 2 Nov 2023 11:37:07 +0100 Subject: [PATCH 3/6] More printouts --- flx-plugin/main.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/flx-plugin/main.go b/flx-plugin/main.go index d784bc5..89d7384 100644 --- a/flx-plugin/main.go +++ b/flx-plugin/main.go @@ -111,7 +111,7 @@ func (p *Plugin) Allocate(ctx context.Context, r *pluginapi.AllocateRequest) (*p } // GetDevicePluginOptions returns options to be communicated with Device Manager -func (Plugin) GetDevicePluginOptions(context.Context, *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error) { +func (p* Plugin) GetDevicePluginOptions(context.Context, *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error) { fmt.Println("GetDevicePluginOptions()", p.name) return nil, nil @@ -120,17 +120,20 @@ func (Plugin) GetDevicePluginOptions(context.Context, *pluginapi.Empty) (*plugin // PreStartContainer is called, if indicated by Device Plugin during registeration phase, // before each container start. Device plugin can run device specific operations // such as reseting the device before making devices available to the container -func (Plugin) PreStartContainer(context.Context, *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error) { +func (p* Plugin) PreStartContainer(context.Context, *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error) { fmt.Println("GetDevicePluginOptions()", p.name) return nil, nil } -func (dp *Plugin) GetPreferredAllocation(ctx context.Context, request *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error) { +func (p *Plugin) GetPreferredAllocation(ctx context.Context, request *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error) { + fmt.Println("GetPreferredAllocation()", p.name) + return nil, nil } func (l FLXLister) GetResourceNamespace() string { + fmt.Println("GetResourceNamespace()") return resourceNamespace } From f1c078cf58cfe783390189516eb66902029eebcc Mon Sep 17 00:00:00 2001 From: Alessandro Thea Date: Thu, 2 Nov 2023 11:42:58 +0100 Subject: [PATCH 4/6] Removing nils --- flx-plugin/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flx-plugin/main.go b/flx-plugin/main.go index 89d7384..6aca294 100644 --- a/flx-plugin/main.go +++ b/flx-plugin/main.go @@ -114,7 +114,7 @@ func (p *Plugin) Allocate(ctx context.Context, r *pluginapi.AllocateRequest) (*p func (p* Plugin) GetDevicePluginOptions(context.Context, *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error) { fmt.Println("GetDevicePluginOptions()", p.name) - return nil, nil + return &v1beta1.DevicePluginOptions{}, nil } // PreStartContainer is called, if indicated by Device Plugin during registeration phase, @@ -123,13 +123,13 @@ func (p* Plugin) GetDevicePluginOptions(context.Context, *pluginapi.Empty) (*plu func (p* Plugin) PreStartContainer(context.Context, *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error) { fmt.Println("GetDevicePluginOptions()", p.name) - return nil, nil + return &v1beta1.PreStartContainerResponse{}, nil } func (p *Plugin) GetPreferredAllocation(ctx context.Context, request *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error) { fmt.Println("GetPreferredAllocation()", p.name) - return nil, nil + return &v1beta1.PreferredAllocationResponse{}, nil } func (l FLXLister) GetResourceNamespace() string { From c9f467b5392a38545bceca2151154ea69bc3a84f Mon Sep 17 00:00:00 2001 From: Alessandro Thea Date: Thu, 2 Nov 2023 11:46:49 +0100 Subject: [PATCH 5/6] Fixing imports? --- flx-plugin/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flx-plugin/main.go b/flx-plugin/main.go index 6aca294..c0da79b 100644 --- a/flx-plugin/main.go +++ b/flx-plugin/main.go @@ -15,7 +15,8 @@ import ( "golang.org/x/net/context" "github.com/kubevirt/device-plugin-manager/pkg/dpm" - pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1" + "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1" + // pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1" ) // FLXLister is the object responsible for discovering initial pool of devices and their allocation From 68f5c1d21fc86906eb6405e5585e9e7b1ff42a65 Mon Sep 17 00:00:00 2001 From: Alessandro Thea Date: Thu, 2 Nov 2023 11:55:57 +0100 Subject: [PATCH 6/6] more fixes --- flx-plugin/go.mod | 2 +- flx-plugin/main.go | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/flx-plugin/go.mod b/flx-plugin/go.mod index 2d94be7..4dab44f 100644 --- a/flx-plugin/go.mod +++ b/flx-plugin/go.mod @@ -1,6 +1,6 @@ module flx-dev-plugin -go 1.23 +go 1.21 require ( github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b diff --git a/flx-plugin/main.go b/flx-plugin/main.go index c0da79b..5dff9cf 100644 --- a/flx-plugin/main.go +++ b/flx-plugin/main.go @@ -15,8 +15,7 @@ import ( "golang.org/x/net/context" "github.com/kubevirt/device-plugin-manager/pkg/dpm" - "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1" - // pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1" + pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1" ) // FLXLister is the object responsible for discovering initial pool of devices and their allocation @@ -48,7 +47,7 @@ const ( // ListAndWatch returns a stream of List of Devices // Whenever a Device state changes or a Device disappears, ListAndWatch // returns the new list -func (p *Plugin) ListAndWatch(e *pluginapi.Empty, s pluginapi.x``) error { +func (p *Plugin) ListAndWatch(e *pluginapi.Empty, s pluginapi.DevicePlugin_ListAndWatchServer) error { fmt.Println("ListAndWatch()", p.name) var devs []*pluginapi.Device @@ -115,7 +114,7 @@ func (p *Plugin) Allocate(ctx context.Context, r *pluginapi.AllocateRequest) (*p func (p* Plugin) GetDevicePluginOptions(context.Context, *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error) { fmt.Println("GetDevicePluginOptions()", p.name) - return &v1beta1.DevicePluginOptions{}, nil + return &pluginapi.DevicePluginOptions{}, nil } // PreStartContainer is called, if indicated by Device Plugin during registeration phase, @@ -124,13 +123,13 @@ func (p* Plugin) GetDevicePluginOptions(context.Context, *pluginapi.Empty) (*plu func (p* Plugin) PreStartContainer(context.Context, *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error) { fmt.Println("GetDevicePluginOptions()", p.name) - return &v1beta1.PreStartContainerResponse{}, nil + return &pluginapi.PreStartContainerResponse{}, nil } func (p *Plugin) GetPreferredAllocation(ctx context.Context, request *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error) { fmt.Println("GetPreferredAllocation()", p.name) - return &v1beta1.PreferredAllocationResponse{}, nil + return &pluginapi.PreferredAllocationResponse{}, nil } func (l FLXLister) GetResourceNamespace() string {