userns: Wrap more errors

Most errors where already wrapped, but these were missing.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
This commit is contained in:
Rodrigo Campos 2025-05-06 15:01:32 +02:00
parent c0eb9e3433
commit e885986393

View File

@ -434,12 +434,12 @@ func (m *UsernsManager) GetOrCreateUserNamespaceMappings(pod *v1.Pod, runtimeHan
if string(content) != "" {
userNs, err = m.parseUserNsFileAndRecord(pod.UID, content)
if err != nil {
return nil, err
return nil, fmt.Errorf("user namespace: %w", err)
}
} else {
userNs, err = m.createUserNs(pod)
if err != nil {
return nil, err
return nil, fmt.Errorf("create user namespace: %w", err)
}
}
@ -490,7 +490,7 @@ func (m *UsernsManager) CleanupOrphanedPodUsernsAllocations(pods []*v1.Pod, runn
allFound := sets.New[string]()
found, err := m.kl.ListPodsFromDisk()
if err != nil {
return err
return fmt.Errorf("user namespace: read pods from disk: %w", err)
}
for _, podUID := range found {