helm-pod Run
Executes a Run in an ad-hoc instance of a Kubernetes Pod from a Helm chart and waits for it to complete.
The
resource
field is used to find the Pod spec in the Kubernetes manifests generated by rendering the Helm chart.Below is the full schema reference for the action. For an introduction to configuring Garden, please look at our Configuration guide.
The first section contains the complete YAML schema, and the second section describes each schema key.
helm-pod
actions also export values that are available in template strings. See the Outputs section below for details.The values in the schema below are the default values.
# The type of action, e.g. `exec`, `container` or `kubernetes`. Some are built into Garden but mostly these will be
# defined by your configured providers.
type:
# A valid name for the action. Must be unique across all actions of the same _kind_ in your project.
name:
# A description of the action.
description:
# By default, the directory where the action is defined is used as the source for the build context.
#
# You can override this by setting either `source.path` to another (POSIX-style) path relative to the action source
# directory, or `source.repository` to get the source from an external repository.
#
# If using `source.path`, you must make sure the target path is in a git repository.
#
# For `source.repository` behavior, please refer to the [Remote Sources
# guide](https://docs.garden.io/advanced/using-remote-sources).
source:
# A relative POSIX-style path to the source directory for this action. You must make sure this path exists and is in
# a git repository!
path:
# When set, Garden will import the action source from this repository, but use this action configuration (and not
# scan for configs in the separate repository).
repository:
# A remote repository URL. Currently only supports git servers. Must contain a hash suffix pointing to a specific
# branch or tag, with the format: <git remote url>#<branch|tag>
url:
# A list of other actions that this action depends on, and should be built, deployed or run (depending on the action
# type) before processing this action.
#
# Each dependency should generally be expressed as a `"<kind>.<name>"` string, where _<kind>_ is one of `build`,
# `deploy`, `run` or `test`, and _<name>_ is the name of the action to depend on.
#
# You may also optionally specify a dependency as an object, e.g. `{ kind: "Build", name: "some-image" }`.
#
# Any empty values (i.e. null or empty strings) are ignored, so that you can conditionally add in a dependency via
# template expressions.
dependencies: []
# Set this to `true` to disable the action. You can use this with conditional template strings to disable actions
# based on, for example, the current environment or other variables (e.g. `disabled: ${environment.name == "prod"}`).
# This can be handy when you only need certain actions for specific environments, e.g. only for development.
#
# For Build actions, this means the build is not performed _unless_ it is declared as a dependency by another enabled
# action (in which case the Build is assumed to be necessary for the dependant action to be run or built).
#
# For other action kinds, the action is skipped in all scenarios, and dependency declarations to it are ignored. Note
# however that template strings referencing outputs (i.e. runtime outputs) will fail to resolve when the action is
# disabled, so you need to make sure to provide alternate values for those if you're using them, using conditional
# expressions.
disabled: false
# Specify a list of POSIX-style paths or globs that should be regarded as source files for this action, and thus will
# affect the computed _version_ of the action.
#
# For actions other than _Build_ actions, this is usually not necessary to specify, or is implicitly inferred. An
# exception would be e.g. an `exec` action without a `build` reference, where the relevant files cannot be inferred
# and you want to define which files should affect the version of the action, e.g. to make sure a Test action is run
# when certain files are modified.
#
# _Build_ actions have a different behavior, since they generally are based on some files in the source tree, so
# please reference the docs for more information on those.
#
# Note that you can also _exclude_ files using the `exclude` field or by placing `.gardenignore` files in your source
# tree, which use the same format as `.gitignore` files. See the [Configuration Files
# guide](https://docs.garden.io/using-garden/configuration-overview#including-excluding-files-and-directories) for
# details.
include:
# Specify a list of POSIX-style paths or glob patterns that should be explicitly excluded from the action's version.
#
# For actions other than _Build_ actions, this is usually not necessary to specify, or is implicitly inferred. For
# _Deploy_, _Run_ and _Test_ actions, the exclusions specified here only applied on top of explicitly set `include`
# paths, or such paths inferred by providers. See the [Configuration Files
# guide](https://docs.garden.io/using-garden/configuration-overview#including-excluding-files-and-directories) for
# details.
#
# Unlike the `scan.exclude` field in the project config, the filters here have _no effect_ on which files and
# directories are watched for changes when watching is enabled. Use the project `scan.exclude` field to affect those,
# if you have large directories that should not be watched for changes.
exclude:
# A map of variables scoped to this particular action. These are resolved before any other parts of the action
# configuration and take precedence over group-scoped variables (if applicable) and project-scoped variables, in that
# order. They may reference group-scoped and project-scoped variables, and generally can use any template strings
# normally allowed when resolving the action.
variables:
# Specify a list of paths (relative to the directory where the action is defined) to a file containing variables, that
# we apply on top of the action-level `variables` field, and take precedence over group-level variables (if
# applicable) and project-level variables, in that order.
#
# If you specify multiple paths, they are merged in the order specified, i.e. the last one takes precedence over the
# previous ones.
#
# The format of the files is determined by the configured file's extension:
#
# * `.env` - Standard "dotenv" format, as defined by [dotenv](https://github.com/motdotla/dotenv#rules).
# * `.yaml`/`.yml` - YAML. The file must consist of a YAML document, which must be a map (dictionary). Keys may
# contain any value type.
# * `.json` - JSON. Must contain a single JSON _object_ (not an array).
#
# _NOTE: The default varfile format will change to YAML in Garden v0.13, since YAML allows for definition of nested
# objects and arrays._
#
# To use different varfiles in different environments, you can template in the environment name to the varfile name,
# e.g. `varfile: "my-action.\$\{environment.name\}.env` (this assumes that the corresponding varfiles exist).
#
# If a listed varfile cannot be found, it is ignored.
varfiles: []
# Specify a _Build_ action, and resolve this action from the context of that Build.
#
# For example, you might create an `exec` Build which prepares some manifests, and then reference that in a
# `kubernetes` _Deploy_ action, and the resulting manifests from the Build.
#
# This would mean that instead of looking for manifest files relative to this action's location in your project
# structure, the output directory for the referenced `exec` Build would be the source.
build:
kind:
# Set a timeout for the run to complete, in seconds.
timeout: 600
spec:
# Set to false if you don't want the Runs's result to be cached. Use this if the Run needs to be run any time your
# project (or one or more of the Run's dependants) is deployed. Otherwise the Run is only re-run when its version
# changes, or when you run `garden run`.
cacheResult: true
# The command/entrypoint used to run inside the container.
command:
# The arguments to pass to the command/entypoint used for execution.
args:
# 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.
env: {}
# Specify artifacts to copy out of the container after the run. The artifacts are stored locally under
# the `.garden/artifacts` directory.
artifacts:
- # A POSIX-style path or glob to copy. Must be an absolute path. May contain wildcards.
source:
# A POSIX-style path to copy the artifacts to, relative to the project artifacts directory at
# `.garden/artifacts`.
target: .
# A valid Kubernetes namespace name. Must be a valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters,
# numbers and dashes, must start with a letter, and cannot end with a dash) and must not be longer than 63
# characters.
namespace:
# Optionally override the release name used when rendering the templates (defaults to the Run name).
releaseName:
# Specify the Helm chart to use.
#
# If the chart is defined in the same directory as the action, you can skip this, and the chart sources will be
# detected. If the chart is in the source tree but in a sub-directory, you should set `chart.path` to the directory
# path, relative to the action directory.
#
# If the chart is remote, you can specify `chart.name` and `chart.version\, and optionally `chart.repo` (if the
# chart is not in the default "stable" repo).
#
# You may also specify an absolute URL to a packaged chart via `chart.url`.
#
# One of `chart.name`, `chart.path` or `chart.url` must be specified.
chart:
# A valid Helm chart name or URI (same as you'd input to `helm install`) Required if the action doesn't contain
# the Helm chart itself.
name:
# The path, relative to the action path, to the chart sources (i.e. where the Chart.yaml file is, if any).
path:
# The repository URL to fetch the chart from. Defaults to the "stable" helm repo (https://charts.helm.sh/stable).
repo:
# An absolute URL to a packaged URL.
url:
# The chart version to deploy.
version:
# Map of values to pass to Helm when rendering the templates. May include arrays and nested objects. When specified,
# these take precedence over the values in the `values.yaml` file (or the files specified in `valueFiles`).
values: {}
# Specify value files to use when rendering the Helm chart. These will take precedence over the `values.yaml` file
# bundled in the Helm chart, and should be specified in ascending order of precedence. Meaning, the last file in
# this list will have the highest precedence.
#
# If you _also_ specify keys under the `values` field, those will effectively be added as another file at the end
# of this list, so they will take precedence over other files listed here.
#
# Note that the paths here should be relative to the _config_ root, and the files should be contained in
# this action config's directory.
valueFiles: []
# Specify a Kubernetes resource to derive the Pod spec from for the Run.
#
# This resource will be selected from the manifests provided in this Run's `files` or `manifests` config field.
#
# The following fields from the Pod will be used (if present) when executing the Run:
# * `affinity`
# * `automountServiceAccountToken`
# * `containers`
# * `dnsConfig`
# * `dnsPolicy`
# * `enableServiceLinks`
# * `hostAliases`
# * `hostIPC`
# * `hostNetwork`
# * `hostPID`
# * `hostname`
# * `imagePullSecrets`
# * `nodeName`
# * `nodeSelector`
# * `overhead`
# * `preemptionPolicy`
# * `priority`
# * `priorityClassName`
# * `runtimeClassName`
# * `schedulerName`
# * `securityContext`
# * `serviceAccount`
# * `serviceAccountName`
# * `shareProcessNamespace`
# * `subdomain`
# * `tolerations`
# * `topologySpreadConstraints`
# * `volumes`
resource:
# The kind of Kubernetes resource to find.
kind:
# The name of the resource, of the specified `kind`. If specified, you must also specify `kind`.
name:
# A map of string key/value labels to match on any Pods in the namespace. When specified, a random ready Pod with
# matching labels will be picked as a target, so make sure the labels will always match a specific Pod type.
podSelector:
# The name of a container in the target. Specify this if the target contains more than one container and the main
# container is not the first container in the spec.
containerName:
# Time in seconds to wait for Helm to render templates.
timeout: 300
The type of action, e.g.
exec
, container
or kubernetes
. Some are built into Garden but mostly these will be defined by your configured providers.Type | Required |
---|---|
string | Yes |
A valid name for the action. Must be unique across all actions of the same kind in your project.
Type | Required |
---|---|
string | Yes |
A description of the action.
Type | Required |
---|---|
string | No |
By default, the directory where the action is defined is used as the source for the build context.
You can override this by setting either
source.path
to another (POSIX-style) path relative to the action source directory, or source.repository
to get the source from an external repository.If using
source.path
, you must make sure the target path is in a git repository.Type | Required |
---|---|
object | No |
A relative POSIX-style path to the source directory for this action. You must make sure this path exists and is in a git repository!
Type | Required |
---|---|
posixPath | No |
When set, Garden will import the action source from this repository, but use this action configuration (and not scan for configs in the separate repository).
Type | Required |
---|---|
object | No |
A remote repository URL. Currently only supports git servers. Must contain a hash suffix pointing to a specific branch or tag, with the format: #<branch|tag>
Type | Required |
---|---|
gitUrl | string | Yes |
Example:
source:
...
repository:
...
url: "git+https://github.com/org/repo.git#v2.0"
A list of other actions that this action depends on, and should be built, deployed or run (depending on the action type) before processing this action.
Each dependency should generally be expressed as a
"<kind>.<name>"
string, where is one of build
, deploy
, run
or test
, and is the name of the action to depend on.You may also optionally specify a dependency as an object, e.g.
{ kind: "Build", name: "some-image" }
.Any empty values (i.e. null or empty strings) are ignored, so that you can conditionally add in a dependency via template expressions.
Type | Default | Required |
---|---|---|
array[actionReference] | [] | No |
Example:
dependencies:
- build.my-image
- deploy.api
Set this to
true
to disable the action. You can use this with conditional template strings to disable actions based on, for example, the current environment or other variables (e.g. disabled: ${environment.name == "prod"}
). This can be handy when you only need certain actions for specific environments, e.g. only for development.For Build actions, this means the build is not performed unless it is declared as a dependency by another enabled action (in which case the Build is assumed to be necessary for the dependant action to be run or built).
For other action kinds, the action is skipped in all scenarios, and dependency declarations to it are ignored. Note however that template strings referencing outputs (i.e. runtime outputs) will fail to resolve when the action is disabled, so you need to make sure to provide alternate values for those if you're using them, using conditional expressions.
Type | Default | Required |
---|---|---|
boolean | false | No |
Specify a list of POSIX-style paths or globs that should be regarded as source files for this action, and thus will affect the computed version of the action.
For actions other than Build actions, this is usually not necessary to specify, or is implicitly inferred. An exception would be e.g. an
exec
action without a build
reference, where the relevant files cannot be inferred and you want to define which files should affect the version of the action, e.g. to make sure a Test action is run when certain files are modified.Build actions have a different behavior, since they generally are based on some files in the source tree, so please reference the docs for more information on those.
Note that you can also exclude files using the
exclude
field or by placing .gardenignore
files in your source tree, which use the same format as .gitignore
files. See the Configuration Files guide for details.Type | Required |
---|---|
array[posixPath] | No |
Example:
include:
- my-app.js
- some-assets/**/*
Specify a list of POSIX-style paths or glob patterns that should be explicitly excluded from the action's version.
For actions other than Build actions, this is usually not necessary to specify, or is implicitly inferred. For Deploy, Run and Test actions, the exclusions specified here only applied on top of explicitly set
include
paths, or such paths inferred by providers. See the Configuration Files guide for details.Unlike the
scan.exclude
field in the project config, the filters here have no effect on which files and directories are watched for changes when watching is enabled. Use the project scan.exclude
field to affect those, if you have large directories that should not be watched for changes.Type | Required |
---|---|
array[posixPath] | No |
Example:
exclude:
- tmp/**/*
- '*.log'
A map of variables scoped to this particular action. These are resolved before any other parts of the action configuration and take precedence over group-scoped variables (if applicable) and project-scoped variables, in that order. They may reference group-scoped and project-scoped variables, and generally can use any template strings normally allowed when resolving the action.
Type | Required |
---|---|
object | No |
Specify a list of paths (relative to the directory where the action is defined) to a file containing variables, that we apply on top of the action-level
variables
field, and take precedence over group-level variables (if applicable) and project-level variables, in that order.If you specify multiple paths, they are merged in the order specified, i.e. the last one takes precedence over the previous ones.
The format of the files is determined by the configured file's extension:
.yaml
/.yml
- YAML. The file must consist of a YAML document, which must be a map (dictionary). Keys may contain any value type..json
- JSON. Must contain a single JSON object (not an array).
NOTE: The default varfile format will change to YAML in Garden v0.13, since YAML allows for definition of nested objects and arrays.
To use different varfiles in different environments, you can template in the environment name to the varfile name, e.g.
varfile: "my-action.\$\{environment.name\}.env
(this assumes that the corresponding varfiles exist).If a listed varfile cannot be found, it is ignored.
Type | Default | Required |
---|---|---|
array[posixPath] | [] | No |
Example:
varfiles:
"my-action.env"
Specify a Build action, and resolve this action from the context of that Build.
For example, you might create an
exec
Build which prepares some manifests, and then reference that in a kubernetes
Deploy action, and the resulting manifests from the Build.This would mean that instead of looking for manifest files relative to this action's location in your project structure, the output directory for the referenced
exec
Build would be the source.Type | Required |
---|---|
string | No |
Type | Allowed Values | Required |
---|---|---|
string | "Run" | Yes |
Set a timeout for the run to complete, in seconds.
Type | Default | Required |
---|---|---|
number | 600 | No |
Type | Required |
---|---|
object | No |
Set to false if you don't want the Runs's result to be cached. Use this if the Run needs to be run any time your project (or one or more of the Run's dependants) is deployed. Otherwise the Run is only re-run when its version changes, or when you run
garden run
.Type | Default | Required |
---|---|---|
boolean | true | No |
The command/entrypoint used to run inside the container.
Type | Required |
---|---|
array[string] | No |
Example:
spec:
...
command:
- /bin/sh
- '-c'
The arguments to pass to the command/entypoint used for execution.
Type | Required |
---|---|
array[string] | No |
Example:
spec:
...
args:
- rake
- 'db:migrate'
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 | Default | Required |
---|---|---|
object | {} | No |
Example:
spec:
...
env:
- MY_VAR: some-value
MY_SECRET_VAR:
secretRef:
name: my-secret
key: some-key
- {}
Specify artifacts to copy out of the container after the run. The artifacts are stored locally under the
.garden/artifacts
directory.Type | Default | Required |
---|---|---|
array[object] | [] | No |
A POSIX-style path or glob to copy. Must be an absolute path. May contain wildcards.
Type | Required |
---|---|
posixPath | Yes |
Example:
spec:
...
artifacts:
- source: "/output/**/*"
A POSIX-style path to copy the artifacts to, relative to the project artifacts directory at
.garden/artifacts
.Type | Default | Required |
---|---|---|
posixPath | "." | No |
Example:
spec:
...
artifacts:
- target: "outputs/foo/"
A valid Kubernetes namespace name. Must be a valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a letter, and cannot end with a dash) and must not be longer than 63 characters.
Type | Required |
---|---|
string | No |
Optionally override the release name used when rendering the templates (defaults to the Run name).
Type | Required |
---|---|
string | No |
Specify the Helm chart to use.
If the chart is defined in the same directory as the action, you can skip this, and the chart sources will be detected. If the chart is in the source tree but in a sub-directory, you should set
chart.path
to the directory path, relative to the action directory.If the chart is remote, you can specify
chart.name
and chart.version\, and optionally
chart.repo` (if the chart is not in the default "stable" repo).You may also specify an absolute URL to a packaged chart via
chart.url
.One of
chart.name
, chart.path
or chart.url
must be specified.Type | Required |
---|---|
object | No |
A valid Helm chart name or URI (same as you'd input to
helm install
) Required if the action doesn't contain the Helm chart itself.Type | Required |
---|---|
string | No |
Example:
spec:
...
chart:
...
name: "ingress-nginx"
The path, relative to the action path, to the chart sources (i.e. where the Chart.yaml file is, if any).
Type | Required |
---|---|
posixPath | No |
The repository URL to fetch the chart from. Defaults to the "stable" helm repo (https://charts.helm.sh/stable).
Type | Required |
---|---|
string | No |
An absolute URL to a packaged URL.
Type | Required |
---|---|
string | No |
The chart version to deploy.
Type | Required |
---|---|
string | No |
Map of values to pass to Helm when rendering the templates. May include arrays and nested objects. When specified, these take precedence over the values in the
values.yaml
file (or the files specified in valueFiles
).Type | Default | Required |
---|---|---|
object | {} | No |
Specify value files to use when rendering the Helm chart. These will take precedence over the
values.yaml
file bundled in the Helm chart, and should be specified in ascending order of precedence. Meaning, the last file in this list will have the highest precedence.If you also specify keys under the
values
field, those will effectively be added as another file at the end of this list, so they will take precedence over other files listed here.Note that the paths here should be relative to the config root, and the files should be contained in this action config's directory.
Type | Default | Required |
---|---|---|
array[posixPath] | [] | No |
Specify a Kubernetes resource to derive the Pod spec from for the Run.
This resource will be selected from the manifests provided in this Run's
files
or manifests
config field.The following fields from the Pod will be used (if present) when executing the Run:
affinity
automountServiceAccountToken
containers
dnsConfig
dnsPolicy
enableServiceLinks
hostAliases
hostIPC
hostNetwork
hostPID
hostname
imagePullSecrets
nodeName
nodeSelector
overhead
preemptionPolicy
priority
priorityClassName
runtimeClassName
schedulerName
securityContext
serviceAccount
serviceAccountName
shareProcessNamespace
subdomain
tolerations
topologySpreadConstraints
volumes
Type | Required |
---|---|
object | No |
The kind of Kubernetes resource to find.
Type | Allowed Values | Required |
---|---|---|
string | "Deployment", "DaemonSet", "StatefulSet" | Yes |
The name of the resource, of the specified
kind
. If specified, you must also specify kind
.Type | Required |
---|---|
string | No |
A map of string key/value labels to match on any Pods in the namespace. When specified, a random ready Pod with matching labels will be picked as a target, so make sure the labels will always match a specific Pod type.
Type | Required |
---|---|
object | No |
The name of a container in the target. Specify this if the target contains more than one container and the main container is not the first container in the spec.
Type | Required |
---|---|
string | No |
Time in seconds to wait for Helm to render templates.
Type | Default | Required |
---|---|---|
number | 300 | No |
The following keys are available via the
${actions.run.<name>}
template string key for helm-pod
action.The name of the action.
Type |
---|
string |
Whether the action is disabled.
Type |
---|
boolean |
Example:
my-variable: ${actions.run.my-run.disabled}
The local path to the action build directory.
Type |
---|
string |
Example:
my-variable: ${actions.run.my-run.buildPath}
The local path to the action source directory.