helm Deploy
Description
Specify a Helm chart (either in your repository or remote from a registry) to deploy.
Refer to the Helm guide for usage instructions.
Garden uses Helm 3.16.2.
Below is the full schema reference for the action. For an introduction to configuring Garden, please look at our Configuration guide.
helm
actions also export values that are available in template strings. See the Outputs section below for details.
Configuration Keys
type
type
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.
string
Yes
name
name
A valid name for the action. Must be unique across all actions of the same kind in your project.
string
Yes
description
description
A description of the action.
string
No
source
source
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.
object
No
source.path
source.path
source > path
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!
posixPath
No
source.repository
source.repository
source > repository
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).
object
No
source.repository.url
source.repository.url
source > repository > url
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>
gitUrl | string
Yes
Example:
dependencies[]
dependencies[]
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.
array[actionReference]
[]
No
Example:
disabled
disabled
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.
boolean
false
No
environments[]
environments[]
If set, the action is only enabled for the listed environment types. This is effectively a cleaner shorthand for the disabled
field with an expression for environments. For example, environments: ["prod"]
is equivalent to disabled: ${environment.name != "prod"}
.
array[string]
No
include[]
include[]
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.
array[posixPath]
No
Example:
exclude[]
exclude[]
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.
array[posixPath]
No
Example:
variables
variables
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.
object
No
varfiles[]
varfiles[]
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. YAML format is used by default..env
- Standard "dotenv" format, as defined by dotenv..json
- JSON. Must contain a single JSON object (not an array).
NOTE: The default varfile format was changed 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, throwing an error. To add optional varfiles, you can use a list item object with a path
and an optional optional
boolean field.
array[alternatives]
[]
No
Example:
varfiles[].path
varfiles[].path
varfiles > path
Path to a file containing a path.
posixPath
Yes
varfiles[].optional
varfiles[].optional
varfiles > optional
Whether the varfile is optional.
boolean
No
build
build
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.
string
No
kind
kind
string
"Deploy"
Yes
timeout
timeout
Timeout for the deploy to complete, in seconds.
number
300
No
spec
spec
object
No
spec.namespace
spec.namespace
spec > namespace
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.
string
No
spec.portForwards[]
spec.portForwards[]
spec > portForwards
Manually specify port forwards that Garden should set up when deploying in dev or watch mode. If specified, these override the auto-detection of forwardable ports, so you'll need to specify the full list of port forwards to create.
array[object]
No
spec.portForwards[].name
spec.portForwards[].name
spec > portForwards > name
An identifier to describe the port forward.
string
No
spec.portForwards[].resource
spec.portForwards[].resource
spec > portForwards > resource
The full resource kind and name to forward to, e.g. Service/my-service or Deployment/my-deployment. Note that Garden will not validate this ahead of attempting to start the port forward, so you need to make sure this is correctly set. The types of resources supported will match that of the kubectl port-forward
CLI command.
string
Yes
spec.portForwards[].targetPort
spec.portForwards[].targetPort
spec > portForwards > targetPort
The port number on the remote resource to forward to.
number
Yes
spec.portForwards[].localPort
spec.portForwards[].localPort
spec > portForwards > localPort
The preferred local port to forward from. If none is set, a random port is chosen. If the specified port is not available, a warning is shown and a random port chosen instead.
number
No
spec.releaseName
spec.releaseName
spec > releaseName
Optionally override the release name used when installing (defaults to the Deploy name).
string
No
spec.timeout
spec.timeout
spec > timeout
Time in seconds to wait for Helm to complete any individual Kubernetes operation (like Jobs for hooks).
number
300
No
spec.values
spec.values
spec > values
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
).
object
{}
No
spec.valueFiles[]
spec.valueFiles[]
spec > valueFiles
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.
array[posixPath]
[]
No
spec.atomic
spec.atomic
spec > atomic
Whether to set the --atomic
flag during installs and upgrades. Set to true
if you'd like the changes applied to be reverted on failure. Set to false if e.g. you want to see more information about failures and then manually roll back, instead of having Helm do it automatically on failure.
Note that setting atomic
to true
implies wait
.
boolean
false
No
spec.waitForUnhealthyResources
spec.waitForUnhealthyResources
spec > waitForUnhealthyResources
Whether to wait for the Helm command to complete before throwing an error if one of the resources being installed/upgraded is unhealthy.
By default, Garden will monitor the resources being created by Helm and throw an error as soon as one of them is unhealthy. This allows Garden to fail fast if there's an issue with one of the resources. If no issue is detected, Garden waits for the Helm command to complete.
If however waitForUnhealthyResources
is set to true
and some resources are unhealthy, then Garden will wait for Helm itself to throw an error which typically happens when it times out in the case of unhealthy resources (e.g. due to ImagePullBackOff
or CrashLoopBackOff
errors).
Waiting for the timeout can take awhile so using the default value here is recommended unless you'd like to completely mimic Helm's behaviour and not rely on Garden's resource monitoring.
Note that setting atomic
to true
implies waitForUnhealthyResources
.
boolean
false
No
spec.chart
spec.chart
spec > chart
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.
For remote charts, there are multiple options:
Helm Chart repository: specify
chart.name
andchart.version\, and optionally
chart.repo` (if the chart is not in the default "stable" repo).OCI-Based Registry: specify
chart.url
with theoci://
URL and optionallychart.version
.Absolute URL to a packaged chart: specify
chart.url
.
One of chart.name
, chart.path
or chart.url
must be specified.
object
No
spec.chart.name
spec.chart.name
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.
string
No
Example:
spec.chart.path
spec.chart.path
The path, relative to the action path, to the chart sources (i.e. where the Chart.yaml file is, if any).
posixPath
No
spec.chart.repo
spec.chart.repo
The repository URL to fetch the chart from. Defaults to the "stable" helm repo (https://charts.helm.sh/stable).
string
No
spec.chart.url
spec.chart.url
URL to OCI repository, or a URL to a packaged Helm chart archive.
string
No
spec.chart.version
spec.chart.version
The chart version to deploy.
string
No
spec.defaultTarget
spec.defaultTarget
spec > defaultTarget
Specify a default resource in the deployment to use for syncs, local mode, and for the garden exec
command.
Specify either kind
and name
, or a podSelector
. The resource should be one of the resources deployed by this action (otherwise the target is not guaranteed to be deployed with adjustments required for syncing or local mode).
Set containerName
to specify a container to connect to in the remote Pod. By default the first container in the Pod is used.
Note that if you specify podSelector
here, it is not validated to be a selector matching one of the resources deployed by the action.
object
No
spec.defaultTarget.kind
spec.defaultTarget.kind
spec > defaultTarget > kind
The kind of Kubernetes resource to find.
string
"Deployment", "DaemonSet", "StatefulSet"
Yes
spec.defaultTarget.name
spec.defaultTarget.name
spec > defaultTarget > name
The name of the resource, of the specified kind
. If specified, you must also specify kind
.
string
No
spec.defaultTarget.podSelector
spec.defaultTarget.podSelector
spec > defaultTarget > podSelector
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.
object
No
spec.defaultTarget.containerName
spec.defaultTarget.containerName
spec > defaultTarget > containerName
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.
string
No
spec.sync
spec.sync
spec > sync
Configure path syncs for the resources in this Deploy.
If you have multiple syncs for the Deploy, you can use the defaults
field to set common configuration for every individual sync.
object
No
spec.sync.defaults
spec.sync.defaults
Defaults to set across every sync for this Deploy. If you use the exclude
field here, it will be merged with any excludes set in individual syncs. These are applied on top of any defaults set in the provider configuration.
object
No
spec.sync.defaults.exclude[]
spec.sync.defaults.exclude[]
spec > sync > defaults > exclude
Specify a list of POSIX-style paths or glob patterns that should be excluded from the sync.
Any exclusion patterns defined in individual sync specs will be applied in addition to these patterns.
.git
directories and .garden
directories are always ignored.
array[posixPath]
No
Example:
spec.sync.defaults.fileMode
spec.sync.defaults.fileMode
spec > sync > defaults > fileMode
The default permission bits, specified as an octal, to set on files at the sync target. Defaults to 0o644 (user can read/write, everyone else can read). See the Mutagen docs for more information.
number
0o644
No
spec.sync.defaults.directoryMode
spec.sync.defaults.directoryMode
spec > sync > defaults > directoryMode
The default permission bits, specified as an octal, to set on directories at the sync target. Defaults to 0o755 (user can read/write, everyone else can read). See the Mutagen docs for more information.
number
0o755
No
spec.sync.defaults.owner
spec.sync.defaults.owner
spec > sync > defaults > owner
Set the default owner of files and directories at the target. Specify either an integer ID or a string name. See the Mutagen docs for more information.
number | string
No
spec.sync.defaults.group
spec.sync.defaults.group
spec > sync > defaults > group
Set the default group on files and directories at the target. Specify either an integer ID or a string name. See the Mutagen docs for more information.
number | string
No
spec.sync.paths[]
spec.sync.paths[]
A list of syncs to start once the Deploy is successfully started.
array[object]
No
spec.sync.paths[].target
spec.sync.paths[].target
The Kubernetes resource to sync to. If specified, this is used instead of spec.defaultTarget
.
object
No
spec.sync.paths[].target.kind
spec.sync.paths[].target.kind
spec > sync > paths > target > kind
The kind of Kubernetes resource to find.
string
"Deployment", "DaemonSet", "StatefulSet"
Yes
spec.sync.paths[].target.name
spec.sync.paths[].target.name
spec > sync > paths > target > name
The name of the resource, of the specified kind
. If specified, you must also specify kind
.
string
No
spec.sync.paths[].target.podSelector
spec.sync.paths[].target.podSelector
spec > sync > paths > target > podSelector
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.
object
No
spec.sync.paths[].target.containerName
spec.sync.paths[].target.containerName
spec > sync > paths > target > containerName
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.
string
No
spec.sync.paths[].sourcePath
spec.sync.paths[].sourcePath
spec > sync > paths > sourcePath
Path to a local directory to be synchronized with the target. This should generally be a templated path to another action's source path (e.g. ${actions.build.my-container-image.sourcePath}
), or a relative path. If a path is hard-coded, we recommend sticking with relative paths here, and using forward slashes (/
) as a delimiter, as Windows-style paths with back slashes (\
) and absolute paths will work on some platforms, but they are not portable and will not work for users on other platforms. Defaults to the Deploy action's config's directory if no value is provided.
string
"."
No
Example:
spec.sync.paths[].containerPath
spec.sync.paths[].containerPath
spec > sync > paths > containerPath
POSIX-style absolute path to sync to inside the container. The root path (i.e. "/") is not allowed.
posixPath
Yes
Example:
spec.sync.paths[].exclude[]
spec.sync.paths[].exclude[]
Specify a list of POSIX-style paths or glob patterns that should be excluded from the sync.
.git
directories and .garden
directories are always ignored.
array[posixPath]
No
Example:
spec.sync.paths[].mode
spec.sync.paths[].mode
The sync mode to use for the given paths. See the Code Synchronization guide for details.
string
"one-way", "one-way-safe", "one-way-replica", "one-way-reverse", "one-way-replica-reverse", "two-way", "two-way-safe", "two-way-resolved"
"one-way-safe"
Yes
spec.sync.paths[].defaultFileMode
spec.sync.paths[].defaultFileMode
spec > sync > paths > defaultFileMode
The default permission bits, specified as an octal, to set on files at the sync target. Defaults to 0o644 (user can read/write, everyone else can read). See the Mutagen docs for more information.
number
0o644
No
spec.sync.paths[].defaultDirectoryMode
spec.sync.paths[].defaultDirectoryMode
spec > sync > paths > defaultDirectoryMode
The default permission bits, specified as an octal, to set on directories at the sync target. Defaults to 0o755 (user can read/write, everyone else can read). See the Mutagen docs for more information.
number
0o755
No
spec.sync.paths[].defaultOwner
spec.sync.paths[].defaultOwner
spec > sync > paths > defaultOwner
Set the default owner of files and directories at the target. Specify either an integer ID or a string name. See the Mutagen docs for more information.
number | string
No
spec.sync.paths[].defaultGroup
spec.sync.paths[].defaultGroup
spec > sync > paths > defaultGroup
Set the default group on files and directories at the target. Specify either an integer ID or a string name. See the Mutagen docs for more information.
number | string
No
spec.sync.overrides[]
spec.sync.overrides[]
Overrides for the container command and/or arguments for when in sync mode.
array[object]
No
spec.sync.overrides[].target
spec.sync.overrides[].target
spec > sync > overrides > target
The Kubernetes resources to override. If specified, this is used instead of spec.defaultTarget
.
object
No
spec.sync.overrides[].target.kind
spec.sync.overrides[].target.kind
spec > sync > overrides > target > kind
The kind of Kubernetes resource to find.
string
"Deployment", "DaemonSet", "StatefulSet"
Yes
spec.sync.overrides[].target.name
spec.sync.overrides[].target.name
spec > sync > overrides > target > name
The name of the resource, of the specified kind
. If specified, you must also specify kind
.
string
No
spec.sync.overrides[].target.podSelector
spec.sync.overrides[].target.podSelector
spec > sync > overrides > target > podSelector
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.
object
No
spec.sync.overrides[].target.containerName
spec.sync.overrides[].target.containerName
spec > sync > overrides > target > containerName
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.
string
No
spec.sync.overrides[].command[]
spec.sync.overrides[].command[]
spec > sync > overrides > command
Override the command/entrypoint in the matched container.
array[string]
No
spec.sync.overrides[].args[]
spec.sync.overrides[].args[]
spec > sync > overrides > args
Override the args in the matched container.
array[string]
No
spec.sync.overrides[].image
spec.sync.overrides[].image
spec > sync > overrides > image
Override the image of the matched container.
string
No
spec.localMode
spec.localMode
spec > localMode
[EXPERIMENTAL] Configures the local application which will send and receive network requests instead of the target resource specified by localMode.target
or defaultTarget
. One of those fields must be specified to enable local mode for the action.
The selected container of the target Kubernetes resource will be replaced by a proxy container which runs an SSH server to proxy requests. Reverse port-forwarding will be automatically configured to route traffic to the locally run application and back.
Local mode is enabled by setting the --local
option on the garden deploy
command. Local mode always takes the precedence over sync mode if there are any conflicting service names.
Health checks are disabled for services running in local mode.
See the Local Mode guide for more information.
Note! This feature is still experimental. Some incompatible changes can be made until the first non-experimental release.
object
No
spec.localMode.ports[]
spec.localMode.ports[]
The reverse port-forwards configuration for the local application.
array[object]
No
spec.localMode.ports[].local
spec.localMode.ports[].local
spec > localMode > ports > local
The local port to be used for reverse port-forward.
number
No
spec.localMode.ports[].remote
spec.localMode.ports[].remote
spec > localMode > ports > remote
The remote port to be used for reverse port-forward.
number
No
spec.localMode.command[]
spec.localMode.command[]
The command to run the local application. If not present, then the local application should be started manually.
array[string]
No
spec.localMode.restart
spec.localMode.restart
Specifies restarting policy for the local application. By default, the local application will be restarting infinitely with 1000ms between attempts.
object
{"delayMsec":1000,"max":null}
No
spec.localMode.restart.delayMsec
spec.localMode.restart.delayMsec
spec > localMode > restart > delayMsec
Delay in milliseconds between the local application restart attempts. The default value is 1000ms.
number
1000
No
spec.localMode.restart.max
spec.localMode.restart.max
spec > localMode > restart > max
Max number of the local application restarts. Unlimited by default.
number
null
No
spec.localMode.target
spec.localMode.target
The remote Kubernetes resource to proxy traffic from. If specified, this is used instead of defaultTarget
.
object
No
spec.localMode.target.kind
spec.localMode.target.kind
spec > localMode > target > kind
The kind of Kubernetes resource to find.
string
"Deployment", "DaemonSet", "StatefulSet"
Yes
spec.localMode.target.name
spec.localMode.target.name
spec > localMode > target > name
The name of the resource, of the specified kind
. If specified, you must also specify kind
.
string
No
spec.localMode.target.podSelector
spec.localMode.target.podSelector
spec > localMode > target > podSelector
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.
object
No
spec.localMode.target.containerName
spec.localMode.target.containerName
spec > localMode > target > containerName
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.
string
No
Outputs
The following keys are available via the ${actions.deploy.<name>}
template string key for helm
action.
${actions.deploy.<name>.name}
${actions.deploy.<name>.name}
The name of the action.
string
${actions.deploy.<name>.disabled}
${actions.deploy.<name>.disabled}
Whether the action is disabled.
boolean
Example:
${actions.deploy.<name>.buildPath}
${actions.deploy.<name>.buildPath}
The local path to the action build directory.
string
Example:
${actions.deploy.<name>.sourcePath}
${actions.deploy.<name>.sourcePath}
The local path to the action source directory.
string
Example:
${actions.deploy.<name>.mode}
${actions.deploy.<name>.mode}
The mode that the action should be executed in (e.g. 'sync' or 'local' for Deploy actions). Set to 'default' if no special mode is being used.
Build actions inherit the mode from Deploy actions that depend on them. E.g. If a Deploy action is in 'sync' mode and depends on a Build action, the Build action will inherit the 'sync' mode setting from the Deploy action. This enables installing different tools that may be necessary for different development modes.
string
"default"
Example:
${actions.deploy.<name>.var.*}
${actions.deploy.<name>.var.*}
The variables configured on the action.
object
{}
${actions.deploy.<name>.var.<name>}
${actions.deploy.<name>.var.<name>}
string | number | boolean | link | array[link]
Last updated