mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +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.
|
||||
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
|
||||
// alpha: v1.6
|
||||
//
|
||||
@ -155,6 +162,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
|
||||
ExperimentalHostUserNamespaceDefaultingGate: {Default: false, PreRelease: utilfeature.Beta},
|
||||
ExperimentalCriticalPodAnnotation: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
Accelerators: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
DevicePlugins: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
TaintBasedEvictions: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
RotateKubeletServerCertificate: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
RotateKubeletClientCertificate: {Default: true, PreRelease: utilfeature.Beta},
|
||||
|
@ -17,6 +17,8 @@ limitations under the License.
|
||||
package deviceplugin
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -25,11 +27,14 @@ import (
|
||||
pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1alpha1"
|
||||
)
|
||||
|
||||
const (
|
||||
socket = "/tmp/mock.sock"
|
||||
var (
|
||||
esocketName = "mock.sock"
|
||||
)
|
||||
|
||||
func TestNewEndpoint(t *testing.T) {
|
||||
wd, _ := os.Getwd()
|
||||
socket := path.Join(wd, esocketName)
|
||||
|
||||
devs := []*pluginapi.Device{
|
||||
{ID: "ADeviceId", Health: pluginapi.Healthy},
|
||||
}
|
||||
@ -39,6 +44,9 @@ func TestNewEndpoint(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestList(t *testing.T) {
|
||||
wd, _ := os.Getwd()
|
||||
socket := path.Join(wd, esocketName)
|
||||
|
||||
devs := []*pluginapi.Device{
|
||||
{ID: "ADeviceId", Health: pluginapi.Healthy},
|
||||
}
|
||||
@ -62,6 +70,9 @@ func TestList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListAndWatch(t *testing.T) {
|
||||
wd, _ := os.Getwd()
|
||||
socket := path.Join(wd, esocketName)
|
||||
|
||||
devs := []*pluginapi.Device{
|
||||
{ID: "ADeviceId", Health: pluginapi.Healthy},
|
||||
{ID: "AnotherDeviceId", Health: pluginapi.Healthy},
|
||||
|
@ -17,6 +17,8 @@ limitations under the License.
|
||||
package deviceplugin
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
@ -25,19 +27,25 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
msocket = "/tmp/server.sock"
|
||||
msocketName = "/tmp/server.sock"
|
||||
)
|
||||
|
||||
func TestNewManagerImpl(t *testing.T) {
|
||||
wd, _ := os.Getwd()
|
||||
socket := path.Join(wd, msocketName)
|
||||
|
||||
_, err := NewManagerImpl("", func(n string, a, u, r []*pluginapi.Device) {})
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -754,13 +754,15 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
devicePluginHdlr, err := cm.NewDevicePluginHandler()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.DevicePlugins) {
|
||||
devicePluginHdlr, err := cm.NewDevicePluginHandler()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
klet.containerManager.SetDevicePluginHandler(devicePluginHdlr)
|
||||
|
||||
}
|
||||
|
||||
klet.containerManager.SetDevicePluginHandler(devicePluginHdlr)
|
||||
|
||||
// If the experimentalMounterPathFlag is set, we do not want to
|
||||
// check node capabilities since the mount path is not the default
|
||||
if len(kubeCfg.ExperimentalMounterPath) != 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user