Skip to content

Instantly share code, notes, and snippets.

@carmark
Created May 28, 2015 11:25
Show Gist options
  • Save carmark/56aa0d2466bf5a3aa50b to your computer and use it in GitHub Desktop.
Save carmark/56aa0d2466bf5a3aa50b to your computer and use it in GitHub Desktop.
### The Yaml file support
#### Introduction
如下样例,是一个典型的Yaml格式的文件,存在于examples/ubuntu.yml
```
name: process-yaml-file-ubuntu
containers:
- name: ubuntu
image: ubuntu:latest
workdir: /
command:
- /bin/bash
resource:
vcpu: 1
files:
volumes:
tty: true
```
要运行的话,就是给`run`或是`create`子命令加上`-y`选项,这样针对传入的文件(`-p`接收的)就可以按照Yaml格式转换。
```
root@ubuntu:/home/lei/src/hyper# ./hyper run --help
Usage:
hyper run [OPTIONS] IMAGE [COMMAND] [ARG...]
create a pod, and launch a new VM to run the pod
Application Options:
-p, --podfile="" Create and Run a pod based on the pod file
-k, --kubernetes="" Create and Run a pod based on the kubernetes pod file
-y, --yaml Create a pod based on Yaml file
--name="" Assign a name to the container
--attach Attach the stdin, stdout and stderr to the container
--workdir="" Working directory inside the container
--tty Allocate a pseudo-TTY
--cpu=1 CPU number for the VM
--memory=128 Memory size (MB) for the VM
--env=[] Set environment variables
--entrypoint="" Overwrite the default ENTRYPOINT of the image
--restart="" Restart policy to apply when a container exits (never, onFailure, always)
Help Options:
-h, --help Show this help message
```
#### Test Cases
```
hyper run -y -p examples/ubuntu.yml
```
## Kubernetes Compatability
### Two new Status from Kubernetes
增加了两个新的状态,分别是`failed`和`succeeded`。这样我们的系统中就存在了四个状态:
* pending
* running
* failed
* succeeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment