devicePluginForResource creates a device plugin for the specified resource.
(ctx context.Context, resourceManager rm.ResourceManager)
| 71 | |
| 72 | // devicePluginForResource creates a device plugin for the specified resource. |
| 73 | func (o *options) devicePluginForResource(ctx context.Context, resourceManager rm.ResourceManager) (Interface, error) { |
| 74 | mpsOptions, err := o.getMPSOptions(resourceManager) |
| 75 | if err != nil { |
| 76 | return nil, err |
| 77 | } |
| 78 | |
| 79 | plugin := nvidiaDevicePlugin{ |
| 80 | ctx: ctx, |
| 81 | rm: resourceManager, |
| 82 | config: o.config, |
| 83 | deviceListStrategies: o.deviceListStrategies, |
| 84 | |
| 85 | cdiHandler: o.cdiHandler, |
| 86 | cdiAnnotationPrefix: *o.config.Flags.Plugin.CDIAnnotationPrefix, |
| 87 | |
| 88 | imexChannels: o.imexChannels, |
| 89 | |
| 90 | mps: mpsOptions, |
| 91 | |
| 92 | socket: getPluginSocketPath(resourceManager.Resource()), |
| 93 | // These will be reinitialized every |
| 94 | // time the plugin server is restarted. |
| 95 | server: nil, |
| 96 | health: nil, |
| 97 | stop: nil, |
| 98 | } |
| 99 | return &plugin, nil |
| 100 | } |
| 101 | |
| 102 | // getPluginSocketPath returns the socket to use for the specified resource. |
| 103 | func getPluginSocketPath(resource spec.ResourceName) string { |
no test coverage detected