NetworkServicesGRPCRoute


Property Value
Google Cloud Service Name Network Services
Google Cloud Service Documentation /traffic-director/docs/
Google Cloud REST Resource Name v1/projects.locations.grpcRoutes
Google Cloud REST Resource Documentation /traffic-director/docs/reference/network-services/rest/v1/projects.locations.grpcRoutes
Config Connector Resource Short Names gcpnetworkservicesgrpcroute
gcpnetworkservicesgrpcroutes
networkservicesgrpcroute
Config Connector Service Name networkservices.googleapis.com
Config Connector Resource Fully Qualified Name networkservicesgrpcroutes.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
hostnames:
- 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
    faultInjectionPolicy:
      abort:
        httpStatus: integer
        percentage: integer
      delay:
        fixedDelay: string
        percentage: integer
    retryPolicy:
      numRetries: integer
      retryConditions:
      - string
    timeout: string
  matches:
  - headers:
    - key: string
      type: string
      value: string
    method:
      caseSensitive: boolean
      grpcMethod: string
      grpcService: string
      type: string
Fields

description

Optional

string

Optional. A free-text description of the resource. Max length 1024 characters.

gateways

Optional

list (object)

gateways[]

Optional

object

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/

hostnames

Required

list (string)

Required. Service hostnames with an optional port for which this route describes traffic. Format: [:] Hostname is the fully qualified domain name of a network host. This matches the RFC 1123 definition of a hostname with 2 notable exceptions: - IPs are not allowed. - A hostname may be prefixed with a wildcard label (*.). The wildcard label must appear by itself as the first label. Hostname can be “precise” which is a domain name without the terminating dot of a network host (e.g. “foo.example.com”) or “wildcard”, which is a domain name prefixed with a single wildcard label (e.g. *.example.com). Note that as per RFC1035 and RFC1123, a label must consist of lower case alphanumeric characters or ‘-’, and must start and end with an alphanumeric character. No other punctuation is allowed. The routes associated with a Router must have unique hostnames. If you attempt to attach multiple routes with conflicting hostnames, the configuration will be rejected. For example, while it is acceptable for routes for the hostnames "*.foo.bar.com" and "*.bar.com" to be associated with the same route, it is not possible to associate two routes both with "*.bar.com" or both with "bar.com". In the case that multiple routes match the hostname, the most specific match will be selected. For example, "foo.bar.baz.com" will take precedence over "*.bar.baz.com" and "*.bar.baz.com" will take precedence over "*.baz.com". If a port is specified, then gRPC clients must use the channel URI with the port to match this rule (i.e. "xds:///service:123"), otherwise they must supply the URI without a port (i.e. "xds:///service").

hostnames[]

Required

string

location

Required

string

Immutable. The location for the resource

meshes

Optional

list (object)

meshes[]

Optional

object

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. A list of detailed rules defining how to route traffic. Within a single GrpcRoute, the GrpcRoute.RouteAction associated with the first matching GrpcRoute.RouteRule will be executed. At least one rule must be supplied.

rules[]

Required

object

rules[].action

Required

object

Required. A detailed rule defining how to route traffic. This field is required.

rules[].action.destinations

Optional

list (object)

Optional. The destination services to which traffic should be forwarded. If multiple destinations are specified, traffic will be split between Backend Service(s) according to the weight field of these destinations.

rules[].action.destinations[]

Optional

object

rules[].action.destinations[].serviceRef

Required*

object

rules[].action.destinations[].serviceRef.external

Optional

string

Required. The URL of a destination service to which to route traffic. Must refer to either a BackendService or ServiceDirectoryService. 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.faultInjectionPolicy

Optional

object

Optional. The specification for fault injection introduced into traffic to test the resiliency of clients to destination service failure. As part of fault injection, when clients send requests to a destination, delays can be introduced on a percentage of requests before sending those requests to the destination service. Similarly requests from clients can be aborted by for a percentage of requests. timeout and retry_policy will be ignored by clients that are configured with a fault_injection_policy

rules[].action.faultInjectionPolicy.abort

Optional

object

The specification for aborting to client requests.

rules[].action.faultInjectionPolicy.abort.httpStatus

Optional

integer

The HTTP status code used to abort the request. The value must be between 200 and 599 inclusive.

rules[].action.faultInjectionPolicy.abort.percentage

Optional

integer

The percentage of traffic which will be aborted. The value must be between [0, 100]

rules[].action.faultInjectionPolicy.delay

Optional

object

The specification for injecting delay to client requests.

rules[].action.faultInjectionPolicy.delay.fixedDelay

Optional

string

Specify a fixed delay before forwarding the request.

rules[].action.faultInjectionPolicy.delay.percentage

Optional

integer

The percentage of traffic on which delay will be injected. The value must be between [0, 100]

rules[].action.retryPolicy

Optional

object

Optional. Specifies the retry policy associated with this route.

rules[].action.retryPolicy.numRetries

Optional

integer

Specifies the allowed number of retries. This number must be > 0. If not specpfied, default to 1.

