kubelet: Don't reserve mapping for userns phase II

Latest changes to KEP-127 removed that phase, so let's stop reserving
those IDs for that.

While we are there, we replace 0 for 0*65536 as before we had a bug that
we were not multiplying the index, to avoid bugs in the future.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
This commit is contained in:
Rodrigo Campos 2023-03-07 17:33:46 +01:00 committed by Giuseppe Scrivano
parent 8af3cce7fe
commit 16d76f6813
No known key found for this signature in database
GPG Key ID: 67E38F7A8BA21772
2 changed files with 1 additions and 7 deletions

View File

@ -141,11 +141,6 @@ func MakeUserNsManager(kl userNsPodsManager) (*usernsManager, error) {
return nil, err
}
// Second block will be used for phase II. Don't assign that range for now.
if _, err := m.used.Allocate(1); err != nil {
return nil, err
}
// do not bother reading the list of pods if user namespaces are not enabled.
if !utilfeature.DefaultFeatureGate.Enabled(features.UserNamespacesStatelessPodsSupport) {
return &m, nil

View File

@ -46,8 +46,7 @@ func TestUserNsManagerAllocate(t *testing.T) {
m, err := MakeUserNsManager(testUserNsPodsManager)
require.NoError(t, err)
assert.Equal(t, true, m.isSet(0), "m.isSet(0) should be true")
assert.Equal(t, true, m.isSet(1), "m.isSet(1) should be true")
assert.Equal(t, true, m.isSet(0*65536), "m.isSet(0) should be true")
allocated, length, err := m.allocateOne("one")
assert.NoError(t, err)