Creating a Virtual Service Route Table
Create a virtual service route table for the virtual service in Service Mesh.
You must have at least one virtual deployment to create a virtual service route table.
Before you proceed, you must set up the appropriate OCI policies for the virtual service route table resource. For details, see Required IAM Policy for Virtual Service Route Table.
To see what operations are available for
virtual-service-route-table create
use:oci service-mesh virtual-service-route-table create -h
To create a virtual service route table use the
oci service-mesh virtual-service-route-table create
option:oci service-mesh virtual-service-route-table create --name "<name>" --compartment-id <compartmentId> --virtual-service-id <virtualServiceId> --route-rules <rules> --description <description> --priority <priority>
where:
<name>
(immutable): The name of the virtual service route table. The name must be unique within the same virtual service and can't be changed after creation. The name must start with a letter or underscore, followed by letters, numbers, hyphens, or underscores. Length can be 1–255 characters. Avoid entering confidential information.<compartmentId>
(optional): The OCID of the compartment to which the virtual service route table belongs.<virtualServiceId>
: The OCID of the virtual service in which this virtual service route table is created.<rules>
<type>
: Choose between theHTTP
,TCP
, andTLS_PASSTHROUGH
protocols. IfTLS_PASSTHROUGH
is selected, the proxy doesn't manage TLS. The proxy passes encrypted data "as is" to the application that manages TLS on its own.HTTP
option:<path>
: A path to this route, for example,/mypath
. Specify no path value to default to root ("/"). When you specify a path without a root value, the rule prepends the root ("/") to the path.<pathType>
: The type of path provided. The defaultPREFIX
option treats the path as a prefix to an endpoint and is the only supported option. IfpathType
is not specified, the default is used.<isGrpc>
: If set to true, the rule checks that thecontent-type
header containsapplication/grpc
or one of the variousapplication/grpc+
values.
<destinations>
: Defines the virtual deployment destinations for this route. A minimum of one destination is required.<virtualDeploymentId>
The OCID of the virtual deployment where the request is routed.<weight>
: The weight for this destination. If only one destination is created, the value defaults to and must be 100. When multiple destinations are created, you can specify a value from 1-100 for each destination. When summed, the weights for all the destinations must total 100.<port>
:Select a port in the range of 1-65535. The rule allows only one port. If you don't specify a port, the rule targets all the ports on the virtual deployment.Caution
Don't use the following Service Mesh reserved ports in your mesh resource: 15000, 15003, 15006, and 9901.
<description>
(optional): The description of the virtual service route table. The field is changeable. Avoid entering confidential information.<priority>
(optional): Sets the route table priority from 1 to 1000. The default is 500. Lower numbers are a higher priority. At the same priority, route tables are prioritized based on the time created with the most recent route table taking the highest priority.
For example:
oci service-mesh virtual-service-route-table create --compartment-id ocid1.compartment.oc1..aaa... --virtual-service-id ocid1.meshvirtualservice.oc1..aaa... --name "virtual-service-route-table" --route-rules '[{"destinations":[{"port":443,"type":"VIRTUAL_DEPLOYMENT","virtualDeploymentId":"ocid1.meshvirtualdeployment.oc1..aaa...","weight":100}],"isGrpc":true,"path":"/service-path","pathType":"PREFIX","type":"HTTP"}]' --description "my virtual-service-route-table" --priority 10
The response to the command includes:
- The virtual service route table's OCID
- The life cycle state (for example, ACTIVE, FAILED).
- The ID of the work request to create the virtual service route table (details of work requests are available for seven days after completion, cancellation, or failure).
If you want the command to wait to return control until the virtual service is active or the request has failed, include either or both of the following parameters:
--wait-for-state SUCCEEDED
--wait-for-state FAILED
For example:
oci service-mesh virtual-service-route-table create --compartment-id ocid1.compartment.oc1..aaa... --virtual-service-id ocid1.meshvirtualservice.oc1..aaa... --name "virtual-service-route-table" --route-rules '[{"destinations":[{"port":443,"type":"VIRTUAL_DEPLOYMENT","virtualDeploymentId":"ocid1.meshvirtualdeployment.oc1..aaa...","weight":100}],"isGrpc":true,"path":"/service-path","pathType":"PREFIX","type":"HTTP"}]' --description "my virtual-service-route-table" --priority 10 --wait-for-state SUCCEEDED
Tip
You can't use the virtual service until the work request has successfully created it and the virtual service is active.Checking Virtual Service Status
To see the status of the virtual service route table, enter:
oci service-mesh virtual-service-route-table get --virtual-service-route-table-id <virtual-service-route-table-ocid>
To view the status of the work request creating the virtual service, refer to Service Mesh Work Requests.
Creating a Virtual Service Route Table using JSON File
Alternatively, create a virtual service route table by supplying a JSON file to the create command.
-
Generate a sample JSON file for a virtual service route table:
oci service-mesh virtual-service-route-table create --generate-full-command-json-input
- Create a JSON file with the sample-generated output from preceding step and update the fields with appropriate values.
-
Supply the JSON file to the
virtual-service-route-table create
command:oci service-mesh virtual-service create --from-json file:///<filename>
For more information about using the CLI, see:
Use the CreateVirtualServiceRouteTable operation to create a virtual service route table.