# openfaas

## Description

This provider adds support for [OpenFaaS](https://www.openfaas.com/). It adds the [`openfaas` module type](/acorn-0.12/reference/module-types/openfaas.md) and (by default) installs the `faas-netes` runtime to the project namespace. Each `openfaas` module maps to a single OpenFaaS function.

See the reference below for configuration options for `faas-netes`, and the [module type docs](/acorn-0.12/reference/module-types/openfaas.md) for how to configure the individual functions.

Also see the [openfaas example project](https://github.com/garden-io/garden/tree/0.12.71/examples/openfaas) for a simple usage example.

Below is the full schema reference for the provider configuration. For an introduction to configuring a Garden project with providers, please look at our [configuration guide](/acorn-0.12/using-garden/configuration-overview.md).

The reference is divided into two sections. The [first section](#complete-yaml-schema) contains the complete YAML schema, and the [second section](#configuration-keys) describes each schema key.

## Complete YAML Schema

The values in the schema below are the default values.

```yaml
providers:
  - # List other providers that should be resolved before this one.
    dependencies: []

    # 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.
    environments:

    # The name of the provider plugin to use.
    name: openfaas

    # The external URL to the function gateway, after installation. This is required if you set `faasNetes.values`
    # or `faastNetes.install: false`, so that Garden can know how to reach the gateway.
    gatewayUrl:

    # The ingress hostname to configure for the function gateway, when `faasNetes.install: true` and not
    # overriding `faasNetes.values`. Defaults to the default hostname of the configured Kubernetes provider.
    #
    # Important: If you have other types of services, this should be different from their ingress hostnames,
    # or the other services should not expose paths under /function and /system to avoid routing conflicts.
    hostname:

    faasNetes:
      # Set to false if you'd like to install and configure faas-netes yourself.
      # See the [official instructions](https://docs.openfaas.com/deployment/kubernetes/) for details.
      install: true

      # Override the values passed to the faas-netes Helm chart. Ignored if `install: false`.
      # See the [chart docs](https://github.com/openfaas/faas-netes/tree/master/chart/openfaas) for the available
      # options.
      #
      # Note that this completely replaces the values Garden assigns by default, including `functionNamespace`,
      # ingress configuration etc. so you need to make sure those are correctly configured for your use case.
      values:
```

## Configuration Keys

### `providers[]`

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

### `providers[].dependencies[]`

[providers](#providers) > dependencies

List other providers that should be resolved before this one.

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

Example:

```yaml
providers:
  - dependencies:
      - exec
```

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

[providers](#providers) > environments

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 |
| --------------- | -------- |
| `array[string]` | No       |

Example:

```yaml
providers:
  - environments:
      - dev
      - stage
```

### `providers[].name`

[providers](#providers) > name

The name of the provider plugin to use.

| Type     | Default      | Required |
| -------- | ------------ | -------- |
| `string` | `"openfaas"` | Yes      |

Example:

```yaml
providers:
  - name: "openfaas"
```

### `providers[].gatewayUrl`

[providers](#providers) > gatewayUrl

The external URL to the function gateway, after installation. This is required if you set `faasNetes.values` or `faastNetes.install: false`, so that Garden can know how to reach the gateway.

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

Example:

```yaml
providers:
  - gatewayUrl: "https://functions.mydomain.com"
```

### `providers[].hostname`

[providers](#providers) > hostname

The ingress hostname to configure for the function gateway, when `faasNetes.install: true` and not overriding `faasNetes.values`. Defaults to the default hostname of the configured Kubernetes provider.

Important: If you have other types of services, this should be different from their ingress hostnames, or the other services should not expose paths under /function and /system to avoid routing conflicts.

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

Example:

```yaml
providers:
  - hostname: "functions.mydomain.com"
```

### `providers[].faasNetes`

[providers](#providers) > faasNetes

| Type     | Default            | Required |
| -------- | ------------------ | -------- |
| `object` | `{"install":true}` | No       |

### `providers[].faasNetes.install`

[providers](#providers) > [faasNetes](#providersfaasnetes) > install

Set to false if you'd like to install and configure faas-netes yourself. See the [official instructions](https://docs.openfaas.com/deployment/kubernetes/) for details.

| Type      | Default | Required |
| --------- | ------- | -------- |
| `boolean` | `true`  | No       |

### `providers[].faasNetes.values`

[providers](#providers) > [faasNetes](#providersfaasnetes) > values

Override the values passed to the faas-netes Helm chart. Ignored if `install: false`. See the [chart docs](https://github.com/openfaas/faas-netes/tree/master/chart/openfaas) for the available options.

Note that this completely replaces the values Garden assigns by default, including `functionNamespace`, ingress configuration etc. so you need to make sure those are correctly configured for your use case.

| Type     | Required |
| -------- | -------- |
| `object` | No       |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.garden.io/acorn-0.12/reference/providers/openfaas.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
