bright-policeman-43626
05/21/2024, 1:10 AMkind: Module
description: Redis container
type: container
name: redis
image: redis:5-alpine@sha256:1a3c609295332f1ce603948142a132656c92a08149d7096e203058533c415b8c
include: [./modules.garden.yml]
services:
- name: redis
ports:
- name: redis
containerPort: 6379
healthCheck:
command: [redis-cli, ping]
tasks:
- name: redis-clear
command: [redis-cli, flushall]
dependencies: [redis]
microscopic-river-74022
05/21/2024, 1:10 AMmicroscopic-river-74022
05/21/2024, 1:11 AMyaml
kind: Action
name: redis
description: Redis container
steps:
- name: build
type: build
image: redis:5-alpine@sha256:1a3c609295332f1ce603948142a132656c92a08149d7096e203058533c415b8c
include: [./modules.garden.yml]
- name: deploy
type: deploy
services:
- name: redis
ports:
- name: redis
containerPort: 6379
healthCheck:
command: [redis-cli, ping]
- name: redis-clear
type: run
command: [redis-cli, flushall]
dependencies: [deploy.redis]
In this new configuration:
- The kind
field is changed from Module
to Action
.
- The type
field is removed.
- The build
step is added to build the image.
- The deploy
step is added to deploy the service.
- The run
step is added to run the task.
Please note that this is a simplified example and might not cover all the complexities of your project. For a more detailed guide on how to convert modules to actions, you can refer to the Garden documentation ().
Also, please be aware that modules are deprecated and will be removed in version 0.14
. It's recommended to use action-based configuration instead (source ()).microscopic-river-74022
05/21/2024, 1:11 AMmicroscopic-river-74022
05/21/2024, 1:11 AMbright-policeman-43626
05/21/2024, 1:16 AM# Now we have a more explicit Build action
kind: Build
type: container
name: api
description: The backend container for the voting UI
---
# The Deploy action has some top-level settings
kind: Deploy
type: container
name: api
description: The backend deployment for the voting UI
# Uses the container created by the Build action above
build: api
# Dependencies has been moved from the services to here,
# and they can now be much more granular:
# refer to specific Build, Deploy, Run, and Test actions
dependencies: [deploy.redis]
# But most of the previous service can be pasted under spec
spec:
args: [python, app.py]
ports:
- name: http
protocol: TCP
containerPort: 80
healthCheck:
httpGet:
path: /api
port: http
ingresses:
- path: /
hostname: "api.${var.baseHostname}"
port: http
---
kind: Test
type: container
name: api-unit
build: api
spec:
args: [echo, ok]
---
kind: Test
type: container
name: api-integ
build: api
dependencies: [deploy.api]
timeout: 200
spec:
args: [python, /app/test.py]
microscopic-river-74022
05/21/2024, 1:16 AMmicroscopic-river-74022
05/21/2024, 1:16 AMyaml
# Build action for Redis
kind: Build
type: container
name: redis
description: Redis container
image: redis:5-alpine@sha256:1a3c609295332f1ce603948142a132656c92a08149d7096e203058533c415b8c
include: [./modules.garden.yml]
---
# Deploy action for Redis
kind: Deploy
type: container
name: redis
description: Redis deployment
build: redis
spec:
ports:
- name: redis
containerPort: 6379
healthCheck:
command: [redis-cli, ping]
---
# Run action for Redis clear task
kind: Run
type: container
name: redis-clear
description: Redis clear task
build: redis
dependencies: [deploy.redis]
command: [redis-cli, flushall]
In this new configuration:
- Each action (Build, Deploy, Run) is defined separately.
- The kind
field specifies the type of action.
- The type
field specifies the type of module (in this case, container
).
- The build
field in the Deploy and Run actions refers to the Build action.
- The dependencies
field in the Run action refers to the Deploy action.
This configuration provides more granularity and flexibility, which should make it easier to configure complex projects and reduce the number of unnecessary rebuilds (source ()).
Remember, modules are deprecated and will be removed in version 0.14
. It's recommended to use action-based configuration instead (source ()).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
05/21/2024, 1:16 AMbright-policeman-43626
05/21/2024, 1:19 AM