@@ -120,8 +120,9 @@ func getAllocatableLimits(cpu, memory, pids string, capacity v1.ResourceList) (*
120
120
}
121
121
122
122
const (
123
- kubeReservedCgroup = "kube-reserved"
124
- systemReservedCgroup = "system-reserved"
123
+ kubeReservedCgroup = "kube-reserved"
124
+ systemReservedCgroup = "system-reserved"
125
+ nodeAllocatableCgroup = "kubepods"
125
126
)
126
127
127
128
func createIfNotExists (cm cm.CgroupManager , cgroupConfig * cm.CgroupConfig ) error {
@@ -219,6 +220,18 @@ func runTest(ctx context.Context, f *framework.Framework) error {
219
220
return kubeletHealthCheck (kubeletHealthCheckURL )
220
221
}, time .Minute , time .Second ).Should (gomega .BeFalse ())
221
222
223
+ expectedNAPodCgroup := cm .NewCgroupName (cm .RootCgroupName , nodeAllocatableCgroup )
224
+
225
+ // Cleanup from the previous kubelet, to verify the new one creates it correctly
226
+ if err := cgroupManager .Destroy (& cm.CgroupConfig {
227
+ Name : cm .NewCgroupName (expectedNAPodCgroup ),
228
+ }); err != nil {
229
+ return err
230
+ }
231
+ if cgroupManager .Exists (expectedNAPodCgroup ) {
232
+ return fmt .Errorf ("Expected Node Allocatable Cgroup %q not to exist" , expectedNAPodCgroup )
233
+ }
234
+
222
235
framework .ExpectNoError (e2enodekubelet .WriteKubeletConfigFile (newCfg ))
223
236
224
237
ginkgo .By ("Starting the kubelet" )
@@ -235,10 +248,8 @@ func runTest(ctx context.Context, f *framework.Framework) error {
235
248
// Set new config and current config.
236
249
currentConfig := newCfg
237
250
238
- expectedNAPodCgroup := cm .ParseCgroupfsToCgroupName (currentConfig .CgroupRoot )
239
- expectedNAPodCgroup = cm .NewCgroupName (expectedNAPodCgroup , "kubepods" )
240
251
if ! cgroupManager .Exists (expectedNAPodCgroup ) {
241
- return fmt .Errorf ("Expected Node Allocatable Cgroup %q does not exist" , expectedNAPodCgroup )
252
+ return fmt .Errorf ("Expected Node Allocatable Cgroup %q to exist" , expectedNAPodCgroup )
242
253
}
243
254
244
255
memoryLimitFile := "memory.limit_in_bytes"
@@ -256,9 +267,9 @@ func runTest(ctx context.Context, f *framework.Framework) error {
256
267
if len (nodeList .Items ) != 1 {
257
268
return fmt .Errorf ("Unexpected number of node objects for node e2e. Expects only one node: %+v" , nodeList )
258
269
}
259
- cgroupName := "kubepods"
270
+ cgroupName := nodeAllocatableCgroup
260
271
if currentConfig .CgroupDriver == "systemd" {
261
- cgroupName = "kubepods .slice"
272
+ cgroupName = nodeAllocatableCgroup + " .slice"
262
273
}
263
274
264
275
node := nodeList .Items [0 ]
0 commit comments