swift-island-27000
10/15/2024, 3:41 PMmicroscopic-river-74022
10/15/2024, 3:41 PMmicroscopic-river-74022
10/15/2024, 3:41 PMyaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: ${var.appName}
labels:
app: ${var.appName}
spec:
replicas: ${var.replicas}
In the example above, ${var.appName}
is a template string that will be replaced with the value of the appName
variable when the manifest is applied. You can define these variables in your Garden configuration files.
For more complex use-cases, you can also use nested lookups and maps. For example, you can declare a mapping variable for your project, and look up values by another variable such as the current environment name:
yaml
apiVersion: garden.io/v1
kind: Project
variables:
- replicas:
dev: 1
prod: 3
And here that variable is used in a Deploy:
yaml
kind: Deploy
type: container
spec:
replicas: ${var.replicas["${environment.name}"]}
For more information, you can refer to the Garden documentation on variables and templating () and the Garden documentation on Kubernetes Deploy actions ().
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
10/15/2024, 3:41 PMswift-island-27000
10/15/2024, 4:19 PM