Skip to content

Commit 917a556

Browse files
authored
Merge pull request kubernetes#130250 from marosset/withdraw-windows-hostnetwork
Withdraw alpha support for HostNetwork containers on Windows
2 parents f8cc9c9 + 9837a61 commit 917a556

File tree

6 files changed

+9
-94
lines changed

6 files changed

+9
-94
lines changed

pkg/features/versioned_kube_features.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,8 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
856856
},
857857

858858
WindowsHostNetwork: {
859-
{Version: version.MustParse("1.26"), Default: true, PreRelease: featuregate.Alpha},
859+
{Version: version.MustParse("1.26"), Default: false, PreRelease: featuregate.Alpha},
860+
{Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Deprecated},
860861
},
861862

862863
zpagesfeatures.ComponentFlagz: {

pkg/kubelet/kuberuntime/kuberuntime_sandbox.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ import (
2525

2626
v1 "k8s.io/api/core/v1"
2727
kubetypes "k8s.io/apimachinery/pkg/types"
28-
utilfeature "k8s.io/apiserver/pkg/util/feature"
2928
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
3029
"k8s.io/klog/v2"
3130
"k8s.io/kubelet/pkg/types"
32-
"k8s.io/kubernetes/pkg/features"
3331
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
3432
runtimeutil "k8s.io/kubernetes/pkg/kubelet/kuberuntime/util"
3533
"k8s.io/kubernetes/pkg/kubelet/util"
@@ -239,15 +237,6 @@ func (m *kubeGenericRuntimeManager) generatePodSandboxWindowsConfig(pod *v1.Pod)
239237
SecurityContext: &runtimeapi.WindowsSandboxSecurityContext{},
240238
}
241239

242-
if utilfeature.DefaultFeatureGate.Enabled(features.WindowsHostNetwork) {
243-
wc.SecurityContext.NamespaceOptions = &runtimeapi.WindowsNamespaceOption{}
244-
if kubecontainer.IsHostNetworkPod(pod) {
245-
wc.SecurityContext.NamespaceOptions.Network = runtimeapi.NamespaceMode_NODE
246-
} else {
247-
wc.SecurityContext.NamespaceOptions.Network = runtimeapi.NamespaceMode_POD
248-
}
249-
}
250-
251240
// If all of the containers in a pod are HostProcess containers, set the pod's HostProcess field
252241
// explicitly because the container runtime requires this information at sandbox creation time.
253242
if kubecontainer.HasWindowsHostProcessContainer(pod) {

pkg/kubelet/kuberuntime/kuberuntime_sandbox_test.go

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -392,82 +392,3 @@ func TestGeneratePodSandboxWindowsConfig_HostProcess(t *testing.T) {
392392
})
393393
}
394394
}
395-
396-
func TestGeneratePodSandboxWindowsConfig_HostNetwork(t *testing.T) {
397-
_, _, m, err := createTestRuntimeManager()
398-
require.NoError(t, err)
399-
400-
const containerName = "container"
401-
402-
testCases := []struct {
403-
name string
404-
hostNetworkFeatureEnabled bool
405-
podSpec *v1.PodSpec
406-
expectedWindowsConfig *runtimeapi.WindowsPodSandboxConfig
407-
}{
408-
{
409-
name: "feature disabled, hostNetwork=false",
410-
hostNetworkFeatureEnabled: false,
411-
podSpec: &v1.PodSpec{
412-
HostNetwork: false,
413-
Containers: []v1.Container{{Name: containerName}},
414-
},
415-
expectedWindowsConfig: &runtimeapi.WindowsPodSandboxConfig{
416-
SecurityContext: &runtimeapi.WindowsSandboxSecurityContext{},
417-
},
418-
},
419-
{
420-
name: "feature disabled, hostNetwork=true",
421-
hostNetworkFeatureEnabled: false,
422-
podSpec: &v1.PodSpec{
423-
HostNetwork: true,
424-
Containers: []v1.Container{{Name: containerName}},
425-
},
426-
expectedWindowsConfig: &runtimeapi.WindowsPodSandboxConfig{
427-
SecurityContext: &runtimeapi.WindowsSandboxSecurityContext{},
428-
}},
429-
{
430-
name: "feature enabled, hostNetwork=false",
431-
hostNetworkFeatureEnabled: true,
432-
podSpec: &v1.PodSpec{
433-
HostNetwork: false,
434-
Containers: []v1.Container{{Name: containerName}},
435-
},
436-
expectedWindowsConfig: &runtimeapi.WindowsPodSandboxConfig{
437-
SecurityContext: &runtimeapi.WindowsSandboxSecurityContext{
438-
NamespaceOptions: &runtimeapi.WindowsNamespaceOption{
439-
Network: runtimeapi.NamespaceMode_POD,
440-
},
441-
},
442-
},
443-
},
444-
{
445-
name: "feature enabled, hostNetwork=true",
446-
hostNetworkFeatureEnabled: true,
447-
podSpec: &v1.PodSpec{
448-
HostNetwork: true,
449-
Containers: []v1.Container{{Name: containerName}},
450-
},
451-
expectedWindowsConfig: &runtimeapi.WindowsPodSandboxConfig{
452-
SecurityContext: &runtimeapi.WindowsSandboxSecurityContext{
453-
NamespaceOptions: &runtimeapi.WindowsNamespaceOption{
454-
Network: runtimeapi.NamespaceMode_NODE,
455-
},
456-
},
457-
},
458-
},
459-
}
460-
461-
for _, testCase := range testCases {
462-
t.Run(testCase.name, func(t *testing.T) {
463-
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.WindowsHostNetwork, testCase.hostNetworkFeatureEnabled)
464-
pod := &v1.Pod{}
465-
pod.Spec = *testCase.podSpec
466-
467-
wc, err := m.generatePodSandboxWindowsConfig(pod)
468-
469-
assert.Equal(t, testCase.expectedWindowsConfig, wc)
470-
assert.NoError(t, err)
471-
})
472-
}
473-
}

staging/src/k8s.io/cri-api/pkg/apis/runtime/v1/api.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

staging/src/k8s.io/cri-api/pkg/apis/runtime/v1/api.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ message LinuxContainerUser {
10111011
// WindowsNamespaceOption provides options for Windows namespaces.
10121012
message WindowsNamespaceOption {
10131013
// Network namespace for this container/sandbox.
1014-
// Namespaces currently set by the kubelet: POD, NODE
1014+
// This is currently never set by the kubelet
10151015
NamespaceMode network = 1;
10161016
}
10171017

test/compatibility_lifecycle/reference/versioned_feature_list.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1623,10 +1623,14 @@
16231623
version: "1.32"
16241624
- name: WindowsHostNetwork
16251625
versionedSpecs:
1626-
- default: true
1626+
- default: false
16271627
lockToDefault: false
16281628
preRelease: Alpha
16291629
version: "1.26"
1630+
- default: false
1631+
lockToDefault: false
1632+
preRelease: Deprecated
1633+
version: "1.33"
16301634
- name: WinDSR
16311635
versionedSpecs:
16321636
- default: false

0 commit comments

Comments
 (0)