Skip to content

Commit

Permalink
feat(container): allow referencing Kubernetes secrets in container mo…
Browse files Browse the repository at this point in the history
…dules

Also added a much-needed guide for container modules, and an example
project to illustrate.
  • Loading branch information
edvald committed Jul 9, 2019
1 parent 560604f commit 4c603c3
Show file tree
Hide file tree
Showing 51 changed files with 1,374 additions and 259 deletions.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* [Using Garden](./using-garden/README.md)
* [Development workflows](./using-garden/development-workflows.md)
* [Configuration files](./using-garden/configuration-files.md)
* [Container modules](./using-garden/container-modules.md)
* [Local Kubernetes](./using-garden/local-kubernetes.md)
* [Remote Kubernetes](./using-garden/remote-kubernetes.md)
* [In-cluster building](./using-garden/in-cluster-building.md)
Expand Down
12 changes: 6 additions & 6 deletions docs/reference/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ Example:

```yaml
environmentDefaults:
providers: []
variables: {}
providers: []
variables: {}
```

### `environmentDefaults.providers[]`
Expand All @@ -92,8 +92,8 @@ Example:

```yaml
environmentDefaults:
providers: []
variables: {}
providers: []
variables: {}
...
providers:
- name: "local-kubernetes"
Expand All @@ -113,8 +113,8 @@ Example:

```yaml
environmentDefaults:
providers: []
variables: {}
providers: []
variables: {}
...
providers:
- environments:
Expand Down
113 changes: 109 additions & 4 deletions docs/reference/module-types/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,24 @@ The name of the container port where the specified paths should be routed.

[services](#services) > env

Key/value map of environment variables. Keys must be valid POSIX environment variable names (must not start with `GARDEN`) and values must be primitives.
Key/value map of environment variables. Keys must be valid POSIX environment variable names (must not start with `GARDEN`) and values must be primitives or references to secrets.

| Type | Required | Default |
| -------- | -------- | ------- |
| `object` | No | `{}` |

Example:

```yaml
services:
- env:
MY_VAR: some-value
MY_SECRET_VAR:
secretRef:
name: my-secret
key: some-key
```

### `services[].healthCheck`

[services](#services) > healthCheck
Expand Down Expand Up @@ -781,12 +793,24 @@ tests:

[tests](#tests) > env

Key/value map of environment variables. Keys must be valid POSIX environment variable names (must not start with `GARDEN`) and values must be primitives.
Key/value map of environment variables. Keys must be valid POSIX environment variable names (must not start with `GARDEN`) and values must be primitives or references to secrets.

| Type | Required | Default |
| -------- | -------- | ------- |
| `object` | No | `{}` |

Example:

```yaml
tests:
- env:
MY_VAR: some-value
MY_SECRET_VAR:
secretRef:
name: my-secret
key: some-key
```

### `tasks`

A list of tasks that can be run from this container module. These can be used as dependencies for services (executed before the service is deployed) or for other tasks.
Expand Down Expand Up @@ -877,12 +901,24 @@ tasks:

[tasks](#tasks) > env

Key/value map of environment variables. Keys must be valid POSIX environment variable names (must not start with `GARDEN`) and values must be primitives.
Key/value map of environment variables. Keys must be valid POSIX environment variable names (must not start with `GARDEN`) and values must be primitives or references to secrets.

| Type | Required | Default |
| -------- | -------- | ------- |
| `object` | No | `{}` |

Example:

```yaml
tasks:
- env:
MY_VAR: some-value
MY_SECRET_VAR:
secretRef:
name: my-secret
key: some-key
```


## Complete YAML schema
```yaml
Expand Down Expand Up @@ -964,22 +1000,91 @@ tasks:

## Outputs

The following keys are available via the `${modules.<module-name>.outputs}` template string key for `container`
The following keys are available via the `${modules.<module-name>}` template string key for `container`
modules.

### `modules.<module-name>.buildPath`

The build path of the module.

| Type | Required |
| -------- | -------- |
| `string` | Yes |

Example:

```yaml
buildPath: "/home/me/code/my-project/.garden/build/my-module"
```

### `modules.<module-name>.path`

The local path of the module.

| Type | Required |
| -------- | -------- |
| `string` | Yes |

Example:

```yaml
path: "/home/me/code/my-project/my-module"
```

### `modules.<module-name>.version`

The current version of the module.

| Type | Required |
| -------- | -------- |
| `string` | Yes |

Example:

```yaml
version: "v-17ad4cb3fd"
```

### `modules.<module-name>.outputs`

The outputs defined by the module.

| Type | Required |
| -------- | -------- |
| `object` | Yes |

### `modules.<module-name>.outputs.local-image-name`

[outputs](#outputs) > local-image-name

The name of the image (without tag/version) that the module uses for local builds and deployments.

| Type | Required |
| -------- | -------- |
| `string` | Yes |

Example:

```yaml
outputs:
...
local-image-name: "my-module"
```

### `modules.<module-name>.outputs.deployment-image-name`

[outputs](#outputs) > deployment-image-name

The name of the image (without tag/version) that the module will use during deployment.

| Type | Required |
| -------- | -------- |
| `string` | Yes |

Example:

```yaml
outputs:
...
deployment-image-name: "my-deployment-registry.io/my-org/my-module"
```
61 changes: 59 additions & 2 deletions docs/reference/module-types/exec.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ guide](../../using-garden/configuration-files.md).
The [first section](#configuration-keys) lists and describes the available
schema keys. The [second section](#complete-yaml-schema) contains the complete YAML schema.

`exec` modules also export values that are available in template strings under `${modules.<module-name>.outputs}`.
See the [Outputs](#outputs) section below for details.

## Configuration keys

### `apiVersion`
Expand Down Expand Up @@ -335,8 +338,7 @@ build:
copy:
- source:
target: <same as source path>
command:
[]
command: []
env: {}
tasks:
- name:
Expand All @@ -351,3 +353,58 @@ tests:
command:
env: {}
```

## Outputs

The following keys are available via the `${modules.<module-name>}` template string key for `exec`
modules.

### `modules.<module-name>.buildPath`

The build path of the module.

| Type | Required |
| -------- | -------- |
| `string` | Yes |

Example:

```yaml
buildPath: "/home/me/code/my-project/.garden/build/my-module"
```

### `modules.<module-name>.path`

The local path of the module.

| Type | Required |
| -------- | -------- |
| `string` | Yes |

Example:

```yaml
path: "/home/me/code/my-project/my-module"
```

### `modules.<module-name>.version`

The current version of the module.

| Type | Required |
| -------- | -------- |
| `string` | Yes |

Example:

```yaml
version: "v-17ad4cb3fd"
```

### `modules.<module-name>.outputs`

The outputs defined by the module.

| Type | Required |
| -------- | -------- |
| `object` | Yes |
Loading

0 comments on commit 4c603c3

Please sign in to comment.