Add or Remove a component in an already deployed service
What is it?
If you have already deployed a service in an environment and want to add or remove a component without undeploying the entire service, then odin operate service
can help you to do that.
Command Format
There are two ways to perform either of the operation:
By passing a json as a file: You can pass the json file by using the option
--file
along with the command as shown below:
odin operate service --operation <operationName> --name <serviceName> --env <envName> --file <fileName>
//operationName can be add_component or remove_component
By passing the json inline: You can pass the content of the json inline by using the option
--options
along with the command as shown below:
odin operate service --operation <operationName> --name <serviceName> --env <envName> --options <JsonInline>
//operationName can be add_component or remove_component
To see the list of all available operations, you can use the following command:
odin list operation service
Example: How to add a component?
If you have a new application component called odindemo
that you want to add to your existing service Service-A
in environment env-1001, you need the service definition & provisioning definition in one single file in json format EXACTLY as shown below:
//Sample json for adding component
{
"component_definition": [
{
"type": "application",
"name": "odindemo",
"version": "1.0.0",
"config": {
"build_type": "java",
"build_version": "11",
"artifact_name": "odindemo",
"artifact_version": "1.0.0"
}
}
],
"provisioning_config": [
{
"component_name": "odindemo",
"deployment_type": "aws_ec2",
"params": {
"num_instances": 2
}
}
]
}
Once the above details are ready, you can add the component in any of the two ways as mentioned earlier. The following example shows the addition of a component by passing a json file:
// add component by passing a file
odin operate service --operation add_component --name Service-A --env env-1001 --file file.json
With the help of the above command, odin will go ahead and add the component odindemo to the Service-A within environment env-1001.
Example : How to remove a component?
Removing a component called odindemo
from a service Service-A
within an environment env-1001
is very simple. You can pass the component name as an inline input as shown below. The following example shows the removal of the component by passing the json inline:
odin operate service --operation remove_component --name Service-A --env env-1001 --options {\"component_name\":\"odindemo\"}
This operation can also be performed by passing a file instead using --options
as mentioned in the Command Format section.
Last updated