mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Add HyperVContainer feature gates
This commit is contained in:
parent
cabd2bb619
commit
a6d0cd0f01
@ -225,6 +225,12 @@ const (
|
|||||||
//
|
//
|
||||||
// Implement support for limiting pids in pods
|
// Implement support for limiting pids in pods
|
||||||
SupportPodPidsLimit utilfeature.Feature = "SupportPodPidsLimit"
|
SupportPodPidsLimit utilfeature.Feature = "SupportPodPidsLimit"
|
||||||
|
|
||||||
|
// owner: @feiskyer
|
||||||
|
// alpha: v1.10
|
||||||
|
//
|
||||||
|
// Enable Hyper-V containers on Windows
|
||||||
|
HyperVContainer utilfeature.Feature = "HyperVContainer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -265,6 +271,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
|
|||||||
ResourceLimitsPriorityFunction: {Default: false, PreRelease: utilfeature.Alpha},
|
ResourceLimitsPriorityFunction: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
SupportIPVSProxyMode: {Default: false, PreRelease: utilfeature.Beta},
|
SupportIPVSProxyMode: {Default: false, PreRelease: utilfeature.Beta},
|
||||||
SupportPodPidsLimit: {Default: false, PreRelease: utilfeature.Alpha},
|
SupportPodPidsLimit: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
|
HyperVContainer: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
|
|
||||||
// inherited features from generic apiserver, relisted here to get a conflict if it is changed
|
// inherited features from generic apiserver, relisted here to get a conflict if it is changed
|
||||||
// unintentionally on either side:
|
// unintentionally on either side:
|
||||||
|
@ -124,7 +124,13 @@ go_library(
|
|||||||
"//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
|
||||||
"//vendor/k8s.io/client-go/tools/remotecommand:go_default_library",
|
"//vendor/k8s.io/client-go/tools/remotecommand:go_default_library",
|
||||||
"//vendor/k8s.io/utils/exec:go_default_library",
|
"//vendor/k8s.io/utils/exec:go_default_library",
|
||||||
|
] + select({
|
||||||
|
"@io_bazel_rules_go//go/platform:windows": [
|
||||||
|
"//pkg/features:go_default_library",
|
||||||
|
"//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
],
|
],
|
||||||
|
"//conditions:default": [],
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
go_test(
|
go_test(
|
||||||
|
@ -26,6 +26,9 @@ import (
|
|||||||
dockercontainer "github.com/docker/docker/api/types/container"
|
dockercontainer "github.com/docker/docker/api/types/container"
|
||||||
dockerfilters "github.com/docker/docker/api/types/filters"
|
dockerfilters "github.com/docker/docker/api/types/filters"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
|
||||||
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -48,6 +51,10 @@ func (ds *dockerService) getSecurityOpts(seccompProfile string, separator rune)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func shouldIsolatedByHyperV(annotations map[string]string) bool {
|
func shouldIsolatedByHyperV(annotations map[string]string) bool {
|
||||||
|
if !utilfeature.DefaultFeatureGate.Enabled(features.HyperVContainer) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
v, ok := annotations[hypervIsolationAnnotationKey]
|
v, ok := annotations[hypervIsolationAnnotationKey]
|
||||||
return ok && v == hypervIsolation
|
return ok && v == hypervIsolation
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user