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

Specification for a Trivial Container Engine #1044

Open
corrieb opened this Issue Jun 9, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@corrieb
Contributor

corrieb commented Jun 9, 2016

Related to #1043

TCE will be used a client for the Port Layer. It will be used for the following purposes:

  • Driving functional testing
  • Demonstrating how a simple client might be written
  • Keeping the Port Layer "honest" - container-engine agnostic

It has intentionally been written with little consideration to "compatibility" with the way things are currently being done. It has also intentionally been written so as not to require any networking or storage. It simply takes an executable from the command-line, copies it into a container and runs it. It compiles down to a simple stateless executable with commands that can be piped together.

TCE - External spec

Design features:

  • Uses only the execution part of the Port Layer to create and run an ephemeral container
  • Designed to demonstrate the value of developing a trivial container implementation on top of the Port Layer
  • Designed to keep the Port Layer flexible and honest
  • Should be able to demonstrate the Port Layer going down and coming back up successfully
  • Should be able to demonstrate a distributed Port Layer with stub network and storage services

Environment:

export TCE_HOST=IP:port

States:

Created, started, stopped

Commands:

  • Note that every command except for create takes a container ID to stdin
    • If more than one arg is passed to stdin, all but the first one will be ignored
  • Every command will output the container ID it mutated to stdout (except tail)
  • TCE has some simple exit codes that indicate common error conditions:
    • E_NO_OP
    • E_ID_NO_EXIST
    • E_INVALID_STATE
    • E_TIMEOUT
    • E_HOST_UNREACHABLE
    • E_NO_RESOURCE

tce container

Creates an ephemeral container to run the executable from the local filesystem
Blocks until container is created.

Input: Executable on the local filesystem
Pre-condition: None
Errors:
E_NO_OP if no executable is specified or it can't be found
E_NO_RESOURCE if endpoint is at capacity.
E_FAILED if create failed for some other reason
Returns: a handle to the container via stdout

tce start

Starts execution of the container ID specified in stdin
Entry point of the container is assumed to be the executable provided, which is initialized with the args provided
Blocks until successful start or error.

Input: Container ID via stdin. Args for the executable.
Pre-condition: Container must be created or stopped
Errors:
E_INVALID_STATE if pre-condition is not met.
E_ID_NO_EXIST for invalid ID.
E_FAILED if create failed for some other reason
Returns: a handle to the container via stdout

tce join

Blocks until execution of the process is completed
Exit code of tce command is the exit code of the completed process or an error code

Input: Container ID via stdin
Pre-condition: Container must be started or stopped
Errors:
E_INVALID_STATE if pre-condition is not met
E_ID_NO_EXIST for invalid ID
E_HOST_UNREACHABLE if connection is dropped
E_FAILED if create failed for some other reason
Returns: a handle to the container via stdout

tce destroy

Destroys a container

Input: Container ID via stdin
Pre-condition: Container must be created or stopped. E_INVALID_STATE otherwise.
Errors:
E_INVALID_STATE if pre-condition is not met
E_ID_NO_EXIST for invalid ID
E_FAILED if create failed for some other reason
Returns: nothing

tce tail

Streams stderr/stout for a running container or all the last 10 lines for a stopped container.
Blocks until container is stopped

Input: Container ID via stdin
Pre-condition: Container must be started or stopped. E_INVALID_STATE otherwise.
Errors:
E_INVALID_STATE if pre-condition is not met
E_ID_NO_EXIST for invalid ID
E_FAILED if create failed for some other reason
Returns: Output via stdout or stdin

tce list <created | started | stopped>

Returns a " " separated list of container ID in the specified state. If no state is specified, all IDs are returned.

Input: Optional args via cmd-line
Pre-condition: None
Errors: None
Returns: List of container IDs via stdout

Usage Examples

/* Run HelloWorld, look at the output and then clean up */
tce container ./helloworld | tce start | tce tail
tce list | tce destroy

/* Execute a process, wait for it to complete and then clean up */
tce container ./runOnce | tce start | tce join | tce destroy

Future

tce stop

Stops execution of the container, by sending a kill signal to the process, if it is already running.
Blocks until it has stopped or the operation times out

Input: Container ID via stdin
Pre-condition: Container must be started. E_INVALID_STATE otherwise.
Errors:
E_INVALID_STATE if pre-condition is not met
E_ID_NO_EXIST for invalid ID
E_TIMEOUT is returned if the process has hung
Returns: a handle to the container via stdout

@mdubya66

This comment has been minimized.

Show comment
Hide comment
@mdubya66

mdubya66 Jan 31, 2017

Contributor

refactor portlayer a 1.1 requirement. making medium

Contributor

mdubya66 commented Jan 31, 2017

refactor portlayer a 1.1 requirement. making medium

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment