order | title |
---|---|
1 |
FAQ |
You will have to use the top-level include
directive to specify which files belong to each Build. You will also have to provide the path to the Dockerfile with the spec.dockerfile
directive.
See the configuration overview documentation for more.
Yes.
You can use the disabled
field to disable actions. See this section of the actions documentation.
When should I use the action-level include
/exclude
fields? How are they different from the project-level scan.include
/scan.exclude
fields? What about ignore files?
Read all about it in this section of our docs.
We recommend using the Terraform or Pulumi actions for cloud services that are shared by your team.
You can also deploy kubernetes
and helm
actions to their own namespaces.
You can use the copyFrom
directive for that. See this example project.
Alternatively you can hoist your garden.yml
file so that it is at the same level or parent to all relevant build context and use the include
field.
See this GitHub issue for more discussion on the two approaches.
What do all those v-<something>
versions mean, and why are they different between building and deploying?
These are the Garden versions that are computed for each action in the Stack Graph at runtime, based on source files and configuration for each action. See here for more information about how these work and how they're used.
You may notice that a version of a Build action is different from the version the Deploy for that Build. This is because the Deploy's version also factors in the runtime configuration for that deploy, which often differs between environments, but we don't want those changes to require a rebuild.
Use the spec.targetStage
field.
See this example project.
Yes, but only since Garden 0.13.
Set the log-level to verbose
or higher. For example:
garden build --log-level verbose
Dockerfiles need to be at the same level as the garden.yml
file for the respective action, or in a child directory.
You can always hoist the garden.yml
file to the same level as the Dockerfile and use the include
directive to tell Garden what other files belong to the Build. For example, if you have the following directory structure:
.
├── api
├── dockerfiles
│ ├── api.Dockerfile
│ └── frontend.Dockerfile
└── frontend
You can set your garden.yml
file at the root and define your actions likes so:
kind: Build
name: api
type: container
include: [api/**/*]
spec:
dockerfile: dockerfiles/api.Dockerfile
---
kind: Build
name: frontend
include: [frontend/**/*]
type: container
spec:
dockerfile: dockerfiles/frontend.Dockerfile
Note that you can put multiple Garden configuration files in the same directory, e.g. project.garden.yml
, api.garden.yml
and frontend.garden.yml
.
If you need the Dockerfile outside of the Build root because you want to share it with other Build actions, you should consider having a single base image instead and then let each action have its own Dockerfile that's built on the base image. See the base image example project for an example of this.
How do I include files/dirs (e.g. shared libraries) from outside the action root with the build context?
See this example project.
Use the spec.extraFlags
field.
You can use the spec.dockerfile
field. For example:
spec:
dockerfile: "${environment.name == 'prod' ? Dockerfile.prod : Dockerfile.dev}"
See also the base image example project for an example of this.
Please do not delete the garden-system
namespace directly, because Kubernetes may fail to remove persistent volumes. Instead, use this command:
garden plugins kubernetes uninstall-garden-services --env <env-name>
It removes all cluster-wide Garden services.
How do I pull a base image (using the FROM directive) from a private registry in in-cluster build mode?
See this section of our docs.
See this section of our docs.
We've been pondering this, but there are a lot of variants to consider. The key issue is really that the notion of "first time" is kind of undefined as things stand.
So what we generally do is to make sure Runs are idempotent and exit early if they shouldn't run again. But that means the process still needs to be started, which is of course slower than not doing it at all.
It is, which is why we recommend that Runs are written to be idempotent. Runs by nature don’t really have a status check, unlike Deploys.
The Run result is likely cached. Garden won't run Runs with cached results unless spec.cacheResult: false
is set on the Run definition.
You can also run it manually with:
garden run <run-name>
This will run the Run even if the result is cached.
Garden stores the Run results as a ConfigMap in your namespace. You can delete them manually with this command:
kubectl delete -n <your-namespace> $(kubectl get configmap -n <your-namespace> -o name | grep run-result)
You can also run it manually with:
garden run <run-name>
This will run the Run even if the result is cached.
See this section of our docs.
You'll need to use the kubernetes
or helm
action types for that. Here's the official Kubernetes guide for mounting secrets as files.
No, Kubernetes secrets can only be used at runtime, by referencing them in the spec.env
field of Run, Deploy and Test Actions.
See the secrets section of our docs for more.
Also note that secrets as buildArgs
are considered a bad practice and a security risk.
No, secrets have to be in the same namespace as the project. This is how Kubernetes secrets are designed, see here for reference.
See this section of our docs.
How do I access files that are generated at runtime (e.g. migration files that are checked into version control)?
You can generate the files via a Run, store them as artifacts, and copy them from the local artifacts directory. Here's an example of this.
You can also use the persistentvolumeclaim
action type to store data and share it across actions. See this section of our docs for more.
You can set annotations on ingresses under the spec.ingresses[]
field.
Garden interfaces with your cluster via kubectl
and by using the Kubernetes APIs directly and should therefore work with all Kubernetes clusters that implement these. Garden is committed to supporting the latest six stable versions of Kubernetes.
No, you have to use the kubernetes
action type for that.
We're exploring how we can release it incrementally. Please let us know if this is something you're interested in.
The *.local.demo.garden
domain resolves to 127.0.0.1 via our DNS provider for convenience. If you want to use a different hostname for local development, you’ll have to add the corresponding entry to your hosts file.
Yes! two-way
sync mode can be configured with Garden sync mode. See this guide
Garden is currently in use by many teams. We don’t have a set date or plan to label it as 1.0, but we don't expect to do it anytime soon.
We have a team of people working on it full-time, and we make it a priority to address all non-trivial bugs. We’re also happy to help out and answer questions via our Discord community.
Garden is not currently designed to work in air-gapped environments but if you have done the initial setup and use a local kubernetes provider it might work.