Change:
When calling draplugin.Start without supplying kubeclient no error is reported, while the kubeclient is vital for further announcement of resourceSlice. An error needs to be returned when nodeName or kubeclient parameters are not set. Do not supply kubeclient parameter when creating draplugin, for isntance here: No response master <details</details<details</details<details</details<details</details<details</details
/sig node /triage accepted /project 95

Discussion:
// to the API server. // // The caller must not modify the content after the call. <del> PublishResources(ctx context.Context, resources Resources) </del> <ins> // // Returns an error if KubeClient or NodeName options were not // set in Start() to create the DRAPlugin instance. PublishResources(ctx context.Context, resources Resources) error </ins> // This unexported method ensures that we can modify the interface // without causing an API break of the package

// The context and/or DRAPlugin.Stop can be used to stop all background activity. // Stop also blocks. A logger can be stored in the context to add values or // a name to all log entries. <ins> // // If the plugin will be used to publish resources, [KubeClient] and [NodeName] // options are mandatory. </ins> func Start(ctx context.Context, nodeServer interface{}, opts ...Option) (result DRAPlugin, finalErr error) { logger := klog.FromContext(ctx) o := options{

d.wg.Wait() } <del> // PublishResources implements [DRAPlugin.PublishResources]. func (d *draPlugin) PublishResources(ctx context.Context, resources Resources) { </del> <ins> // PublishResources implements [DRAPlugin.PublishResources]. Returns en error if // kubeClient or nodeName are unset. func (d *draPlugin) PublishResources(ctx context.Context, resources Resources) error { if d.kubeClient == nil { return errors.New("no KubeClient found to publish resources") } if d.nodeName == "" { return errors.New("no NodeName was set to publish resources") } </ins> d.mutex.Lock() defer d.mutex.Unlock()

controllerLogger = klog.LoggerWithName(controllerLogger, "ResourceSlice controller") controllerCtx = klog.NewContext(controllerCtx, controllerLogger) d.resourceSliceController = resourceslice.StartController(controllerCtx, d.kubeClient, d.driverName, owner, driverResources) <del> return </del> <ins> return nil </ins> } // Inform running controller about new information. d.resourceSliceController.Update(driverResources) <ins> return nil </ins> } // RegistrationStatus implements [DRAPlugin.RegistrationStatus].

resources := kubeletplugin.Resources{ Devices: devices, } <del> ex.d.PublishResources(ctx, resources) </del> <ins> if err := ex.d.PublishResources(ctx, resources); err != nil { return nil, fmt.Errorf("start kubelet plugin: publish resources: %w", err) } </ins> } else if len(ex.fileOps.Devices) > 0 { devices := make([]resourceapi.Device, len(ex.fileOps.Devices)) for i, deviceName := range sets.List(ex.deviceNames) {

resources := kubeletplugin.Resources{ Devices: devices, } <del> ex.d.PublishResources(ctx, resources) </del> <ins> if err := ex.d.PublishResources(ctx, resources); err != nil { return nil, fmt.Errorf("start kubelet plugin: publish resources: %w", err) } </ins> } return ex, nil