mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
Alpha feature integration
This commit is contained in:
parent
f7f4515e43
commit
7a8ad491ef
@ -73,6 +73,13 @@ const (
|
|||||||
// Works only with Docker Container Runtime.
|
// Works only with Docker Container Runtime.
|
||||||
Accelerators utilfeature.Feature = "Accelerators"
|
Accelerators utilfeature.Feature = "Accelerators"
|
||||||
|
|
||||||
|
// owner: @vishh
|
||||||
|
// alpha: v1.8
|
||||||
|
//
|
||||||
|
// Enables support for Device Plugins
|
||||||
|
// Only Nvidia GPUs are supported as of v1.8.
|
||||||
|
DevicePlugins utilfeature.Feature = "DevicePlugins"
|
||||||
|
|
||||||
// owner: @gmarek
|
// owner: @gmarek
|
||||||
// alpha: v1.6
|
// alpha: v1.6
|
||||||
//
|
//
|
||||||
@ -155,6 +162,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
|
|||||||
ExperimentalHostUserNamespaceDefaultingGate: {Default: false, PreRelease: utilfeature.Beta},
|
ExperimentalHostUserNamespaceDefaultingGate: {Default: false, PreRelease: utilfeature.Beta},
|
||||||
ExperimentalCriticalPodAnnotation: {Default: false, PreRelease: utilfeature.Alpha},
|
ExperimentalCriticalPodAnnotation: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
Accelerators: {Default: false, PreRelease: utilfeature.Alpha},
|
Accelerators: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
|
DevicePlugins: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
TaintBasedEvictions: {Default: false, PreRelease: utilfeature.Alpha},
|
TaintBasedEvictions: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
RotateKubeletServerCertificate: {Default: false, PreRelease: utilfeature.Alpha},
|
RotateKubeletServerCertificate: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
RotateKubeletClientCertificate: {Default: true, PreRelease: utilfeature.Beta},
|
RotateKubeletClientCertificate: {Default: true, PreRelease: utilfeature.Beta},
|
||||||
|
@ -17,6 +17,8 @@ limitations under the License.
|
|||||||
package deviceplugin
|
package deviceplugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -25,11 +27,14 @@ import (
|
|||||||
pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1alpha1"
|
pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1alpha1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
var (
|
||||||
socket = "/tmp/mock.sock"
|
esocketName = "mock.sock"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewEndpoint(t *testing.T) {
|
func TestNewEndpoint(t *testing.T) {
|
||||||
|
wd, _ := os.Getwd()
|
||||||
|
socket := path.Join(wd, esocketName)
|
||||||
|
|
||||||
devs := []*pluginapi.Device{
|
devs := []*pluginapi.Device{
|
||||||
{ID: "ADeviceId", Health: pluginapi.Healthy},
|
{ID: "ADeviceId", Health: pluginapi.Healthy},
|
||||||
}
|
}
|
||||||
@ -39,6 +44,9 @@ func TestNewEndpoint(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestList(t *testing.T) {
|
func TestList(t *testing.T) {
|
||||||
|
wd, _ := os.Getwd()
|
||||||
|
socket := path.Join(wd, esocketName)
|
||||||
|
|
||||||
devs := []*pluginapi.Device{
|
devs := []*pluginapi.Device{
|
||||||
{ID: "ADeviceId", Health: pluginapi.Healthy},
|
{ID: "ADeviceId", Health: pluginapi.Healthy},
|
||||||
}
|
}
|
||||||
@ -62,6 +70,9 @@ func TestList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestListAndWatch(t *testing.T) {
|
func TestListAndWatch(t *testing.T) {
|
||||||
|
wd, _ := os.Getwd()
|
||||||
|
socket := path.Join(wd, esocketName)
|
||||||
|
|
||||||
devs := []*pluginapi.Device{
|
devs := []*pluginapi.Device{
|
||||||
{ID: "ADeviceId", Health: pluginapi.Healthy},
|
{ID: "ADeviceId", Health: pluginapi.Healthy},
|
||||||
{ID: "AnotherDeviceId", Health: pluginapi.Healthy},
|
{ID: "AnotherDeviceId", Health: pluginapi.Healthy},
|
||||||
|
@ -17,6 +17,8 @@ limitations under the License.
|
|||||||
package deviceplugin
|
package deviceplugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
@ -25,19 +27,25 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
msocket = "/tmp/server.sock"
|
msocketName = "/tmp/server.sock"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewManagerImpl(t *testing.T) {
|
func TestNewManagerImpl(t *testing.T) {
|
||||||
|
wd, _ := os.Getwd()
|
||||||
|
socket := path.Join(wd, msocketName)
|
||||||
|
|
||||||
_, err := NewManagerImpl("", func(n string, a, u, r []*pluginapi.Device) {})
|
_, err := NewManagerImpl("", func(n string, a, u, r []*pluginapi.Device) {})
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
|
|
||||||
_, err = NewManagerImpl(msocket, func(n string, a, u, r []*pluginapi.Device) {})
|
_, err = NewManagerImpl(socket, func(n string, a, u, r []*pluginapi.Device) {})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNewManagerImplStart(t *testing.T) {
|
func TestNewManagerImplStart(t *testing.T) {
|
||||||
_, err := NewManagerImpl(msocket, func(n string, a, u, r []*pluginapi.Device) {})
|
wd, _ := os.Getwd()
|
||||||
|
socket := path.Join(wd, msocketName)
|
||||||
|
|
||||||
|
_, err := NewManagerImpl(socket, func(n string, a, u, r []*pluginapi.Device) {})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,13 +754,15 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
devicePluginHdlr, err := cm.NewDevicePluginHandler()
|
if utilfeature.DefaultFeatureGate.Enabled(features.DevicePlugins) {
|
||||||
if err != nil {
|
devicePluginHdlr, err := cm.NewDevicePluginHandler()
|
||||||
return nil, err
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
klet.containerManager.SetDevicePluginHandler(devicePluginHdlr)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
klet.containerManager.SetDevicePluginHandler(devicePluginHdlr)
|
|
||||||
|
|
||||||
// If the experimentalMounterPathFlag is set, we do not want to
|
// If the experimentalMounterPathFlag is set, we do not want to
|
||||||
// check node capabilities since the mount path is not the default
|
// check node capabilities since the mount path is not the default
|
||||||
if len(kubeCfg.ExperimentalMounterPath) != 0 {
|
if len(kubeCfg.ExperimentalMounterPath) != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user