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 | |
---|---|
Optional |
Optional. A free-text description of the resource. Max length 1024 characters. |
Optional |
|
Optional |
|
Optional |
Allowed value: The `selfLink` field of a `NetworkServicesGateway` resource. |
Optional |
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names |
Optional |
Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ |
Required |
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"). |
Required |
|
Required |
Immutable. The location for the resource |
Optional |
|
Optional |
|
Optional |
Allowed value: The `selfLink` field of a `NetworkServicesMesh` resource. |
Optional |
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names |
Optional |
Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ |
Required |
Immutable. The Project that this resource belongs to. |
Optional |
The project for the resource Allowed value: The Google Cloud resource name of a `Project` resource (format: `projects/{{name}}`). |
Optional |
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names |
Optional |
Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ |
Optional |
Immutable. Optional. The name of the resource. Used for creation and acquisition. When unset, the value of `metadata.name` is used as the default. |
Required |
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. |
Required |
|
Required |
Required. A detailed rule defining how to route traffic. This field is required. |
Optional |
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. |
Optional |
|
Required* |
|
Optional |
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}}`). |
Optional |
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names |
Optional |
Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ |
Optional |
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. |
Optional |
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 |
Optional |
The specification for aborting to client requests. |
Optional |
The HTTP status code used to abort the request. The value must be between 200 and 599 inclusive. |
Optional |
The percentage of traffic which will be aborted. The value must be between [0, 100] |
Optional |
The specification for injecting delay to client requests. |
Optional |
Specify a fixed delay before forwarding the request. |
Optional |
The percentage of traffic on which delay will be injected. The value must be between [0, 100] |
Optional |
Optional. Specifies the retry policy associated with this route. |
Optional |
Specifies the allowed number of retries. This number must be > 0. If not specpfied, default to 1. |
Optional |
- 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 |
Optional |
|
Optional |
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. |
Optional |
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. |
Optional |
|
Optional |
Optional. Specifies a collection of headers to match. |
Optional |
|
Required* |
Required. The key of the header. |
Optional |
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 |
Required* |
Required. The value of the header. |
Optional |
Optional. A gRPC method to match against. If this field is empty or omitted, will match all methods. |
Optional |
Optional. Specifies that matches are case sensitive. The default value is true. case_sensitive must not be used with a type of REGULAR_EXPRESSION. |
Required* |
Required. Name of the method to match against. If unspecified, will match all methods. |
Required* |
Required. Name of the service to match against. If unspecified, will match all services. |
Optional |
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 |
Conditions represent the latest available observation of the resource's current state. |
conditions[] |
|
conditions[].lastTransitionTime |
Last time the condition transitioned from one status to another. |
conditions[].message |
Human-readable message indicating details about last transition. |
conditions[].reason |
Unique, one-word, CamelCase reason for the condition's last transition. |
conditions[].status |
Status is the status of the condition. Can be True, False, Unknown. |
conditions[].type |
Type is the type of the condition. |
createTime |
Output only. The timestamp when the resource was created. |
observedGeneration |
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 |
Output only. Server-defined URL of this resource |
updateTime |
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?}"