# NetworkServicesTCPRoute

# NetworkServicesTCPRoute

| **Property** | **Value** |
|---|---|
| Google Cloud Service Name | Network Services |
| Google Cloud Service Documentation | [/traffic-director/docs/](https://docs.cloud.google.com/traffic-director/docs) |
| Google Cloud REST Resource Name | v1/projects.locations.tcpRoutes |
| Google Cloud REST Resource Documentation | <https://docs.cloud.google.com/traffic-director/docs/reference/network-services/rest/v1/projects.locations.tcpRoutes> |
| Config Connector Resource Short Names | gcpnetworkservicestcproute gcpnetworkservicestcproutes networkservicestcproute |
| Config Connector Service Name | networkservices.googleapis.com |
| Config Connector Resource Fully Qualified Name | networkservicestcproutes.networkservices.cnrm.cloud.google.com |
| Can Be Referenced by IAMPolicy/IAMPolicyMember | No |
| Config Connector Default Average Reconcile Interval In Seconds | 600 |

## Custom Resource Definition Properties

### Spec

#### Schema

    description: string
    gateways:
    - external: string
      name: string
      namespace: string
    location: string
    meshes:
    - external: string
      name: string
      namespace: string
    projectRef:
      external: string
      name: string
      namespace: string
    resourceID: string
    rules:
    - action:
        destinations:
        - serviceRef:
            external: string
            name: string
            namespace: string
          weight: integer
        originalDestination: boolean
      matches:
      - address: string
        port: string

| Fields ||
|---|---|
| `description` *Optional* | `string` Optional. A free-text description of the resource. Max length 1024 characters. |
| `gateways` *Optional* | `list (object)` <br /> |
| `gateways[]` *Optional* | `object` <br /> |
| `gateways[].external` *Optional* | `string` Allowed value: The \`selfLink\` field of a \`NetworkServicesGateway\` resource. |
| `gateways[].name` *Optional* | `string` Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names |
| `gateways[].namespace` *Optional* | `string` Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ |
| `location` *Required* | `string` Immutable. The location for the resource |
| `meshes` *Optional* | `list (object)` <br /> |
| `meshes[]` *Optional* | `object` <br /> |
| `meshes[].external` *Optional* | `string` Allowed value: The \`selfLink\` field of a \`NetworkServicesMesh\` resource. |
| `meshes[].name` *Optional* | `string` Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names |
| `meshes[].namespace` *Optional* | `string` Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ |
| `projectRef` *Required* | `object` Immutable. The Project that this resource belongs to. |
| `projectRef.external` *Optional* | `string` The project for the resource Allowed value: The Google Cloud resource name of a \`Project\` resource (format: \`projects/{{name}}\`). |
| `projectRef.name` *Optional* | `string` Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names |
| `projectRef.namespace` *Optional* | `string` Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ |
| `resourceID` *Optional* | `string` Immutable. Optional. The name of the resource. Used for creation and acquisition. When unset, the value of \`metadata.name\` is used as the default. |
| `rules` *Required* | `list (object)` Required. Rules that define how traffic is routed and handled. At least one RouteRule must be supplied. If there are multiple rules then the action taken will be the first rule to match. |
| `rules[]` *Required* | `object` <br /> |
| `rules[].action` *Required* | `object` Required. The detailed rule defining how to route matched traffic. |
| `rules[].action.destinations` *Optional* | `list (object)` Optional. The destination services to which traffic should be forwarded. At least one destination service is required. |
| `rules[].action.destinations[]` *Optional* | `object` <br /> |
| `rules[].action.destinations[].serviceRef` *Required\** | `object` <br /> |
| `rules[].action.destinations[].serviceRef.external` *Optional* | `string` Required. The URL of a BackendService to route traffic to. Allowed value: The Google Cloud resource name of a \`ComputeBackendService\` resource (format: \`projects/{{project}}/global/backendServices/{{name}}\`). |
| `rules[].action.destinations[].serviceRef.name` *Optional* | `string` Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names |
| `rules[].action.destinations[].serviceRef.namespace` *Optional* | `string` Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ |
| `rules[].action.destinations[].weight` *Optional* | `integer` Optional. Specifies the proportion of requests forwarded to the backend referenced by the serviceName field. This is computed as: weight/Sum(weights in this destination list). For non-zero values, there may be some epsilon from the exact proportion defined here depending on the precision an implementation supports. If only one serviceName is specified and it has a weight greater than 0, 100% of the traffic is forwarded to that backend. If weights are specified for any one service name, they need to be specified for all of them. If weights are unspecified for all services, then, traffic is distributed in equal proportions to all of them. |
| `rules[].action.originalDestination` *Optional* | `boolean` Optional. If true, Router will use the destination IP and port of the original connection as the destination of the request. Default is false. |
| `rules[].matches` *Optional* | `list (object)` Optional. RouteMatch defines the predicate used to match requests to a given action. Multiple match types are "OR"ed for evaluation. If no routeMatch field is specified, this rule will unconditionally match traffic. |
| `rules[].matches[]` *Optional* | `object` <br /> |
| `rules[].matches[].address` *Required\** | `string` Required. Must be specified in the CIDR range format. A CIDR range consists of an IP Address and a prefix length to construct the subnet mask. By default, the prefix length is 32 (i.e. matches a single IP address). Only IPV4 addresses are supported. Examples: "10.0.0.1" - matches against this exact IP address. "10.0.0.0/8" - matches against any IP address within the 10.0.0.0 subnet and 255.255.255.0 mask. "0.0.0.0/0" - matches against any IP address'. |
| `rules[].matches[].port` *Required\** | `string` Required. Specifies the destination port to match against. |

\* Field is required when parent field is specified

### Status

#### Schema

    conditions:
    - lastTransitionTime: string
      message: string
      reason: string
      status: string
      type: string
    createTime: string
    observedGeneration: integer
    selfLink: string
    updateTime: string

| Fields ||
|---|---|
| `conditions` | `list (object)` Conditions represent the latest available observation of the resource's current state. |
| `conditions[]` | `object` <br /> |
| `conditions[].lastTransitionTime` | `string` Last time the condition transitioned from one status to another. |
| `conditions[].message` | `string` Human-readable message indicating details about last transition. |
| `conditions[].reason` | `string` Unique, one-word, CamelCase reason for the condition's last transition. |
| `conditions[].status` | `string` Status is the status of the condition. Can be True, False, Unknown. |
| `conditions[].type` | `string` Type is the type of the condition. |
| `createTime` | `string` Output only. The timestamp when the resource was created. |
| `observedGeneration` | `integer` ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource. |
| `selfLink` | `string` Output only. Server-defined URL of this resource |
| `updateTime` | `string` Output only. The timestamp when the resource was updated. |

## Sample YAML(s)

### Typical Use Case

    # Copyright 2022 Google LLC
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.

    apiVersion: networkservices.cnrm.cloud.google.com/v1beta1
    kind: NetworkServicesTCPRoute
    metadata:
      name: networkservicestcproute-sample
      labels:
        foo: bar
    spec:
      meshes:
      - name: "networkservicestcproute-dep"
      gateways:
      - name: "networkservicestcproute-dep"
      location: "global"
      description: "A test TcpRoute"
      rules:
      - matches:
        - address: "10.0.0.1/32"
          port: "7777"
        action:
          destinations:
          - serviceRef:
              name: "networkservicestcproute-dep"
            weight: 1
      - matches:
        - address: "10.0.0.1/0"
          port: "1"
        action:
          originalDestination: false
          destinations:
          - serviceRef:
              name: "networkservicestcproute-dep"
            weight: 1
      projectRef:
        # Replace "${PROJECT_ID?}" with your project ID
        external: "projects/${PROJECT_ID?}"
    ---
    apiVersion: compute.cnrm.cloud.google.com/v1beta1
    kind: ComputeBackendService
    metadata:
      name: networkservicestcproute-dep
    spec:
      loadBalancingScheme: "INTERNAL_SELF_MANAGED"
      location: global
    ---
    apiVersion: networkservices.cnrm.cloud.google.com/v1beta1
    kind: NetworkServicesGateway
    metadata:
      name: networkservicestcproute-dep
      labels:
        foo: bar
    spec:
      description: "A test Gateway"
      type: "OPEN_MESH"
      ports:
      - 80
      - 443
      location: "global"
      scope: "networkservicestcproute-sample"
      projectRef:
        # Replace "${PROJECT_ID?}" with your project ID
        external: "projects/${PROJECT_ID?}"
    ---
    apiVersion: networkservices.cnrm.cloud.google.com/v1beta1
    kind: NetworkServicesMesh
    metadata:
      name: networkservicestcproute-dep
    spec:
      location: "global"
      projectRef:
        # Replace "${PROJECT_ID?}" with your project ID
        external: "projects/${PROJECT_ID?}"

> [!NOTE]
> **Note:** If you have any trouble with instantiating the resource, refer to [Troubleshoot Config Connector](https://docs.cloud.google.com/config-connector/docs/troubleshooting).