Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factory cleanup #3354

Merged
merged 6 commits into from
Feb 11, 2022
Merged

Factory cleanup #3354

merged 6 commits into from
Feb 11, 2022

Commits on Feb 3, 2022

  1. libct: Container, Factory: rm InitPath, InitArgs

    Those are *always* /proc/self/exe init, and it does not make sense
    to ever change these. More to say, if InitArgs option func (removed
    by this commit) is used to change these parameters, it will break
    things, since "init" is hardcoded elsewhere.
    
    Remove this.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 3, 2022
    Configuration menu
    Copy the full SHA
    630c0d7 View commit details
    Browse the repository at this point in the history
  2. libct: remove Validator interface

    We only have one implementation of config validator, which is always
    used. It makes no sense to have Validator interface.
    
    Having validate.Validator field in Factory does not make sense for all
    the same reasons.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 3, 2022
    Configuration menu
    Copy the full SHA
    0d21515 View commit details
    Browse the repository at this point in the history
  3. libct: Container, Factory: rm newuidmap/newgidmap

    These were introduced in commit d8b6694 back in 2017, with a TODO
    of "make binary names configurable". Apparently, everyone is happy with
    the hardcoded names. In fact, they *are* configurable (by prepending the
    PATH with a directory containing own version of newuidmap/newgidmap).
    
    Now, these binaries are only needed in a few specific cases (when
    rootless is set etc.), so let's look them up only when needed.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 3, 2022
    Configuration menu
    Copy the full SHA
    39bd7b7 View commit details
    Browse the repository at this point in the history

Commits on Feb 4, 2022

  1. libct/start: use execabs for newuidmap lookup

    Since we are looking up the path to newuidmap/newgidmap in one context,
    and executing those in another (libct/nsenter), it might make sense to
    use a stricter rules for looking up path to those binaries.
    
    Practically it means that if someone wants to use custom newuidmap and
    newgidmap binaries from $PATH, it would be impossible to use these from
    the current directory by means of PATH=.:$PATH; instead one would have
    to do something like PATH=$(pwd):$PATH.
    
    See https://go.dev/blog/path-security for background.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 4, 2022
    Configuration menu
    Copy the full SHA
    9258eac View commit details
    Browse the repository at this point in the history
  2. libct: rm TestGetContainerStats, mockIntelRdtManager

    TestGetContainerStats test a function that is smaller than the test
    itself, and only calls a couple of other functions (which are
    represented by mocks). It does not make sense to have it.
    
    mockIntelRdtManager is only needed for TestGetContainerStats
    and TestGetContainerState, which basically tests that Path
    is called. Also, it does not make much sense to have it.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 4, 2022
    Configuration menu
    Copy the full SHA
    8593285 View commit details
    Browse the repository at this point in the history
  3. libct: rm intelrtd.Manager interface, NewIntelRdtManager

    Remove intelrtd.Manager interface, since we only have a single
    implementation, and do not expect another one.
    
    Rename intelRdtManager to Manager, and modify its users accordingly.
    
    Remove NewIntelRdtManager from factory.
    
    Remove IntelRdtfs. Instead, make intelrdt.NewManager return nil if the
    feature is not available.
    
    Remove TestFactoryNewIntelRdt as it is now identical to TestFactoryNew.
    
    Add internal function newManager to be used for tests (to make sure
    some testing is done even when the feature is not available in
    kernel/hardware).
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 4, 2022
    Configuration menu
    Copy the full SHA
    dbd990d View commit details
    Browse the repository at this point in the history