https://garden.io logo
#🤖|ask-kapa
Hello how can I deploy a Helm chart with a Deploy action, using the image output from a B
b

bright-policeman-43626

06/23/2023, 3:53 AM
Hello @microscopic-river-74022 how can I deploy a Helm chart with a Deploy action, using the image output from a Build action in Garden Bonsai 0.13?
m

microscopic-river-74022

06/23/2023, 3:53 AM
Please stand by @bright-policeman-43626 as I search the knowledge base. We are experiencing especially high traffic right now and might take longer than usual. :wave:
---------------------- To deploy a Helm chart with a Deploy action using the image output from a Build action in Garden Bonsai 0.13, you can follow these steps: 1. Create a
container
Build action that builds the image for your service.
Copy code
yaml
kind: Build
type: container
name: worker-image
2. Create a
helm
Deploy action that depends on the Build action and injects the image output from the Build action into the Helm chart via the
spec.values
field.
Copy code
yaml
kind: Deploy
description: Helm deploy for the worker container
type: helm
name: worker-deploy
dependencies: [build.worker-image]
spec:
  values:
    image:
      repository: ${actions.build.worker-image.outputs.deployment-image-name}
      tag: ${actions.build.worker-image.version}
Make sure to consult the reference for the chart in question and adjust the
spec.values
field according to the shape of the chart's
values.yaml
file. For more information, refer to the Linking container builds and Helm deploy actions () section in the Garden documentation. ----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon: ----------------------
message has been deleted
b

bright-policeman-43626

06/23/2023, 3:55 AM
Hey @microscopic-river-74022 how can I set my custom values files with the Helm deploy action?
m

microscopic-river-74022

06/23/2023, 3:55 AM
Let me check the knowledge base for you. One moment! :books:
---------------------- To set custom values files with the Helm deploy action, you can use the
spec.valueFiles
field in your action configuration. Specify the paths to your custom value files relative to the config root, and make sure the files are contained in the action config's directory. The custom value files will take precedence over the
values.yaml
file bundled in the Helm chart. Here's an example of how to set custom values files in a Helm deploy action:
Copy code
yaml
kind: Deploy
type: helm
name: helm-deploy
spec:
  valueFiles:
    - custom-values-1.yaml
    - custom-values-2.yaml
In this example,
custom-values-1.yaml
and
custom-values-2.yaml
are custom value files. The last file in the list (
custom-values-2.yaml
) will have the highest precedence. For more information, refer to the spec.valueFiles () section in the Garden documentation. ----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon: ----------------------
message has been deleted
b

bright-policeman-43626

06/23/2023, 4:37 AM
@microscopic-river-74022 how to specify which helm chart to use if it's in a path based
m

microscopic-river-74022

06/23/2023, 4:37 AM
Let me check the knowledge base for you. One moment! :books:
---------------------- To specify a Helm chart located in a path within your project, you can use the
spec.chart.path
field in your Helm deploy action configuration. Set the
chart.path
to the directory path relative to the action directory, where the
Chart.yaml
file is located. Here's an example of how to specify a Helm chart using a path:
Copy code
yaml
kind: Deploy
type: helm
name: helm-deploy
spec:
  chart:
    path: ./path/to/chart/
In this example,
./path/to/chart/
is the relative path to the directory containing the
Chart.yaml
file. For more information, refer to the spec.chart () section in the Garden documentation. ----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon: ----------------------
message has been deleted
b

bright-policeman-43626

06/23/2023, 5:27 AM
@microscopic-river-74022 give me a configuration for the Helm Deploy action to use with a sync block for a nodejs API
m

microscopic-river-74022

06/23/2023, 5:27 AM
Let me check the knowledge base for you. One moment! :books:
---------------------- To configure a Helm Deploy action with a sync block for a Node.js API, you can follow this example:
Copy code
yaml
kind: Deploy
type: helm
name: nodejs-api
spec:
  chart:
    path: ./path/to/chart/
  values:
    image:
      repository: ${{actions.build.nodejs-api-image.outputs.deployment-image-name}}
      tag: ${{actions.build.nodejs-api-image.version}}
  sync:
    paths:
      - containerPath: /app/src
        sourcePath: ${actions.build.nodejs-api-image.sourcePath}/src
    mode: two-way
In this example, replace
./path/to/chart/
with the relative path to the directory containing the
Chart.yaml
file for your Node.js API Helm chart. The
sync
block is configured to sync the
src
directory from the build action's source path to the
/app/src
directory inside the running container. Make sure you have a Build action for your Node.js API image, like this:
Copy code
yaml
kind: Build
type: container
name: nodejs-api-image
For more information on synchronization, refer to the Code Synchronization Guide () in the Garden documentation. ----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon: ----------------------
message has been deleted
b

bright-policeman-43626

06/23/2023, 5:33 AM
@microscopic-river-74022 convert this Deploy container action to Helm ->
Copy code
kind: Deploy
type: container
build: api-build
name: api
description: Golang API deployment
spec:
  sync:
    paths:
      - target: /app
        mode: "one-way-replica"
  ports:
    - name: http
      protocol: TCP
      containerPort: 80
      servicePort: 80
  ingresses:
    - path: /
      port: http
      hostname: api.${variables.base-hostname}
  healthCheck:
    httpGet:
      path: /
      port: http
m

microscopic-river-74022

06/23/2023, 5:33 AM
Let me check the knowledge base for you. One moment! :books:
---------------------- To convert the given Deploy container action to a Helm deploy action, you'll need to create a Helm chart for your Golang API and update the configuration accordingly. Here's an example of how to do this: 1. Create a Helm chart for your Golang API, with the necessary templates and
values.yaml
file. Make sure to include the appropriate configuration for syncing, ports, ingresses, and health checks in the chart. 2. Update the Deploy action configuration to use the Helm chart:
Copy code
yaml
kind: Deploy
type: helm
name: api
description: Golang API deployment
dependencies: [build.api-build]
spec:
  chart:
    path: ./path/to/chart/
  values:
    image:
      repository: ${{actions.build.api-build.outputs.deployment-image-name}}
      tag: ${{actions.build.api-build.version}}
In this example, replace
./path/to/chart/
with the relative path to the directory containing the
Chart.yaml
file for your Golang API Helm chart. Please note that the sync configuration, ports, ingresses, and health checks should be defined within the Helm chart itself, as they are not directly specified in the Helm deploy action configuration. For more information on creating Helm charts and using the Helm deploy action, refer to the Helm action type documentation (). ----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon: ----------------------
message has been deleted
b

bright-policeman-43626

06/23/2023, 5:35 AM
@microscopic-river-74022 convert this sync from the container Deploy action to something valid in the Helm Deploy action
Copy code
kind: Deploy
type: container
build: api-build
name: api
description: Golang API deployment
spec:
  sync:
    paths:
      - target: /app
        mode: "one-way-replica"
m

microscopic-river-74022

06/23/2023, 5:35 AM
Let me check the knowledge base for you. One moment! :books:
@bright-policeman-43626 That's a great question, but unfortunately I am only capable of responding to a maximum of three questions per thread. Don't hesitate to create a new thread for any further questions you have though. I'm here to help!