kubernetes-pod Run
Executes a Run in an ad-hoc instance of a Kubernetes Pod and waits for it to complete.
The pod spec can be provided directly via the
podSpec
field, or the resource
field can be used to find the pod spec in the Kubernetes manifests provided via the files
and/or manifests
fields.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.
kubernetes-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:
# List of Kubernetes resource manifests to be searched (using `resource`e for the pod spec for the Run. If `files`
# is also specified, this is combined with the manifests read from the files.
manifests:
- # The API version of the resource.
apiVersion:
# The kind of the resource.
kind:
metadata:
# The name of the resource.
name:
# POSIX-style paths to YAML files to load manifests from. Each can contain multiple manifests, and can include any
# Garden template strings, which will be resolved before searching the manifests for the resource that contains the
# Pod spec for the Run.
files: []
# 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:
# Supply a custom Pod specification. This should be a normal Kubernetes Pod manifest. Note that the spec will be
# modified for the Run, including overriding with other fields you may set here (such as `args` and `env`), and
# removing certain fields that are not supported.
#
# The following Pod spec fields from the selected `resource` 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`
podSpec:
# Optional duration in seconds the pod may be active on the node relative to StartTime before the system will
# actively try to mark it failed and kill associated containers. Value must be a positive integer.
activeDeadlineSeconds:
# Affinity is a group of affinity scheduling rules.
affinity:
# Node affinity is a group of node affinity scheduling rules.
nodeAffinity:
# The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this
# field, but it may choose a node that violates one or more of the expressions. The node that is most
# preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling
# requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by
# iterating through the elements of this field and adding "weight" to the sum if the node matches the
# corresponding matchExpressions; the node(s) with the highest sum are the most preferred.
preferredDuringSchedulingIgnoredDuringExecution:
# A node selector represents the union of the results of one or more label queries over a set of nodes; that
# is, it represents the OR of the selectors represented by the node selector terms.
requiredDuringSchedulingIgnoredDuringExecution:
# Required. A list of node selector terms. The terms are ORed.
nodeSelectorTerms:
# Pod affinity is a group of inter pod affinity scheduling rules.
podAffinity:
# The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this
# field, but it may choose a node that violates one or more of the expressions. The node that is most
# preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling
# requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by
# iterating through the elements of this field and adding "weight" to the sum if the node has pods which
# matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.
preferredDuringSchedulingIgnoredDuringExecution:
# If the affinity requirements specified by this field are not met at scheduling time, the pod will not be
# scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point
# during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the
# pod from its node. When there are multiple elements, the lists of nodes corresponding to each
# podAffinityTerm are intersected, i.e. all terms must be satisfied.
requiredDuringSchedulingIgnoredDuringExecution:
# Pod anti affinity is a group of inter pod anti affinity scheduling rules.
podAntiAffinity:
# The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by
# this field, but it may choose a node that violates one or more of the expressions. The node that is most
# preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling
# requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by
# iterating through the elements of this field and adding "weight" to the sum if the node has pods which
# matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.
preferredDuringSchedulingIgnoredDuringExecution:
# If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not
# be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at
# some point during pod execution (e.g. due to a pod label update), the system may or may not try to
# eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding
# to each podAffinityTerm are intersected, i.e. all terms must be satisfied.
requiredDuringSchedulingIgnoredDuringExecution:
# AutomountServiceAccountToken indicates whether a service account token should be automatically mounted.
automountServiceAccountToken:
# List of containers belonging to the pod. Containers cannot currently be added or removed. There must be at least
# one container in a Pod. Cannot be updated.
containers:
# PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy.
dnsConfig:
# A list of DNS name server IP addresses. This will be appended to the base nameservers generated from
# DNSPolicy. Duplicated nameservers will be removed.
nameservers:
# A list of DNS resolver options. This will be merged with the base options generated from DNSPolicy. Duplicated
# entries will be removed. Resolution options given in Options will override those that appear in the base
# DNSPolicy.
options:
# A list of DNS search domains for host-name lookup. This will be appended to the base search paths generated
# from DNSPolicy. Duplicated search paths will be removed.
searches:
# Set DNS policy for the pod. Defaults to "ClusterFirst". Valid values are 'ClusterFirstWithHostNet',
# 'ClusterFirst', 'Default' or 'None'. DNS parameters given in DNSConfig will be merged with the policy selected
# with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to
# 'ClusterFirstWithHostNet'.
dnsPolicy:
# EnableServiceLinks indicates whether information about services should be injected into pod's environment
# variables, matching the syntax of Docker links. Optional: Defaults to true.
enableServiceLinks:
# List of ephemeral containers run in this pod. Ephemeral containers may be run in an existing pod to perform
# user-initiated actions such as debugging. This list cannot be specified when creating a pod, and it cannot be
# modified by updating the pod spec. In order to add an ephemeral container to an existing pod, use the pod's
# ephemeralcontainers subresource. This field is alpha-level and is only honored by servers that enable the
# EphemeralContainers feature.
ephemeralContainers:
# HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified.
# This is only valid for non-hostNetwork pods.
hostAliases:
# Use the host's ipc namespace. Optional: Default to false.
hostIPC:
# Host networking requested for this pod. Use the host's network namespace. If this option is set, the ports that
# will be used must be specified. Default to false.
hostNetwork:
# Use the host's pid namespace. Optional: Default to false.
hostPID:
# Specifies the hostname of the Pod If not specified, the pod's hostname will be set to a system-defined value.
hostname:
# ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of
# the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations
# for them to use. For example, in the case of docker, only DockerConfig type secrets are honored. More info:
# https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod
imagePullSecrets:
# List of initialization containers belonging to the pod. Init containers are executed in order prior to
# containers being started. If any init container fails, the pod is considered to have failed and is handled
# according to its restartPolicy. The name for an init container or normal container must be unique among all
# containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup
# probes. The resourceRequirements of an init container are taken into account during scheduling by finding the
# highest request/limit for each resource type, and then using the max of of that value or the sum of the normal
# containers. Limits are applied to init containers in a similar fashion. Init containers cannot currently be
# added or removed. Cannot be updated. More info:
# https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
initContainers:
# NodeName is a request to schedule this pod onto a specific node. If it is non-empty, the scheduler simply
# schedules this pod onto that node, assuming that it fits resource requirements.
nodeName:
# NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's
# labels for the pod to be scheduled on that node. More info:
# https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
nodeSelector:
# Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field
# will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission
# controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller
# will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected
# in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will
# remain unset and treated as zero.
overhead:
# PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority.
# Defaults to PreemptLowerPriority if unset. This field is alpha-level and is only honored by servers that enable
# the NonPreemptingPriority feature.
preemptionPolicy:
# The priority value. Various system components use this field to find the priority of the pod. When Priority
# Admission Controller is enabled, it prevents users from setting this field. The admission controller populates
# this field from PriorityClassName. The higher the value, the higher the priority.
priority:
# If specified, indicates the pod's priority. "system-node-critical" and "system-cluster-critical" are two special
# keywords which indicate the highest priorities with the former being the highest priority. Any other name must
# be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be default
# or zero if there is no default.
priorityClassName:
# If specified, all readiness gates will be evaluated for pod readiness. A pod is ready when all its containers
# are ready AND all conditions specified in the readiness gates have status equal to "True"
readinessGates:
# Restart policy for all containers within the pod. One of Always, OnFailure, Never. Default to Always. More info:
# https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
restartPolicy:
# RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this pod.
# If no RuntimeClass resource matches the named class, the pod will not be run. If unset or empty, the "legacy"
# RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime
# handler.
runtimeClassName:
# If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by
# default scheduler.
schedulerName:
# PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also
# present in container.securityContext. Field values of container.securityContext take precedence over field
# values of PodSecurityContext.
securityContext:
# A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to
# change the ownership of that volume to be owned by the pod:
#
# 1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned
# by FSGroup) 3. The permission bits are OR'd with rw-rw----
#
# If unset, the Kubelet will not modify the ownership and permissions of any volume.
fsGroup:
# fsGroupChangePolicy defines behavior of changing ownership and permission of the volume before being exposed
# inside Pod. This field will only apply to volume types which support fsGroup based ownership(and permissions).
# It will have no effect on ephemeral volume types such as: secret, configmaps and emptydir. Valid values are
# "OnRootMismatch" and "Always". If not specified defaults to "Always".
fsGroupChangePolicy:
# The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in
# SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in
# SecurityContext takes precedence for that container.
runAsGroup:
# Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at
# runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or
# false, no such validation will be performed. May also be set in SecurityContext. If set in both
# SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.
runAsNonRoot:
# The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if
# unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the
# value specified in SecurityContext takes precedence for that container.
runAsUser:
# SELinuxOptions are the labels to be applied to the container
seLinuxOptions:
# Level is SELinux level label that applies to the container.
level:
# Role is a SELinux role label that applies to the container.
role:
# Type is a SELinux type label that applies to the container.
type:
# User is a SELinux user label that applies to the container.
user:
# A list of groups applied to the first process run in each container, in addition to the container's primary
# GID. If unspecified, no groups will be added to any container.
supplementalGroups:
# Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported sysctls (by the container
# runtime) might fail to launch.
sysctls:
# WindowsSecurityContextOptions contain Windows-specific options and credentials.
windowsOptions:
# GMSACredentialSpec is where the GMSA admission webhook (https://github.com/kubernetes-sigs/windows-gmsa)
# inlines the contents of the GMSA credential spec named by the GMSACredentialSpecName field.
gmsaCredentialSpec:
# GMSACredentialSpecName is the name of the GMSA credential spec to use.
gmsaCredentialSpecName:
# The UserName in Windows to run the entrypoint of the container process. Defaults to the user specified in
# image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and
# PodSecurityContext, the value specified in SecurityContext takes precedence.
runAsUserName:
# DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. Deprecated: Use serviceAccountName
# instead.
serviceAccount:
# ServiceAccountName is the name of the ServiceAccount to use to run this pod. More info:
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
serviceAccountName:
# Share a single process namespace between all of the containers in a pod. When this is set containers will be
# able to view and signal processes from other containers in the same pod, and the first process in each container
# will not be assigned PID 1. HostPID and ShareProcessNamespace cannot both be set. Optional: Default to false.
shareProcessNamespace:
# If specified, the fully qualified Pod hostname will be "<hostname>.<subdomain>.<pod namespace>.svc.<cluster
# domain>". If not specified, the pod will not have a domainname at all.
subdomain:
# Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value
# must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default
# grace period will be used instead. The grace period is the duration in seconds after the processes running in
# the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal.
# Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.
terminationGracePeriodSeconds:
# If specified, the pod's tolerations.
tolerations:
# TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will
# schedule pods in a way which abides by the constraints. This field is only honored by clusters that enable the
# EvenPodsSpread feature. All topologySpreadConstraints are ANDed.
topologySpreadConstraints:
# List of volumes that can be mounted by containers belonging to the pod. More info:
# https://kubernetes.io/docs/concepts/storage/volumes
volumes:
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 |
List of Kubernetes resource manifests to be searched (using
resource
e for the pod spec for the Run. If files
is also specified, this is combined with the manifests read from the files.Type | Default | Required |
---|---|---|
array[object] | [] | No |
The API version of the resource.
Type | Required |
---|---|
string | Yes |
The kind of the resource.
Type | Required |
---|---|
string | Yes |
Type | Required |
---|---|
object | Yes |
The name of the resource.
Type | Required |
---|---|
string | Yes |
POSIX-style paths to YAML files to load manifests from. Each can contain multiple manifests, and can include any Garden template strings, which will be resolved before searching the manifests for the resource that contains the Pod spec for the Run.
Type | Default | Required |
---|