Skip to content

Commit

Permalink
feat(core): providers can now reference each others' outputs
Browse files Browse the repository at this point in the history
Architecturally this involves combining provider resolution,
status checks and environment prep into one flow. That won't impact
most commonly used CLI commands (deploy, test, dev), but other commands
that need to use provider configuration will take longer to start.

The negative impact will of course be mitigated when we're running
Garden as a persistent daemon. The benefit is that we can now write
providers that provide information to other providers, e.g. Terraform
or Cloudformation providers that feed connection information to
Kubernetes providers etc.
  • Loading branch information
edvald committed Aug 5, 2019
1 parent 117efe3 commit 2ca2774
Show file tree
Hide file tree
Showing 57 changed files with 841 additions and 548 deletions.
2 changes: 1 addition & 1 deletion dashboard/src/containers/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React, { useContext, useEffect } from "react"

import Sidebar from "../components/sidebar"
import { DataContext } from "../context/data"
import { DashboardPage } from "garden-service/build/src/config/dashboard"
import { DashboardPage } from "garden-service/build/src/config/status"

export interface Page extends DashboardPage {
path: string
Expand Down
122 changes: 121 additions & 1 deletion docs/reference/module-types/openfaas.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# `openfaas` reference


Deploy [OpenFaaS](https://www.openfaas.com/) functions using Garden. Requires either the `openfaas` or
`local-openfaas` provider to be configured.

Below is the schema reference. For an introduction to configuring Garden modules, please look at our [Configuration
guide](../../using-garden/configuration-files.md).
Expand Down Expand Up @@ -198,6 +199,104 @@ POSIX-style path or filename to copy the directory or file(s).
| -------- | -------- | ------------------------- |
| `string` | No | `"<same as source path>"` |

### `dependencies`

The names of services/functions that this function depends on at runtime.

| Type | Required | Default |
| --------------- | -------- | ------- |
| `array[string]` | No | `[]` |

### `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.

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

### `handler`

Specify which directory under the module contains the handler file/function.

| Type | Required | Default |
| -------- | -------- | ------- |
| `string` | No | `"."` |

### `image`

The image name to use for the built OpenFaaS container (defaults to the module name)

| Type | Required |
| -------- | -------- |
| `string` | No |

### `lang`

The OpenFaaS language template to use to build this function.

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

### `tests`

A list of tests to run in the module.

| Type | Required | Default |
| --------------- | -------- | ------- |
| `array[object]` | No | `[]` |

### `tests[].name`

[tests](#tests) > name

The name of the test.

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

### `tests[].dependencies[]`

[tests](#tests) > dependencies

The names of any services that must be running, and the names of any tasks that must be executed, before the test is run.

| Type | Required | Default |
| --------------- | -------- | ------- |
| `array[string]` | No | `[]` |

### `tests[].timeout`

[tests](#tests) > timeout

Maximum duration (in seconds) of the test run.

| Type | Required | Default |
| -------- | -------- | ------- |
| `number` | No | `null` |

### `tests[].command[]`

[tests](#tests) > command

The command to run in the module build context in order to test it.

| Type | Required |
| --------------- | -------- |
| `array[string]` | No |

### `tests[].env`

[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.

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


## Complete YAML schema
```yaml
Expand All @@ -216,6 +315,17 @@ build:
copy:
- source:
target: <same as source path>
dependencies: []
env: {}
handler: .
image:
lang:
tests:
- name:
dependencies: []
timeout: null
command:
env: {}
```

## Outputs
Expand Down Expand Up @@ -272,3 +382,13 @@ The outputs defined by the module.
| Type | Required |
| -------- | -------- |
| `object` | Yes |

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

[outputs](#outputs) > endpoint

The full URL to query this service _from within_ the cluster.

| Type | Required |
| -------- | -------- |
| `string` | Yes |
21 changes: 21 additions & 0 deletions docs/reference/providers/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -928,3 +928,24 @@ providers:
namespace:
setupIngressController: false
```

## Outputs

The following keys are available via the `${providers.<provider-name>}` template string key for `kubernetes`
providers.

### `providers.<provider-name>.app-namespace`

The primary namespace used for resource deployments.

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

### `providers.<provider-name>.metadata-namespace`

The namespace used for Garden metadata.

| Type | Required |
| -------- | -------- |
| `string` | Yes |
21 changes: 21 additions & 0 deletions docs/reference/providers/local-kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -832,3 +832,24 @@ providers:
namespace:
setupIngressController: nginx
```

## Outputs

The following keys are available via the `${providers.<provider-name>}` template string key for `local-kubernetes`
providers.

### `providers.<provider-name>.app-namespace`

The primary namespace used for resource deployments.

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

### `providers.<provider-name>.metadata-namespace`

The namespace used for Garden metadata.

| Type | Required |
| -------- | -------- |
| `string` | Yes |
36 changes: 18 additions & 18 deletions docs/reference/providers/maven-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,40 @@ The reference is divided into two sections. The [first section](#configuration-k
| --------------- | -------- | ------- |
| `array[object]` | No | `[]` |

### `providers[].environments[]`
### `providers[].name`

[providers](#providers) > environments
[providers](#providers) > name

If specified, this provider will only be used in the listed environments. Note that an empty array effectively disables the provider. To use a provider in all environments, omit this field.
The name of the provider plugin to use.

| Type | Required |
| --------------- | -------- |
| `array[string]` | No |
| Type | Required |
| -------- | -------- |
| `string` | Yes |

Example:

```yaml
providers:
- environments:
- dev
- stage
- name: "local-kubernetes"
```

### `providers[].name`
### `providers[].environments[]`

[providers](#providers) > name
[providers](#providers) > environments

The name of the provider plugin to use.
If specified, this provider will only be used in the listed environments. Note that an empty array effectively disables the provider. To use a provider in all environments, omit this field.

| Type | Required | Default |
| -------- | -------- | ------------------- |
| `string` | Yes | `"maven-container"` |
| Type | Required |
| --------------- | -------- |
| `array[string]` | No |

Example:

```yaml
providers:
- name: "maven-container"
- environments:
- dev
- stage
```


Expand All @@ -55,6 +55,6 @@ The values in the schema below are the default values.

```yaml
providers:
- environments:
name: maven-container
- name:
environments:
```
Loading

0 comments on commit 2ca2774

Please sign in to comment.