Skip to content

Commit

Permalink
Merge pull request #186 from containerum/refinery
Browse files Browse the repository at this point in the history
Refinery
  • Loading branch information
xakep666 authored Jun 29, 2018
2 parents 9aa2000 + c340246 commit 62eecc6
Show file tree
Hide file tree
Showing 124 changed files with 2,948 additions and 1,579 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ARG BUILD_CONTAINERUM_API=https://api.containerum.io
ENV CONTAINERUM_API=$BUILD_CONTAINERUM_API

COPY . .
RUN go get -u -v github.com/UnnoTed/fileb0x
RUN make build

FROM alpine:3.7
Expand Down
8 changes: 4 additions & 4 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ genkey: $(SIGNING_KEY_DIR)/$(PRIVATE_KEY_FILE)

# go has build artifacts caching so soruce tracking not needed
build: $(SIGNING_KEY_DIR)/$(PRIVATE_KEY_FILE)
go generate ./help
@echo "Building chkit for current OS/architecture, without signing"
go build -v -ldflags="$(RELEASE_LDFLAGS)" -o $(BUILDS_DIR)/$(EXECUTABLE) ./$(CMD_DIR)

Expand Down Expand Up @@ -101,6 +102,7 @@ single_release: $(SIGNING_KEY_DIR)/$(PRIVATE_KEY_FILE)
dev:
$(eval VERSION=$(LATEST_TAG:v%=%)+dev)
@echo building $(VERSION)
go generate ./help
go build -v -race --tags="dev" --ldflags="$(DEV_LDFLAGS)" ./$(CMD_DIR)

mock:
Expand Down
10 changes: 10 additions & 0 deletions cmd/chkit/chkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,19 @@ import (
"os"

"github.com/containerum/chkit/pkg/cli"
"github.com/containerum/chkit/pkg/context"
"github.com/containerum/chkit/pkg/util/angel"
)

