k8s.io/kubernetes@v1.29.3/pkg/kubelet/cm/devicemanager/plugin/v1beta1/api.go (about) 1 /* 2 Copyright 2022 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package v1beta1 18 19 import ( 20 api "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1" 21 ) 22 23 // RegistrationHandler is an interface for handling device plugin registration 24 // and plugin directory cleanup. 25 type RegistrationHandler interface { 26 CleanupPluginDirectory(string) error 27 } 28 29 // ClientHandler is an interface for handling device plugin connections. 30 type ClientHandler interface { 31 PluginConnected(string, DevicePlugin) error 32 PluginDisconnected(string) 33 PluginListAndWatchReceiver(string, *api.ListAndWatchResponse) 34 } 35 36 // TODO: evaluate whether we need these error definitions. 37 const ( 38 // errFailedToDialDevicePlugin is the error raised when the device plugin could not be 39 // reached on the registered socket 40 errFailedToDialDevicePlugin = "failed to dial device plugin:" 41 // errUnsupportedVersion is the error raised when the device plugin uses an API version not 42 // supported by the Kubelet registry 43 errUnsupportedVersion = "requested API version %q is not supported by kubelet. Supported version is %q" 44 // errInvalidResourceName is the error raised when a device plugin is registering 45 // itself with an invalid ResourceName 46 errInvalidResourceName = "the ResourceName %q is invalid" 47 // errBadSocket is the error raised when the registry socket path is not absolute 48 errBadSocket = "bad socketPath, must be an absolute path:" 49 )