Can I add use templating to modify a kubernetes de...
# 🤖|ask-kapa
s
@microscopic-river-74022 Can I add use templating to modify a kubernetes deployment name
m
Please stand by @swift-island-27000 as I search the knowledge base. I normally take about 15 seconds or so. :wave:
---------------------- Yes, you can use Garden's templating functionality to modify a Kubernetes deployment name. This can be done by using Garden template strings in your Kubernetes manifests. Here's an example:
Copy code
yaml
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:
Copy code
yaml
apiVersion: garden.io/v1
kind: Project
variables:
  - replicas:
      dev: 1
      prod: 3
And here that variable is used in a Deploy:
Copy code
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: ----------------------
message has been deleted
s
what about to change the name of a helm deploy action