rules[].action.retryPolicy.retryConditions

Optional

list (string)

- connect-failure: Router will retry on failures connecting to Backend Services, for example due to connection timeouts. - refused-stream: Router will retry if the backend service resets the stream with a REFUSED_STREAM error code. This reset type indicates that it is safe to retry. - cancelled: Router will retry if the gRPC status code in the response header is set to cancelled - deadline-exceeded: Router will retry if the gRPC status code in the response header is set to deadline-exceeded - resource-exhausted: Router will retry if the gRPC status code in the response header is set to resource-exhausted - unavailable: Router will retry if the gRPC status code in the response header is set to unavailable

rules[].action.retryPolicy.retryConditions[]

Optional

string

rules[].action.timeout

Optional

string

Optional. Specifies the timeout for selected route. Timeout is computed from the time the request has been fully processed (i.e. end of stream) up until the response has been completely processed. Timeout includes all retries.

rules[].matches

Optional

list (object)

Optional. Matches define conditions used for matching the rule against incoming gRPC requests. Each match is independent, i.e. this rule will be matched if ANY one of the matches is satisfied. If no matches field is specified, this rule will unconditionally match traffic.

rules[].matches[]

Optional

object

rules[].matches[].headers

Optional

list (object)

Optional. Specifies a collection of headers to match.

rules[].matches[].headers[]

Optional

object

rules[].matches[].headers[].key

Required*

string

Required. The key of the header.

rules[].matches[].headers[].type

Optional

string

Optional. Specifies how to match against the value of the header. If not specified, a default value of EXACT is used. Possible values: MATCH_TYPE_UNSPECIFIED, MATCH_ANY, MATCH_ALL

rules[].matches[].headers[].value

Required*

string

Required. The value of the header.

rules[].matches[].method

Optional

object

Optional. A gRPC method to match against. If this field is empty or omitted, will match all methods.

rules[].matches[].method.caseSensitive

Optional

boolean

Optional. Specifies that matches are case sensitive. The default value is true. case_sensitive must not be used with a type of REGULAR_EXPRESSION.

rules[].matches[].method.grpcMethod

Required*

string

Required. Name of the method to match against. If unspecified, will match all methods.

rules[].matches[].method.grpcService

Required*

string

Required. Name of the service to match against. If unspecified, will match all services.

rules[].matches[].method.type

Optional

string

Optional. Specifies how to match against the name. If not specified, a default value of "EXACT" is used. Possible values: TYPE_UNSPECIFIED, EXACT, REGULAR_EXPRESSION

* 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

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: NetworkServicesGRPCRoute
metadata:
  name: networkservicesgrpcroute-sample
  labels:
    foo: bar
spec:
  description: "A test GrpcRoute"
  meshes:
  - name: "networkservicesgrpcroute-dep"
  gateways:
  - name: "networkservicesgrpcroute-dep"
  location: "global"
  hostnames:
  - "test1"
  - "test2"
  rules:
  - matches:
    - method:
        type: "EXACT"
        grpcService: "helloworld.Greeter"
        grpcMethod: "SayHello"
        caseSensitive: false
      headers:
      - type: "EXACT"
        key: "foo"
        value: "bar"
    action:
      destinations:
      - serviceRef:
          name: "networkservicesgrpcroute-dep"
        weight: 50
      - serviceRef:
          name: "networkservicesgrpcroute-dep"
        weight: 50
      faultInjectionPolicy:
        abort:
          httpStatus: 501
          percentage: 1
        delay:
          fixedDelay: "10s"
          percentage: 2
      retryPolicy:
        numRetries: 3
        retryConditions:
        - "refused-stream"
        - "cancelled"
      timeout: "30s"
  - action:
      destinations:
      - serviceRef:
          name: "networkservicesgrpcroute-dep"
  projectRef:
    # Replace "${PROJECT_ID?}" with your project ID
    external: "projects/${PROJECT_ID?}"
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeBackendService
metadata:
  name: networkservicesgrpcroute-dep
spec:
  loadBalancingScheme: "INTERNAL_SELF_MANAGED"
  location: global
  protocol: GRPC
  projectRef:
    # Replace "${PROJECT_ID?}" with your project ID
    external: "projects/${PROJECT_ID?}"
---
apiVersion: networkservices.cnrm.cloud.google.com/v1beta1
kind: NetworkServicesGateway
metadata:
  name: networkservicesgrpcroute-dep
spec:
  location: "global"
  type: "OPEN_MESH"
  scope: "networkservicesgrpcroute-sample-scope"
  ports:
  - 80
  - 443
  projectRef:
    # Replace "${PROJECT_ID?}" with your project ID
    external: "projects/${PROJECT_ID?}"
---
apiVersion: networkservices.cnrm.cloud.google.com/v1beta1
kind: NetworkServicesMesh
metadata:
  name: networkservicesgrpcroute-dep
spec:
  location: "global"
  projectRef:
    # Replace "${PROJECT_ID?}" with your project ID
    external: "projects/${PROJECT_ID?}"