mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
add import-alias for k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1
This commit is contained in:
parent
d448651e9d
commit
4d5d5b71d2
@ -36,5 +36,6 @@
|
||||
"k8s.io/api/storage/v1beta1": "storagev1beta1",
|
||||
"k8s.io/kubernetes/pkg/controller/apis/config/v1alpha1": "controllerconfigv1alpha1",
|
||||
"k8s.io/kubernetes/pkg/kubelet/apis/config/v1beta1": "kubeletconfigv1beta1",
|
||||
"k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1alpha": "kubeletdevicepluginv1alpha"
|
||||
"k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1alpha": "kubeletdevicepluginv1alpha",
|
||||
"k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1": "kubeletdevicepluginv1beta1"
|
||||
}
|
@ -34,7 +34,7 @@ import (
|
||||
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
|
||||
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
||||
|
||||
pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1"
|
||||
kubeletdevicepluginv1beta1 "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1"
|
||||
dm "k8s.io/kubernetes/pkg/kubelet/cm/devicemanager"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
@ -65,9 +65,9 @@ func testDevicePlugin(f *framework.Framework, pluginSockDir string) {
|
||||
It("Verifies the Kubelet device plugin functionality.", func() {
|
||||
By("Start stub device plugin")
|
||||
// fake devices for e2e test
|
||||
devs := []*pluginapi.Device{
|
||||
{ID: "Dev-1", Health: pluginapi.Healthy},
|
||||
{ID: "Dev-2", Health: pluginapi.Healthy},
|
||||
devs := []*kubeletdevicepluginv1beta1.Device{
|
||||
{ID: "Dev-1", Health: kubeletdevicepluginv1beta1.Healthy},
|
||||
{ID: "Dev-2", Health: kubeletdevicepluginv1beta1.Healthy},
|
||||
}
|
||||
|
||||
socketPath := pluginSockDir + "dp." + fmt.Sprintf("%d", time.Now().Unix())
|
||||
@ -79,7 +79,7 @@ func testDevicePlugin(f *framework.Framework, pluginSockDir string) {
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
By("Register resources")
|
||||
err = dp1.Register(pluginapi.KubeletSocket, resourceName, pluginSockDir)
|
||||
err = dp1.Register(kubeletdevicepluginv1beta1.KubeletSocket, resourceName, pluginSockDir)
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
By("Waiting for the resource exported by the stub device plugin to become available on the local node")
|
||||
@ -142,7 +142,7 @@ func testDevicePlugin(f *framework.Framework, pluginSockDir string) {
|
||||
err = dp1.Start()
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
err = dp1.Register(pluginapi.KubeletSocket, resourceName, pluginSockDir)
|
||||
err = dp1.Register(kubeletdevicepluginv1beta1.KubeletSocket, resourceName, pluginSockDir)
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
ensurePodContainerRestart(f, pod1.Name, pod1.Name)
|
||||
@ -192,7 +192,7 @@ func testDevicePlugin(f *framework.Framework, pluginSockDir string) {
|
||||
err = dp1.Start()
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
err = dp1.Register(pluginapi.KubeletSocket, resourceName, pluginSockDir)
|
||||
err = dp1.Register(kubeletdevicepluginv1beta1.KubeletSocket, resourceName, pluginSockDir)
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
By("Waiting for the resource exported by the stub device plugin to become healthy on the local node")
|
||||
@ -302,17 +302,17 @@ func numberOfDevicesAllocatable(node *v1.Node, resourceName string) int64 {
|
||||
}
|
||||
|
||||
// stubAllocFunc will pass to stub device plugin
|
||||
func stubAllocFunc(r *pluginapi.AllocateRequest, devs map[string]pluginapi.Device) (*pluginapi.AllocateResponse, error) {
|
||||
var responses pluginapi.AllocateResponse
|
||||
func stubAllocFunc(r *kubeletdevicepluginv1beta1.AllocateRequest, devs map[string]kubeletdevicepluginv1beta1.Device) (*kubeletdevicepluginv1beta1.AllocateResponse, error) {
|
||||
var responses kubeletdevicepluginv1beta1.AllocateResponse
|
||||
for _, req := range r.ContainerRequests {
|
||||
response := &pluginapi.ContainerAllocateResponse{}
|
||||
response := &kubeletdevicepluginv1beta1.ContainerAllocateResponse{}
|
||||
for _, requestID := range req.DevicesIDs {
|
||||
dev, ok := devs[requestID]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("invalid allocation request with non-existing device %s", requestID)
|
||||
}
|
||||
|
||||
if dev.Health != pluginapi.Healthy {
|
||||
if dev.Health != kubeletdevicepluginv1beta1.Healthy {
|
||||
return nil, fmt.Errorf("invalid allocation request with unhealthy device: %s", requestID)
|
||||
}
|
||||
|
||||
@ -328,7 +328,7 @@ func stubAllocFunc(r *pluginapi.AllocateRequest, devs map[string]pluginapi.Devic
|
||||
|
||||
f.Close()
|
||||
|
||||
response.Mounts = append(response.Mounts, &pluginapi.Mount{
|
||||
response.Mounts = append(response.Mounts, &kubeletdevicepluginv1beta1.Mount{
|
||||
ContainerPath: fpath,
|
||||
HostPath: fpath,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user