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

Merge branch 'feature/vic-machine-service' [full ci] #6665

Merged
merged 56 commits into from
Nov 20, 2017

Commits on Nov 20, 2017

  1. Define an OpenAPI document for vic-machine

    Use an OpenAPI (Swagger) document to define a preliminary API for
    vic-machine based on the vic-machine API design document (#6116).
    
    This document is expected to evolve as implementation proceeds.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    c24e8bc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ddbcdbb View commit details
    Browse the repository at this point in the history
  3. Define REST API handlers for listing VCHs

    Introduce a pair of handlers for listing information about VCHs,
    optionally scoped to a compute resource or datacenter.
    
    Include basic authentication and error handling, which should be
    improved on as development continues.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    b1b9dc1 View commit details
    Browse the repository at this point in the history
  4. Define REST API handlers for inspecting VCHs

    Introduce a pair of handlers for accessing information about the VCH
    with a given identifier within a vSphere target or named datacenter.
    
    There are ways in which this work is incomplete, marked by TODO:
     - Malformed managed object references are ignored
     - Malformed or unexpected PKI material is ignored
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    859f94f View commit details
    Browse the repository at this point in the history
  5. Define REST API handlers for creating VCHs

    Introduce a pair of handlers for deploying new VCHs, as described by a
    JSON object, within a vSphere target or datacenter.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    c7c130a View commit details
    Browse the repository at this point in the history
  6. Update the vendored version of tylerb/graceful

    This was a mechanical change using the following commands:
      gvt delete github.com/tylerb/graceful
      gvt fetch -revision 4654dfbb6ad53cb5e27f37d99b02e16c1872fbbb \
          https://github.com/tylerb/graceful
    
    This is needed to pick up the fix for tylerstillwater/graceful#85
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    d7d9e24 View commit details
    Browse the repository at this point in the history
  7. Expose the vic-machine API via HTTPS

    Notes:
     * To disable HTTPS for testing, invoke the server with --scheme http
     * To configure https, use --tls-port, --tls-certificate, and --tls-key
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    62ba099 View commit details
    Browse the repository at this point in the history
  8. Implement VCH certificate endpoint (#6406)

    Implement VCH certificate endpoint
    jzt authored and zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    0050cf3 View commit details
    Browse the repository at this point in the history
  9. live streaming VCH creation log to VCH datastore folder (#6403)

    * clean up after rebase
    
    * integration test added to 6-04
    
    * integration test md file modified
    
    * integration test md file change
    AngieCris authored and zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    bdecd92 View commit details
    Browse the repository at this point in the history
  10. Clean up service dependencies and gitignore

    This could be squashed into "Define an OpenAPI document for vic-machine"
    before merging to master.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    6793f7e View commit details
    Browse the repository at this point in the history
  11. Alphabetize imports in bufferedPipe.go

    Organize the the imports in bufferedPipe.go in alphabetical order.
    
    Without this change, `make goimports` (run as a part of CI) fails.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    66d4ac8 View commit details
    Browse the repository at this point in the history
  12. Rename bufferedPipe.go to buffered_pipe.go

    Rename bufferedPipe.go and bufferedPipe_test.go (camel case) to
    buffered_pipe.go and buffered_pipe_test.go (snake case), which
    better follow the naming conventions of the repository.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    516a961 View commit details
    Browse the repository at this point in the history
  13. Fix minor issues in error handler util

    Switch from pointer receiver to value receiver and add missing methods
    for wrappedError to ensure error handling code works as designed.
    
    Introduce unit tests to verify behavior.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    d9c60aa View commit details
    Browse the repository at this point in the history
  14. Vendor github.com/rs/cors v1.1

    To include the correct set of CORS headers on each response,
    we need to add an appropriate middleware.
    
    This change vendors the middleware recommended by go-swagger
    and its transitive dependencies.
    
    This was a mechanical change using the following command:
      gvt fetch -tag v1.1 github.com/rs/cors
    
    See also:
      go-swagger/go-swagger#481
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    0121c62 View commit details
    Browse the repository at this point in the history
  15. Include appropriate CORS headers

    Because the vSphere H5 client plugin and the vic-machine-server will be
    served from different hosts, the H5 client plugin will be making cross-
    origin requests. As these would normally be prevented by the browser's
    same-origin policy, the service must support responding to all requests
    (including preflight requests) with the appropriate CORS headers.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    ded1e3f View commit details
    Browse the repository at this point in the history
  16. Define end-to-end test for version endpoint

    Introduce a single-test robot suite for the version endpoint as well as
    a utility resource for use by this suite and others within the group.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    edf7a0a View commit details
    Browse the repository at this point in the history
  17. Define end-to-end tests for VCH listing endpoint

    Introduce a robot suite for the VCH listing endpoints leveraging the
    group-scoped keywords introduced for other API tests.
    
    Test the successful operation of the endpoints as well as common
    error cases.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    ecd4a8f View commit details
    Browse the repository at this point in the history
  18. Implement REST API handler for getting VCH creation logs (#6524)

    * vch log API handler stub added
    
    * vch log handler stub added
    
    * VCH log handler implemented
    
    * whitespaces
    
    * whitespace
    
    * whitespace
    
    * cleaned up integration test temp files
    
    * log API handler implemented, integration test added
    
    * remove log file download function from logger
    
    * whitespace
    
    * make the log files automatically sort by timestamp
    
    * .log filename suffix added to log files; sort files based on timestamp
    
    * sort log files based on timestamp
    
    * modified error message for finding VCH from ID
    
    * remove unused package declaration
    
    * fixed error code when provided VCH ID does not exist
    
    * VCH-log integration test md modified
    
    * 404 test for log API handler added after log file's removed
    
    * log handler integration test refactored
    
    * use status code constants from http package; minor code improvements in log API handler
    
    * minor bug fixes
    
    * const declaration
    
    * minor bug fix in common.go
    AngieCris authored and zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    a296fc2 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    127de67 View commit details
    Browse the repository at this point in the history
  20. Update create API to stream a creation log to the VCH's datastore fol…

    …der (#6545)
    
    * create API updated to include log streaming to datastore feature
    
    * comment added for const in create API handler
    
    * Const name change in create API handler
    AngieCris authored and zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    dab9b09 View commit details
    Browse the repository at this point in the history
  21. --container-store option removed from vic-machine CLI (#6586)

    * removed container store from cli and vch data
    
    * goimports
    AngieCris authored and zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    d30bb16 View commit details
    Browse the repository at this point in the history
  22. Use trace.NewOperation pattern in vic-machine service API handlers (#…

    …6563)
    
    * trace.NewOperation pattern used for vic-machine service API
    
    * whitespace
    
    * whitespace
    
    * clean up trace.op pattern in API handler functions
    
    * bug fix: validateTarget takes in context since used by buildData
    AngieCris authored and zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    b4bacb0 View commit details
    Browse the repository at this point in the history
  23. Correct comment in vic-machine-server Dockerfile

    Fix a minor copy & paste error in the vic-machine-server Dockerfile.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    2e09165 View commit details
    Browse the repository at this point in the history
  24. syslog support added to VCH create and inspect API (#6582)

    * syslog support added to VCH create API
    
    * syslog addr added to inspect output
    
    * syslog_addr format changed in swagger
    
    * use status code in http package
    
    * empty syslog_addr string checking
    
    * swagger format changed for syslog_addr
    
    * roll back in swagger: only tcp and udp are accepted
    AngieCris authored and zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    7c2d3b5 View commit details
    Browse the repository at this point in the history
  25. Properly extract CPU speed in VCH creation handler

    Because JSON and Go have different models for inheritance, properly
    interpreting the structure of the API parameters can be confusing.
    
    In this case, we need to reference the nested units variable from
    the "subclass" instead of the units variable in the parent, which
    will always have its zero value (the empty string).
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    ccee5c4 View commit details
    Browse the repository at this point in the history
  26. Always process ops credentials in VCH creation API

    This change moves the logic which processes operations credentials
    up a level so that they will always be processed, even if no endpoint
    settings are provided.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    9728cdd View commit details
    Browse the repository at this point in the history
  27. Propagate validation in VCH creation API

    As a part of handling a VCH creation API request, we pass the desired
    VCH configuration to the validator code.
    
    When the validator returns an error, we should report it to the user.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    c79fea1 View commit details
    Browse the repository at this point in the history
  28. Avoid a panic when a managed object is omitted

    This change ensures that omitted (i.e., nil) managed objects are
    correctly handled in calls to the VCH creation API.
    
    This allows for a more minimal set of fields to be supplied.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    942bc67 View commit details
    Browse the repository at this point in the history
  29. Run pprof as a part of VCH Management API

    To allow for profiling and debugging of the VCH Management API,
    run pprof on localhost:6060 by default. Different settings may
    be passed via command-line arguments or environment variables.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    e19fa6e View commit details
    Browse the repository at this point in the history
  30. Accept session clone ticket via request header (#6587)

    This change allows the vic-machine-server to accept a vSphere session
    clone ticket in the X-VMWARE-TICKET header of incoming requests. This
    ticket is used by govmomi to clone the user's session to allow the
    vic-machine-server govmomi client to make vSphere requests on the user's
    behalf.
    jzt authored and zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    7e65ed3 View commit details
    Browse the repository at this point in the history
  31. VCH Creation API: Properly propogate proxy settings

    Previously, the API handler for VCH creation was dropping the processed
    proxy settings. With this change, they are processed as they would be
    during CLI-based creation.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    f0937ed View commit details
    Browse the repository at this point in the history
  32. VCH Creation API: Replace magic number with constant

    A previous change replaced most http status codes with the appropriate
    constants. This replaces a lingering instance.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    4034617 View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    2499ca0 View commit details
    Browse the repository at this point in the history
  34. VCH APIs: Represent disk sizes using base 10

    For consistency with the rest of the product (and other products which
    deal with storage size), represent disk size using base 10 (KB, MB, GB,
    etc.) instead of base 2 (KiB, MiB, GiB, etc.).
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    a228ed9 View commit details
    Browse the repository at this point in the history
  35. VCH Inspect API: Properly parse datastore paths

    Volume store locations are returned as a URL with a scheme of "ds", a
    host as the name of the datastore, and a path as a vSphere datastore
    path (which is prefixed by the name of the datastore in brackets).
    
    To return a value in the format that the user expects (i.e., in the
    format that was provided), we extract the actual path portion from
    the vSphere path so that the datastore name is not repeated in both
    the host and the path.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    b21a85f View commit details
    Browse the repository at this point in the history
  36. Implement tests for the VCH Creation API

    Implement a suite of positive and negative tests for API-based VCH
    creation. These tests are not intended to be exhaustive; we can use
    unit tests for that.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    87aa511 View commit details
    Browse the repository at this point in the history
  37. Clean up VCH Management API robot tests

    Refactor and clean up the robot test group for the VCH Management API.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    9258cd3 View commit details
    Browse the repository at this point in the history
  38. Revert change to PUBLIC_NETWORK variable

    In "Implement tests for the VCH Creation API", a change was made to
    the way that the PUBLIC_NETWORK environment variable was quoted.
    
    This worked for robot test group 23, but broke several others.
    
    This commit reverts the global change and handles the quoting issue
    in a localized way.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    54582a9 View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    c3db32a View commit details
    Browse the repository at this point in the history
  40. creation log API output to text/plain (#6640)

    error output is formatted to string as well.
    AngieCris authored and zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    90dc241 View commit details
    Browse the repository at this point in the history
  41. Minor adjustments to formatting

    Make minor adjustments to formatting suggested during review of the
    merge commit for the VCH creation API feature branch.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    da68a2c View commit details
    Browse the repository at this point in the history
  42. Include issue numbers with TODOs

    Include issue numbers with all TODOs added as a part of the initial
    VCH creation API project, as suggested during review of the merge
    commit for the VCH creation API feature branch.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    462eceb View commit details
    Browse the repository at this point in the history
  43. Clarify comment in common code for API handlers

    Clarify an unclear comment identified during review of the merge
    commit for the VCH creation API feature branch.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    d03c730 View commit details
    Browse the repository at this point in the history
  44. Cleanup build process for vic-machine-server

    Remove the serviceapi target as a dependency for the appliance.iso and
    ensure all generated code is cleaned up.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    861d880 View commit details
    Browse the repository at this point in the history
  45. Implement API handler for VCH deletion

    Introduce a pair of handlers for deleting VCHs within a vSphere target
    or datacenter. By default, deletion includes the VCH and powered off
    containers. Deletion may optionally include powered on containers
    and/or volume stores as well.
    
    If any containers remain, the VCH is not deleted. If the VCH is not
    deleted, the response includes a non-2xx status code.
    
    Define a suite of end-to-end tests which verify the intended deletion
    behavior. End-to-end tests do not attempt to verify the behavior of
    concurrent operations.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    fa7814d View commit details
    Browse the repository at this point in the history
  46. VCH Management API: Remove registry blacklist

    Registry blacklist functionality was designed, but has not been fully
    implemented in the engine. Remove references to it from the API.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    53d7623 View commit details
    Browse the repository at this point in the history
  47. VCH Creation API: Stop writing key files to disk

    When creating a VCH via the API, we should not write key/certificate
    files to the API server's disk.
    
    This change introduces the behavior as a flag so that it could be
    exposed as an option for the CLI at some point in the future, but
    does not expose it at this time.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    d240ad2 View commit details
    Browse the repository at this point in the history
  48. Handle routing destinations in API like CLI

    The vic-machine CLI has differing requirements for gateway routing
    information, depending on the type of network.
    
    According to the CLI help:
     - a client gateway must specify one or more routing destinations
     - a public gateway must not specify any routing destinations
     - a management gateway must specify one or more routing destinations
     - a container gateway must specify exactly one routing destination
    
    This does not seem to be enforced in code, and may simply be more of a
    suggestion about how these gateways should be used than a requirement.
    
    Update the parsing for client, public, and management to support all
    zero or more routing destinations in all cases; defer to the existing
    ProcessNetwork code to ensure consistent validation behavior now and
    in the future.
    
    Additionally update the parsing for container to provide a clear error
    message if the expected routing destination is not supplied.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    e18d292 View commit details
    Browse the repository at this point in the history
  49. Handle static addresses in the API like CLI

    The vic-machine CLI requires that static addresses are specified as a
    CIDR, which allows the static address and subnet mask to be supplied
    in a compact way on the command line. This pattern does not allow for
    static addresses to be expressed in terms of a hostname.
    
    Update the API to match this convention. We may wish to allow for more
    flexibility in the API in the future, but there's value in at least
    starting with consistent behavior.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    76bbd59 View commit details
    Browse the repository at this point in the history
  50. Handle IP ranges in the API like in the CLI

    The vic-machine CLI allows IP ranges to be expressed in CIDR notation
    or as simple ranges in some places, but requires that CIDR notation be
    used in others.
    
    Initially there was a hope of making the API behave more consistently,
    but that requires changes to underlying logic (some of which is not
    well covered by existing tests).
    
    For now, be consistent with the CLI.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    1e922a8 View commit details
    Browse the repository at this point in the history
  51. Support container network trust level in VCH API

    The vic-machine CLI supports specifying a "trust level" for each
    container network using the --container-network-firewall option.
    
    Support the same functionality in the API.
    
    Additionally, fix a small bug with the way ip ranges are returned
    by the inspect API.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    ee0b3a3 View commit details
    Browse the repository at this point in the history
  52. List client address for accessing services in API

    Use the client network address, not the public network address, when
    displaying the admin portal URI and the docker host information as a
    part of API responses.
    
    Additionally, eliminate code duplication.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    26fb427 View commit details
    Browse the repository at this point in the history
  53. Include ISO files in server docker image

    Additionally, move the binary to a subdirectory of opt to allow the
    ISO files to be packaged with it.
    
    See also:
     * http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/opt.html
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    959bcd4 View commit details
    Browse the repository at this point in the history
  54. Add unit tests for VCH create (#6764)

    jzt authored and zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    1d6656b View commit details
    Browse the repository at this point in the history
  55. Support request logging for VCH Management API

    Log each request and response to a configurable destination. Use
    trace.Operation to associate the request and response information
    with the logs for the handler to allow for easy debugging, even
    when there are several requests being handled concurrently.
    
    Adjust logging in server's main.go to avoid printing to stdout.
    
    Relies on external configuration for log rotation.
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    d9e6b91 View commit details
    Browse the repository at this point in the history
  56. Update logging within packages used by vic-machine

    For each conceptual vic-machine operation, create a trace.Operation
    with an operation-local logger. Emit log messages using the log
    methods on the operation instead of logrus global methods. This will
    write to the vic-machine.log using the global trace.Logger and to
    the user using the operation-local logger.
    
    This ensures that both the CLI and API can print log messages to both
    a local file and the user (via a TTY, if the CLI, and the datastore).
     * In the CLI, use the operation-local logger to print to the console
       (using the default Logrus TTY formatting) and write to both the
       datastore and vic-machine.log file with the global trace.Logger
       (using VIC's custom log formatter).
     * In the API, use the the operation-local logger to write to the
       datastore and write to the server's console with the global
       trace.Logger. In both cases, use VIC's custom log formatter.
    
    Update code in packages used by vic-machine to accept a context,
    coerce/convert it into a trace.Operation, and use its log methods.
    
    Improve readability of logs for concurrent operations by including a
    operation/context in trace.Begin calls when one is available.
    
    Retain configuration for the global logrus logger in vic-machine so
    that we "fail ugly" (i.e., have lines with mismatched log formats) on
    the CLI if something uses the old pattern, but don't lose information.
    
    Update tests which parse log messages to understand this new format
    instead of or, where necessary, in addition to old format(s).
    zjs committed Nov 20, 2017
    Configuration menu
    Copy the full SHA
    dc30dd0 View commit details
    Browse the repository at this point in the history