Service
Bases: DuploTenantResourceV2
Duplocloud Service Resource
This resource is used to manage services in Duplocloud. Using the duploctl
command line tool, you can manage services with actions:
apply
Apply a service.
bulk_update_image
Bulk update the image of multiple services.
Basic CLI Use
Parameters:
Name | Type | Description | Default |
---|---|---|---|
serviceimage
|
SERVICEIMAGE
|
Takes n sets of two arguments, service name and image name. e.g., -S service1 image1:tag -S service2 image2:tag |
required |
wait
|
WAIT
|
Boolean flag to wait for service updates. |
False
|
create
current_replicaset
Get the current replicaset for a service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the service to get replicaset for. |
required |
Returns: The current replicaset for the service. Raises: DuploError: If the service could not be found.
delete
Delete a service.
Delete a service in Duplocloud.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the service to delete. |
required |
Returns:
Name | Type | Description |
---|---|---|
message |
dict
|
Success message. |
find
Find a Service by name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the Service to find. |
required |
Returns:
Name | Type | Description |
---|---|---|
resource |
dict
|
The Service object. |
Raises:
Type | Description |
---|---|
DuploError
|
If the {{kind}} could not be found. |
image_from_body
Get the image from a service body.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
body
|
dict
|
The body of the service. |
required |
Returns: The image for the service.
list
logs
pods
Get the pods for a service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the service to get pods for. |
required |
Returns: message: A list of pods for the service. Raises: DuploError: If the service could not be found.
restart
Restart a service.
Restart a service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the service to restart. |
required |
Returns:
Type | Description |
---|---|
dict
|
A success message if the service was restarted successfully. |
Raises:
Type | Description |
---|---|
DuploError
|
If the service could not be restarted. |
start
Start a service.
Start a service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the service to start. |
required |
Returns:
Type | Description |
---|---|
dict
|
A success message if the service was started successfully. |
Raises:
Type | Description |
---|---|
DuploError
|
If the service could not be started. |
stop
Stop a service.
Stop a service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the service to stop. |
required |
Returns:
Type | Description |
---|---|
dict
|
A success message if the service was stopped successfully. |
Raises:
Type | Description |
---|---|
DuploError
|
If the service could not be stopped. |
update
Update a service.
Update the state of a service.
Basic CLI Use
Update the replicas to 3 for a service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the service to update. |
required |
body
|
BODY
|
The body of the service to update. |
None
|
patches
|
PATCHES
|
A list of JSON patches as args to apply to the service.
The options are |
None
|
wait
|
WAIT
|
Whether to wait for the service to update. |
False
|
update_env
Update the environment variables of a service. If service has no environment variables set, use -strat replace to set new values. Usage: Basic CLI Use
duploctl service update_env <service-name> --setvar env-key1 env-val1 --setvar env-key2 env-val2 --setvar env-key3 env-val3 -strat merge --host $DUPLO_HOST --tenant $DUPLO_TENANT --token $DUPLO_TOKEN
setvar/-V (list): A list of key value pairs to set as environment variables.
strategy/strat (str): The merge strategy to use for env vars. Valid options are "merge" or "replace". Default is merge.
deletevar/-D (list): A list of keys to delete from the environment variables.
update_image
update_pod_label
Update the pod labels of a service. If service has no pod labels set, use -strat replace to set new values. Usage: Basic CLI Use
duploctl service update_pod_label <service-name> --setvar env-key1 env-val1 --setvar env-key2 env-val2 --setvar env-key3 env-val3 -strat merge --host $DUPLO_HOST --tenant $DUPLO_TENANT --token $DUPLO_TOKEN
duploctl service update_pod_label <service-name> --setvar env-key1 env-val1 --setvar env-key2 env-val2 -strat replace --host $DUPLO_HOST --tenant $DUPLO_TENANT --token $DUPLO_TOKEN
duploctl service update_pod_label <service-name> --deletevar env-key1 --host $DUPLO_HOST --tenant $DUPLO_TENANT --token $DUPLO_TOKEN
update_replicas
wait
Wait for a service to update.