func main() {
defer func() {
switch panicInfo := recover().(type) {
case nil:
// pass
default:
angel.Angel(&context.Context{Version: cli.VERSION}, panicInfo)
}
}()
if err := cli.Root(); err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
Expand Down
114 changes: 110 additions & 4 deletions doc/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Create resource (deployment, service...)

* **[create configmap](#create_configmap)**
* **[create deployment](#create_deployment)** create deployment
* **[create deployment-container](#create_deployment-container)** create deployment container.
* **[create ingress](#create_ingress)** create ingress
* **[create service](#create_service)** create service

Expand All @@ -53,9 +54,9 @@ Create service for the specified pod in the specified namespace.
| | --deploy | service deployment, required | |
| -f | --file | file with service data | - |
| | --force | create service without confirmation | false |
| | --name | service name, optional | flavescent-anaximander |
| | --name | service name, optional | quartz-mckay |
| | --port | service port, optional | 0 |
| | --port-name | service port name, optional | massalia-penny |
| | --port-name | service port name, optional | danzl-bistre |
| | --proto | service protocol, optional | TCP |
| | --target-port | service target port, optional | 80 |

Expand Down Expand Up @@ -91,11 +92,115 @@ chkit create ingress [--force] [--filename ingress.json] [-n prettyNamespace]



#### <a name="create_deployment-container">create deployment-container</a>

**Description**:

Add container to deployment container set. Available methods to build deployment:
- from flags
- with interactive commandline wizard
- from yaml ot json file

Use --force flag to create container without interactive wizard.
If the --container-name flag is not specified then wizard generates name RANDOM_COLOR-IMAGE.

**Example**:



**Flags**:

| Short | Name | Usage | Default value |
| ----- | ---- | ----- | ------------- |
| | --configmap | container configmap mount, CONFIG:MOUNT_PATH or CONFIG (then MOUNTPATH is /etc/CONFIG) | |
| | --container-name | container name, required on --force | |
| | --cpu | container CPU limit, mCPU | 0 |
| | --deployment | deployment name, required on --force | |
| | --env | container environment variables, NAME:VALUE, 'NAME:$HOST_ENV' or '$HOST_ENV' (to user host env). WARNING: single quotes are required to prevent env from interpolation | |
| -f | --force | suppress confirmation | false |
| | --image | container image | |
| | --memory | container memory limit, Mb | 0 |
| | --volume | container volume mounts, VOLUME:MOUNT_PATH or VOLUME (then MOUNT_PATH is /mnt/VOLUME) | |


**Subcommands**:



#### <a name="create_deployment">create deployment</a>

**Description**:

Create a new deployment. Runs in one-line mode, suitable for integration with other tools, and in interactive wizard mode.
Create deployment with containers and replicas.
Available methods to build deployment:
- from flags
- with interactive commandline wizard
- from yaml ot json file

Use --force flag to create container without interactive wizard.

There are several ways to specify the names of containers with flags:
- --container-name flag
- the prefix CONTAINER_NAME@ in the flags --image, --memory, --cpu, --env, --volume

If the --container-name flag is not specified and prefix is not used in any of the flags, then wizard searches for the --image flags without a prefix and generates name RANDOM_COLOR-IMAGE.

**Examples:**

---
**Single container with --container-name**

```bash
> ./ckit create depl \
--container-name doot \
--image nginx
```

| LABEL | VERSION | STATUS | CONTAINERS | AGE |
| ------------------- | --------| -------- | ------------ | --------- |
| akiraabe-heisenberg | 1.0.0 | inactive | doot [nginx] | undefined |

---
**Single container without --container-name**

```bash
> ./ckit create depl \
--image nginx
```

| LABEL | VERSION | STATUS | CONTAINERS | AGE |
| ------------------- | --------| -------- | ------------------------ | --------- |
| spiraea-kaufman | 1.0.0 | inactive | aquamarine-nginx [nginx] | undefined |

---
**Multiple containers with --container-name**


```bash
> ./ckit create depl \
--container-name gateway \
--image nginx \
--image blog@wordpress
```

| LABEL | VERSION | STATUS | CONTAINERS | AGE |
| ------------------- | --------| -------- | ------------------------ | --------- |
| ruckers-fischer | 1.0.0 | inactive | gateway [nginx] | undefined |
| | | | blog [wordpress] | |

---
**Multiple containers without --container-name**
```bash
> ./ckit create depl \
--image nginx \
--image blog@wordpress
```

| LABEL | VERSION | STATUS | CONTAINERS | AGE |
| ------------------- | ------- | -------- | ------------------------ | --------- |
| thisbe-neumann | 1.0.0 | inactive | blog [wordpress] | undefined |
| | | | garnet-nginx [nginx] | |


**Example**:

Expand All @@ -106,6 +211,7 @@ Create a new deployment. Runs in one-line mode, suitable for integration with ot
| Short | Name | Usage | Default value |
| ----- | ---- | ----- | ------------- |
| | --configmap | container configmap, CONTAINER_NAME@CONFIGMAP_NAME@MOUNTPATH in case of multiple containers or CONFIGMAP_NAME@MOUNTPATH or CONFIGMAP_NAME in case of one container. If MOUNTPATH is omitted, then use /etc/CONFIGMAP_NAME as mountpath | |
| | --container-name | container name in case of single container | |
| | --cpu | container memory limit, mCPU, CONTAINER_NAME@CPU in case of multiple containers or CPU in case of one container | |
| | --env | container environment variable, CONTAINER_NAME@KEY:VALUE in case of multiple containers or KEY:VALUE in case of one container | |
| | --file | file with configmap data, .json, .yaml, .yml, optional | |
Expand Down Expand Up @@ -139,7 +245,7 @@ Create a new deployment. Runs in one-line mode, suitable for integration with ot
| -f | --force | suppress confirmation | false |
| | --item-file | configmap file, KEY:FILE_PATH or FILE_PATH | |
| | --item-string | configmap item, KEY:VALUE string pair | |
| | --name | configmap name | eunomia-knoll |
| | --name | configmap name | michela-zollner |


**Subcommands**:
Expand Down
49 changes: 48 additions & 1 deletion doc/delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ Delete resource

* **[delete configmap](#delete_configmap)** delete configmap
* **[delete deployment](#delete_deployment)** delete deployment in specific namespace
* **[delete deployment-container](#delete_deployment-container)** delete container
* **[delete ingress](#delete_ingress)** delete ingress
* **[delete namespace](#delete_namespace)** delete namespace
* **[delete pod](#delete_pod)** delete pod in specific namespace
* **[delete service](#delete_service)** delete service in specific namespace
* **[delete solution](#delete_solution)** Delete running solution
* **[delete volume](#delete_volume)** delete volume


Expand All @@ -60,6 +62,27 @@ chkit delete volume [--force]



#### <a name="delete_solution">delete solution</a>

**Description**:

Delete running solution

**Example**:

chkit delete solution [--force]

**Flags**:

| Short | Name | Usage | Default value |
| ----- | ---- | ----- | ------------- |
| -f | --force | delete solution without confirmation | false |


**Subcommands**:



#### <a name="delete_service">delete service</a>

**Description**:
Expand Down Expand Up @@ -144,11 +167,35 @@ chkit delete ingress $INGRESS [-n $NAMESPACE] [--force]



#### <a name="delete_deployment-container">delete deployment-container</a>

**Description**:

Delete deployment container.

**Example**:



**Flags**:

| Short | Name | Usage | Default value |
| ----- | ---- | ----- | ------------- |
| | --container | container name, required on --force | |
| | --deployment | deployment name, required on --force | |
| | --force | suppress confirmation | false |


**Subcommands**:



#### <a name="delete_deployment">delete deployment</a>

**Description**:

Delete deployment in specific namespace. Use --force flag to suppress confirmation.
Delete deployment in specific namespace.
Use --force flag to suppress confirmation.

**Example**:

Expand Down
Loading

0 comments on commit 62eecc6

Please sign in to comment.