k0s icon indicating copy to clipboard operation
k0s copied to clipboard

Refactor for UID/GID handling

Open juanluisvaladas opened this issue 1 year ago • 3 comments

Description

The PR has two commits with two directly related small refactors:

1- Log a warning when using uid 0 because the gid cannot be found for a specific user. 2- Remove references to the gid in all components. In many components we were not defining a gid in the code but we had the field in the struct and was being used. Effectively it was using gid 0. The chown calls now use gid -1, which means don't change the permissions to match the behavior of other components such as konnectivity.

Type of change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Documentation update

How Has This Been Tested?

  • [ ] Manual test
  • [ ] Auto test added

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] My commit messages are signed-off
  • [x] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] New and existing unit tests pass locally with my changes
  • [ ] Any dependent changes have been merged and published in downstream modules
  • [ ] I have checked my code and corrected any misspellings

juanluisvaladas avatar Feb 13 '24 13:02 juanluisvaladas

Related to #4062

juanluisvaladas avatar Feb 15 '24 15:02 juanluisvaladas

@twz123 I believe all your concerns should be addressed now. Can you please check the commit "Log when a call to users.GetUID fails" ? The other commit has no modifications.

There are quite a few calls to logrus.Warning(fmt.Errorf( or similar around that area but these are lines I haven't touched. I'm thinking of editing those too but the problem is there are A LOT of occurrences and eventually we end up modifying unrelated stuff.

juanluisvaladas avatar Feb 15 '24 15:02 juanluisvaladas

This pull request has merge conflicts that need to be resolved.

github-actions[bot] avatar Mar 14 '24 15:03 github-actions[bot]

The PR is marked as stale since no activity has been recorded in 30 days

github-actions[bot] avatar Apr 13 '24 23:04 github-actions[bot]