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

Enable rkt driver to use address_mode = 'driver' #3256

Merged
merged 13 commits into from
Sep 26, 2017
Merged

Enable rkt driver to use address_mode = 'driver' #3256

merged 13 commits into from
Sep 26, 2017

Commits on Sep 20, 2017

  1. Use rkt prepare + run-prepared instead of run.

    The rkt driver currently executes run and asks that the pod UUID is
    written to a file that is then polled for changes for up to five
    seconds. Many container fetches will take longer than this, so this
    method will often not be able to track the pod UUID reliably.
    
    To avoid this problem, rkt allows pods to be first prepared, which will
    return their UUID, and then run as a second invocation.
    
    Here we convert the rkt driver's Start method to use this method
    instead. This way, the UUID will always be tracked correctly.
    dalegaard committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    3dafacd View commit details
    Browse the repository at this point in the history
  2. Expose rkt DriverNetwork

    Currently the rkt driver does not expose a DriverNetwork instance after
    starting the container, which means that address_mode = 'driver' does
    not work.
    
    To get the container network information, we can call `rkt status` on
    the UUID of the container and grab the container IP from there.
    
    For the port map, we need to grab the pod manifest as it will tell us
    which ports the container exposes. We then cross-reference the
    configured port name with the container port names, and use that to
    create a correct port mapping.
    
    To avoid doing a (bad) reimplementation of the appc schema(which rkt
    uses for its manifest) and rkt apis, we pull those in as vendored
    dependencies. The versions used are the same ones that rkt use in their
    glide dependency configuration for version 1.28.0.
    dalegaard committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    bdfd8d8 View commit details
    Browse the repository at this point in the history

Commits on Sep 26, 2017

  1. Discard errors from rkt status and cat-manifest

    Since we don't actually show these errors anywhere, just discard them
    right away.
    dalegaard committed Sep 26, 2017
    Configuration menu
    Copy the full SHA
    1d75ff8 View commit details
    Browse the repository at this point in the history
  2. Test for rkt driver setting DriverNetwork

    To test that the rkt driver correctly sets a DriverNetwork, at least
    when a port mapping is requested, we amend the
    TestRktDriver_PortsMapping test with a small check.
    dalegaard committed Sep 26, 2017
    Configuration menu
    Copy the full SHA
    3dd16a2 View commit details
    Browse the repository at this point in the history
  3. Turn rkt network status failure into Start failure

    If the rkt driver cannot get the network status, for a task with a
    configured port mapping, it will now fail the Start() call and kill the
    task instead of simply logging. This matches the Docker behavior.
    
    If no port map is specified, the warnings will be logged but the task
    will be allowed to start.
    dalegaard committed Sep 26, 2017
    Configuration menu
    Copy the full SHA
    ddec2f1 View commit details
    Browse the repository at this point in the history
  4. Update CHANGELOG.md

    dalegaard committed Sep 26, 2017
    Configuration menu
    Copy the full SHA
    f6ce83c View commit details
    Browse the repository at this point in the history
  5. Bump minimum rkt version to 1.27.0.

    The changes introduces in #3256 require at least rkt 1.27.0 because of
    a bug in the JSON output of `rkt status` in previous versions.
    
    Here we upgrade all references to rkt's minimum version, and also make
    travis and vagrant use this version when running tests.
    
    Finally we add a CHANGELOG notice.
    dalegaard committed Sep 26, 2017
    Configuration menu
    Copy the full SHA
    dd934a6 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    a7f5f8a View commit details
    Browse the repository at this point in the history
  7. Refactor rkt network status loop

    The network status poll loop for the rkt drivers `Start` method was a
    bit messy, and could not display the last encountered error. Here we
    clean it up.
    dalegaard committed Sep 26, 2017
    Configuration menu
    Copy the full SHA
    eade50b View commit details
    Browse the repository at this point in the history
  8. Improve rkt driver network status poll loop

    The network status poll loop will now report any networks it ignored, as
    well as a no-networks situations.
    dalegaard committed Sep 26, 2017
    Configuration menu
    Copy the full SHA
    b537f16 View commit details
    Browse the repository at this point in the history
  9. Add rkt default network to Travis

    The current Travis setup scripts copy in rkt, but do not set up a
    default container network.
    
    Here we copy the container network setup over from the vagrant setup
    scripts.
    dalegaard committed Sep 26, 2017
    Configuration menu
    Copy the full SHA
    5cd1d19 View commit details
    Browse the repository at this point in the history
  10. Make rkt port mapping test not exit immediately

    The rkt port mapping test currently starts redis with --version, which
    obviously makes redis exit again almost immediately. This means that the
    container exists before the network status can be queried, and so the
    test fails.
    dalegaard committed Sep 26, 2017
    Configuration menu
    Copy the full SHA
    c359ba4 View commit details
    Browse the repository at this point in the history
  11. Ignore rkt network failure if container died early

    If the container dies before the network can be read, we now ignore the
    error coming out of the network information polling loop. Nomad will
    restart the task regardless, so we might be masking the actual error.
    
    The polling loop for the rkt network information, inside the `Start`
    method, was getting a bit unwieldy. It's been refactored out so it's not
    a seperate function.
    dalegaard committed Sep 26, 2017
    Configuration menu
    Copy the full SHA
    5decea6 View commit details
    Browse the repository at this point in the history