ComputeBackendService

Property Value
Google Cloud Service Name Compute Engine
Google Cloud Service Documentation /compute/docs/
Google Cloud REST Resource Name
v1.backendServices
v1.regionBackendServices
Google Cloud REST Resource Documentation
/compute/docs/reference/rest/v1/backendServices
/compute/docs/reference/rest/v1/regionBackendServices
Config Connector Resource Short Names computebackendservice
gcpcomputebackendservice
gcpcomputebackendservices
Config Connector Service Name compute.googleapis.com
Config Connector Resource Fully Qualified Name computebackendservices.compute.cnrm.cloud.google.com
Can Be Referenced by IAMPolicy/IAMPolicyMember No
Config Connector Default Average Reconcile Interval In Seconds 600

ComputeBackendService can manage both global and regional backend services. To manage a global ComputeBackendService use a value of global in the spec.location field. To manage a regional ComputeBackendService, use a region name in the spec.location field.

Custom Resource Definition Properties

Annotations

Fields
cnrm.cloud.google.com/project-id

Spec

Schema

affinityCookieTtlSec: integer
backend:
- balancingMode: string
  capacityScaler: float
  description: string
  failover: boolean
  group:
    instanceGroupRef:
      external: string
      name: string
      namespace: string
    networkEndpointGroupRef:
      external: string
      name: string
      namespace: string
  maxConnections: integer
  maxConnectionsPerEndpoint: integer
  maxConnectionsPerInstance: integer
  maxRate: integer
  maxRatePerEndpoint: float
  maxRatePerInstance: float
  maxUtilization: float
cdnPolicy:
  bypassCacheOnRequestHeaders:
  - headerName: string
  cacheKeyPolicy:
    includeHost: boolean
    includeHttpHeaders:
    - string
    includeNamedCookies:
    - string
    includeProtocol: boolean
    includeQueryString: boolean
    queryStringBlacklist:
    - string
    queryStringWhitelist:
    - string
  cacheMode: string
  clientTtl: integer
  defaultTtl: integer
  maxTtl: integer
  negativeCaching: boolean
  negativeCachingPolicy:
  - code: integer
    ttl: integer
  serveWhileStale: integer
  signedUrlCacheMaxAgeSec: integer
circuitBreakers:
  connectTimeout:
    nanos: integer
    seconds: integer
  maxConnections: integer
  maxPendingRequests: integer
  maxRequests: integer
  maxRequestsPerConnection: integer
  maxRetries: integer
compressionMode: string
connectionDrainingTimeoutSec: integer
connectionTrackingPolicy:
  connectionPersistenceOnUnhealthyBackends: string
  enableStrongAffinity: boolean
  idleTimeoutSec: integer
  trackingMode: string
consistentHash:
  httpCookie:
    name: string
    path: string
    ttl:
      nanos: integer
      seconds: integer
  httpHeaderName: string
  minimumRingSize: integer
customRequestHeaders:
- string
customResponseHeaders:
- string
description: string
edgeSecurityPolicyRef:
  external: string
  name: string
  namespace: string
enableCdn: boolean
failoverPolicy:
  disableConnectionDrainOnFailover: boolean
  dropTrafficIfUnhealthy: boolean
  failoverRatio: float
healthChecks:
- healthCheckRef:
    external: string
    name: string
    namespace: string
  httpHealthCheckRef:
    external: string
    name: string
    namespace: string
iap:
  oauth2ClientId: string
  oauth2ClientIdRef:
    external: string
    name: string
    namespace: string
  oauth2ClientSecret:
    value: string
    valueFrom:
      secretKeyRef:
        key: string
        name: string
  oauth2ClientSecretSha256: string
loadBalancingScheme: string
localityLbPolicies:
- customPolicy:
    data: string
    name: string
  policy:
    name: string
localityLbPolicy: string
location: string
logConfig:
  enable: boolean
  sampleRate: float
networkRef:
  external: string
  name: string
  namespace: string
outlierDetection:
  baseEjectionTime:
    nanos: integer
    seconds: integer
  consecutiveErrors: integer
  consecutiveGatewayFailure: integer
  enforcingConsecutiveErrors: integer
  enforcingConsecutiveGatewayFailure: integer
  enforcingSuccessRate: integer
  interval:
    nanos: integer
    seconds: integer
  maxEjectionPercent: integer
  successRateMinimumHosts: integer
  successRateRequestVolume: integer
  successRateStdevFactor: integer
portName: string
protocol: string
resourceID: string
securityPolicy: string
securityPolicyRef:
  external: string
  name: string
  namespace: string
securitySettings:
  clientTLSPolicyRef:
    external: string
    name: string
    namespace: string
  subjectAltNames:
  - string
sessionAffinity: string
subsetting:
  policy: string
timeoutSec: integer
Fields

affinityCookieTtlSec

Optional

integer

Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE.

backend

Optional

list (object)

The set of backends that serve this BackendService.

backend[]

Optional

object

backend[].balancingMode

Optional

string

Specifies the balancing mode for this backend.

backend[].capacityScaler

Optional

float

A multiplier applied to the group's maximum servicing capacity.

backend[].description

Optional

string

An optional description of this resource.

backend[].failover

Optional

boolean

This field designates whether this is a failover backend.

backend[].group

Required*

object

Reference to a ComputeInstanceGroup or ComputeNetworkEndpointGroup resource. In case of instance group this defines the list of instances that serve traffic. Member virtual machine instances from each instance group must live in the same zone as the instance group itself. No two backends in a backend service are allowed to use same Instance Group resource. For Network Endpoint Groups this defines list of endpoints. All endpoints of Network Endpoint Group must be hosted on instances located in the same zone as the Network Endpoint Group. Backend services cannot mix Instance Group and Network Endpoint Group backends. When the 'load_balancing_scheme' is INTERNAL, only instance groups are supported.

backend[].group.instanceGroupRef

Optional

object

Reference to a ComputeInstanceGroup resource.

backend[].group.instanceGroupRef.external

Optional

string

A reference to an externally managed ComputeInstanceGroup resource. Should be in the format "projects/{{projectID}}/zones/{{zone}}/instanceGroups/{{instanceGroupID}}".

backend[].group.instanceGroupRef.name

Optional

string

The name of a ComputeInstanceGroup resource.

backend[].group.instanceGroupRef.namespace

Optional

string

The namespace of a ComputeInstanceGroup resource.

backend[].group.networkEndpointGroupRef

Optional

object

Reference to a ComputeNetworkEndpointGroup resource.

backend[].group.networkEndpointGroupRef.external

Optional

string

A reference to an externally managed ComputeNetworkEndpointGroup resource. Should be in the format "projects/{project}/zones/{zone}/networkEndpointGroups/{networkEndpointGroup}".

backend[].group.networkEndpointGroupRef.name

Optional

string

The name of a ComputeNetworkEndpointGroup resource.

backend[].group.networkEndpointGroupRef.namespace

Optional

string

The namespace of a ComputeNetworkEndpointGroup resource.

backend[].maxConnections

Optional

integer

The max number of simultaneous connections for the group.

backend[].maxConnectionsPerEndpoint

Optional

integer

The max number of simultaneous connections that a single backend network endpoint can handle.

backend[].maxConnectionsPerInstance

Optional

integer

The max number of simultaneous connections that a single backend instance can handle.

backend[].maxRate

Optional

integer

The max requests per second (RPS) of the group.

backend[].maxRatePerEndpoint

Optional

float

The max requests per second (RPS) that a single backend network endpoint can handle.

backend[].maxRatePerInstance

Optional

float

The max requests per second (RPS) that a single backend instance can handle.

backend[].maxUtilization

Optional

float

Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization target for the group.

cdnPolicy

Optional

object

Cloud CDN configuration for this BackendService.

cdnPolicy.bypassCacheOnRequestHeaders

Optional

list (object)

Bypass the cache when the specified request headers are matched - e.g. Pragma or Authorization headers. Up to 5 headers can be specified. The cache is bypassed for all cdnPolicy.cacheMode settings.

cdnPolicy.bypassCacheOnRequestHeaders[]

Optional

object

cdnPolicy.bypassCacheOnRequestHeaders[].headerName

Required*

string

The header field name to match on when bypassing cache. Values are case-insensitive.

cdnPolicy.cacheKeyPolicy

Optional

object

The CacheKeyPolicy for this CdnPolicy.

cdnPolicy.cacheKeyPolicy.includeHost

Optional

boolean

If true, requests to different hosts will be cached separately.

cdnPolicy.cacheKeyPolicy.includeHttpHeaders

Optional

list (string)

Allows HTTP request headers (by name) to be used in the cache key.

cdnPolicy.cacheKeyPolicy.includeHttpHeaders[]

Optional

string

cdnPolicy.cacheKeyPolicy.includeNamedCookies

Optional

list (string)

Allows HTTP cookies (by name) to be used in the cache key. The name=value pair will be used in the cache key Cloud CDN generates.

cdnPolicy.cacheKeyPolicy.includeNamedCookies[]

Optional

string

cdnPolicy.cacheKeyPolicy.includeProtocol

Optional

boolean

If true, http and https requests will be cached separately.

cdnPolicy.cacheKeyPolicy.includeQueryString

Optional

boolean

If true, include query string parameters in the cache key according to query_string_whitelist and query_string_blacklist. If neither is set, the entire query string will be included. If false, the query string will be excluded from the cache key entirely.

cdnPolicy.cacheKeyPolicy.queryStringBlacklist

Optional

list (string)

Names of query string parameters to exclude in cache keys. All other parameters will be included. Either specify query_string_whitelist or query_string_blacklist, not both. '&' and '=' will be percent encoded and not treated as delimiters.

cdnPolicy.cacheKeyPolicy.queryStringBlacklist[]

Optional

string

cdnPolicy.cacheKeyPolicy.queryStringWhitelist

Optional

list (string)

Names of query string parameters to include in cache keys. All other parameters will be excluded. Either specify query_string_whitelist or query_string_blacklist, not both. '&' and '=' will be percent encoded and not treated as delimiters.

cdnPolicy.cacheKeyPolicy.queryStringWhitelist[]

Optional

string

cdnPolicy.cacheMode

Optional

string

Specifies the cache setting for all responses from this backend. The possible values are: USE_ORIGIN_HEADERS Requires the origin to set valid caching headers to cache content. Responses without these headers will not be cached at Google's edge, and will require a full trip to the origin on every request, potentially impacting performance and increasing load on the origin server. FORCE_CACHE_ALL Cache all content, ignoring any "private", "no-store" or "no-cache" directives in Cache-Control response headers. Warning: this may result in Cloud CDN caching private, per-user (user identifiable) content. CACHE_ALL_STATIC Automatically cache static content, including common image formats, media (video and audio), and web assets (JavaScript and CSS). Requests and responses that are marked as uncacheable, as well as dynamic content (including HTML), will not be cached. If no value is provided for cdnPolicy.cacheMode, it defaults to CACHE_ALL_STATIC. Check the CacheMode enum for the list of possible values.

cdnPolicy.clientTtl

Optional

integer

Specifies a separate client (e.g. browser client) maximum TTL. This is used to clamp the max-age (or Expires) value sent to the client. With FORCE_CACHE_ALL, the lesser of client_ttl and default_ttl is used for the response max-age directive, along with a "public" directive. For cacheable content in CACHE_ALL_STATIC mode, client_ttl clamps the max-age from the origin (if specified), or else sets the response max-age directive to the lesser of the client_ttl and default_ttl, and also ensures a "public" cache-control directive is present. If a client TTL is not specified, a default value (1 hour) will be used. The maximum allowed value is 31,622,400s (1 year).

cdnPolicy.defaultTtl

Optional

integer

Specifies the default TTL for cached content served by this origin for responses that do not have an existing valid TTL (max-age or s-maxage). Setting a TTL of "0" means "always revalidate". The value of defaultTTL cannot be set to a value greater than that of maxTTL, but can be equal. When the cacheMode is set to FORCE_CACHE_ALL, the defaultTTL will overwrite the TTL set in all responses. The maximum allowed value is 31,622,400s (1 year), noting that infrequently accessed objects may be evicted from the cache before the defined TTL.

cdnPolicy.maxTtl

Optional

integer

Specifies the maximum allowed TTL for cached content served by this origin. Cache directives that attempt to set a max-age or s-maxage higher than this, or an Expires header more than maxTTL seconds in the future will be capped at the value of maxTTL, as if it were the value of an s-maxage Cache-Control directive. Headers sent to the client will not be modified. Setting a TTL of "0" means "always revalidate". The maximum allowed value is 31,622,400s (1 year), noting that infrequently accessed objects may be evicted from the cache before the defined TTL.

cdnPolicy.negativeCaching

Optional

boolean

Negative caching allows per-status code TTLs to be set, in order to apply fine-grained caching for common errors or redirects. This can reduce the load on your origin and improve end-user experience by reducing response latency. When the cache mode is set to CACHE_ALL_STATIC or USE_ORIGIN_HEADERS, negative caching applies to responses with the specified response code that lack any Cache-Control, Expires, or Pragma: no-cache directives. When the cache mode is set to FORCE_CACHE_ALL, negative caching applies to all responses with the specified response code, and override any caching headers. By default, Cloud CDN will apply the following default TTLs to these status codes: HTTP 300 (Multiple Choice), 301, 308 (Permanent Redirects): 10m HTTP 404 (Not Found), 410 (Gone), 451 (Unavailable For Legal Reasons): 120s HTTP 405 (Method Not Found), 421 (Misdirected Request), 501 (Not Implemented): 60s. These defaults can be overridden in negative_caching_policy.

cdnPolicy.negativeCachingPolicy

Optional

list (object)

Sets a cache TTL for the specified HTTP status code. negative_caching must be enabled to configure negative_caching_policy. Omitting the policy and leaving negative_caching enabled will use Cloud CDN's default cache TTLs. Note that when specifying an explicit negative_caching_policy, you should take care to specify a cache TTL for all response codes that you wish to cache. Cloud CDN will not apply any default negative caching when a policy exists.

cdnPolicy.negativeCachingPolicy[]

Optional

object

cdnPolicy.negativeCachingPolicy[].code

Optional

integer

The HTTP status code to define a TTL against. Only HTTP status codes 300, 301, 302, 307, 308, 404, 405, 410, 421, 451 and 501 are can be specified as values, and you cannot specify a status code more than once.

cdnPolicy.negativeCachingPolicy[].ttl

Optional

integer

The TTL (in seconds) for which to cache responses with the corresponding status code. The maximum allowed value is 1800s (30 minutes), noting that infrequently accessed objects may be evicted from the cache before the defined TTL.

cdnPolicy.serveWhileStale

Optional

integer

Serve existing content from the cache (if available) when revalidating content with the origin, or when an error is encountered when refreshing the cache. This setting defines the default "max-stale" duration for any cached responses that do not specify a max-stale directive. Stale responses that exceed the TTL configured here will not be served. The default limit (max-stale) is 86400s (1 day), which will allow stale content to be served up to this limit beyond the max-age (or s-maxage) of a cached response. The maximum allowed value is 604800 (1 week). Set this to zero (0) to disable serve-while-stale.

cdnPolicy.signedUrlCacheMaxAgeSec

Optional

integer

Maximum number of seconds the response to a signed URL request will be considered fresh. After this time period, the response will be revalidated before being served. Defaults to 1hr (3600s). When serving responses to signed URL requests, Cloud CDN will internally behave as though all responses from this backend had a "Cache-Control: public, max-age=[TTL]" header, regardless of any existing Cache-Control header. The actual headers served in responses will not be altered.

circuitBreakers

Optional

object

Settings controlling the circuit breaking behavior for this BackendService.

circuitBreakers.connectTimeout

Optional

object

Not supported by proxy. Connect timeout for the backend service. The timeout is the maximum amount of time KCC will wait for the proxy to connect to the backend.

circuitBreakers.connectTimeout.nanos

Optional

integer

Span of time that's a fraction of a second at nanosecond resolution. Must be from 0 to 999,999,999 inclusive.

circuitBreakers.connectTimeout.seconds

Required*

integer

Span of time at a resolution of a second. Must be from 0 to 315,576,000,000 inclusive.

circuitBreakers.maxConnections

Optional

integer

The maximum number of connections to the backend service. If not specified, there is no limit. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.

circuitBreakers.maxPendingRequests

Optional

integer

The maximum number of pending requests allowed to the backend service. If not specified, there is no limit. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.

circuitBreakers.maxRequests

Optional

integer

The maximum number of parallel requests that allowed to the backend service. If not specified, there is no limit.

circuitBreakers.maxRequestsPerConnection

Optional

integer

Maximum requests for a single connection to the backend service. This parameter is respected by both the HTTP/1.1 and HTTP/2 implementations. If not specified, there is no limit. Setting this parameter to 1 will effectively disable keep alive. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.

circuitBreakers.maxRetries

Optional

integer

The maximum number of parallel retries allowed to the backend cluster. If not specified, the default is 1. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.

compressionMode

Optional

string

Compress text responses using Brotli or gzip compression, based on the client's Accept-Encoding header.

connectionDrainingTimeoutSec

Optional

integer

Time for which instance will be drained (not accept new connections, but still work to finish started).

connectionTrackingPolicy

Optional

object

Connection Tracking configuration for this BackendService. Connection tracking policy settings are only available for external passthrough Network Load Balancers and internal passthrough Network Load Balancers. connectionTrackingPolicy cannot be specified with haPolicy.

connectionTrackingPolicy.connectionPersistenceOnUnhealthyBackends

Optional

string

Specifies connection persistence when backends are unhealthy. The default value is DEFAULT_FOR_PROTOCOL. If set to DEFAULT_FOR_PROTOCOL, the existing connections persist on unhealthy backends only for connection-oriented protocols (TCP and SCTP) and only if the Tracking Mode is PER_CONNECTION (default tracking mode) or the Session Affinity is configured for 5-tuple. They do not persist for UDP. If set to NEVER_PERSIST, after a backend becomes unhealthy, the existing connections on the unhealthy backend are never persisted on the unhealthy backend. They are always diverted to newly selected healthy backends (unless all backends are unhealthy). If set to ALWAYS_PERSIST, existing connections always persist on unhealthy backends regardless of protocol and session affinity. It is generally not recommended to use this mode overriding the default. For more details, see [Connection Persistence for Network Load Balancing](https://cloud.google.com/load-balancing/docs/network/networklb-backend-service#connection-persistence) and [Connection Persistence for Internal TCP/UDP Load Balancing](https://cloud.google.com/load-balancing/docs/internal#connection-persistence). Check the ConnectionPersistenceOnUnhealthyBackends enum for the list of possible values.

connectionTrackingPolicy.enableStrongAffinity

Optional

boolean

Enable Strong Session Affinity for external passthrough Network Load Balancers. This option is not available publicly.

connectionTrackingPolicy.idleTimeoutSec

Optional

integer

Specifies how long to keep a Connection Tracking entry while there is no matching traffic (in seconds). For internal passthrough Network Load Balancers: - The minimum (default) is 10 minutes and the maximum is 16 hours. - It can be set only if Connection Tracking is less than 5-tuple (i.e. Session Affinity is CLIENT_IP_NO_DESTINATION, CLIENT_IP or CLIENT_IP_PROTO, and Tracking Mode is PER_SESSION). For external passthrough Network Load Balancers the default is 60 seconds. This option is not available publicly.

connectionTrackingPolicy.trackingMode

Optional

string

Specifies the key used for connection tracking. There are two options: - PER_CONNECTION: This is the default mode. The Connection Tracking is performed as per the Connection Key (default Hash Method) for the specific protocol. - PER_SESSION: The Connection Tracking is performed as per the configured Session Affinity. It matches the configured Session Affinity. For more details, see [Tracking Mode for Network Load Balancing](https://cloud.google.com/load-balancing/docs/network/networklb-backend-service#tracking-mode) and [Tracking Mode for Internal TCP/UDP Load Balancing](https://cloud.google.com/load-balancing/docs/internal#tracking-mode). Check the TrackingMode enum for the list of possible values.

consistentHash

Optional

object

Consistent Hash-based load balancing can be used to provide soft session affinity based on HTTP headers, cookies or other properties. This load balancing policy is applicable only for HTTP connections. The affinity to a particular destination host will be lost when one or more hosts are added/removed from the destination service. This field specifies parameters that control consistent hashing. This field is only applicable when localityLbPolicy is set to MAGLEV or RING_HASH. This field is applicable to either: - A regional backend service with the service_protocol set to HTTP, HTTPS, HTTP2 or H2C, and load_balancing_scheme set to INTERNAL_MANAGED. - A global backend service with the load_balancing_scheme set to INTERNAL_SELF_MANAGED.

consistentHash.httpCookie

Optional

object

Hash session affinity settings when using STRONG_COOKIE_AFFINITY or STRONG_HEADER_AFFINITY.

consistentHash.httpCookie.name

Optional

string

Name of the cookie.

consistentHash.httpCookie.path

Optional

string

Path to set for the cookie.

consistentHash.httpCookie.ttl

Optional

object

Lifetime of the cookie.

consistentHash.httpCookie.ttl.nanos

Optional

integer

Span of time that's a fraction of a second at nanosecond resolution. Must be from 0 to 999,999,999 inclusive.

consistentHash.httpCookie.ttl.seconds

Required*

integer

Span of time at a resolution of a second. Must be from 0 to 315,576,000,000 inclusive.

consistentHash.httpHeaderName

Optional

string

The name of the HTTP header field to map onto. Required if the load balancing policy is MAGLEV or RING_HASH and session affinity is STRONG_HEADER_AFFINITY.

consistentHash.minimumRingSize

Optional

integer

The minimum ring size. Valid values are between 1 and 4096. Required if the load balancing policy is RING_HASH.

customRequestHeaders

Optional

list (string)

Headers that the load balancer adds to proxied requests. See [Creating custom headers](https://cloud.google.com/load-balancing/docs/custom-headers).

customRequestHeaders[]

Optional

string

customResponseHeaders

Optional

list (string)

Headers that the load balancer adds to proxied responses. See [Creating custom headers](https://cloud.google.com/load-balancing/docs/custom-headers).

customResponseHeaders[]

Optional

string

description

Optional

string

An optional description of this resource.

edgeSecurityPolicyRef

Optional

object

ComputeSecurityPolicyRef is a reference to a ComputeSecurityPolicy.

edgeSecurityPolicyRef.external

Optional

string

A reference to an externally managed ComputeSecurityPolicy resource. Should be in the format "projects/{{projectID}}/global/securityPolicies/{{name}}".

edgeSecurityPolicyRef.name

Optional

string

The name of a ComputeSecurityPolicy resource.

edgeSecurityPolicyRef.namespace

Optional

string

The namespace of a ComputeSecurityPolicy resource.

enableCdn

Optional

boolean

If true, enables Cloud CDN for the backend service.

failoverPolicy

Optional

object

Requires at least one backend instance group to be defined as a backup (failover) backend. For load balancers that have configurable failover: [Internal passthrough Network Load Balancers](https://cloud.google.com/load-balancing/docs/internal/failover-overview) and [external passthrough Network Load Balancers](https://cloud.google.com/load-balancing/docs/network/networklb-failover-overview). failoverPolicy cannot be specified with haPolicy.

failoverPolicy.disableConnectionDrainOnFailover

Optional

boolean

This can be set to true only if the protocol is TCP. The default is false.

failoverPolicy.dropTrafficIfUnhealthy

Optional

boolean

If set to true, connections to the load balancer are dropped when all primary and all backup backend VMs are unhealthy.If set to false, connections are distributed among all primary VMs when all primary and all backup backend VMs are unhealthy. For load balancers that have configurable failover: [Internal passthrough Network Load Balancers](https://cloud.google.com/load-balancing/docs/internal/failover-overview) and [external passthrough Network Load Balancers](https://cloud.google.com/load-balancing/docs/network/networklb-failover-overview). The default is false.

failoverPolicy.failoverRatio

Optional

float

The value of the field must be in the range [0, 1]. If the value is 0, the load balancer performs a failover when the number of healthy primary VMs equals zero. For all other values, the load balancer performs a failover when the total number of healthy primary VMs is less than this ratio. For load balancers that have configurable failover: [Internal TCP/UDP Load Balancing](https://cloud.google.com/load-balancing/docs/internal/failover-overview) and [external TCP/UDP Load Balancing](https://cloud.google.com/load-balancing/docs/network/networklb-failover-overview).

healthChecks

Optional

list (object)

healthChecks[]

Optional

object

The health check resources for health checking this ComputeBackendService. Currently at most one health check can be specified, and a health check is required.

healthChecks[].healthCheckRef

Optional

object

Reference to a ComputeHealthCheck resource.

healthChecks[].healthCheckRef.external

Optional

string

The URL for the health check that signals autohealing. Allowed value: The `selfLink` field of a `ComputeHealthCheck` resource.

healthChecks[].healthCheckRef.name

Optional

string

Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

healthChecks[].healthCheckRef.namespace

Optional

string

Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/

healthChecks[].httpHealthCheckRef

Optional

object

Reference to a ComputeHTTPHealthCheck resource.

healthChecks[].httpHealthCheckRef.external

Optional

string

A reference to an externally managed ComputeHTTPHealthCheck resource. Should be in the format "projects/{{projectID}}/global/httpHealthChecks/{{httpHealthCheckID}}".

healthChecks[].httpHealthCheckRef.name

Optional

string

The name of a ComputeHTTPHealthCheck resource.

healthChecks[].httpHealthCheckRef.namespace

Optional

string

The namespace of a ComputeHTTPHealthCheck resource.

iap

Optional

object

The configurations for Identity-Aware Proxy on this resource.

iap.oauth2ClientId

Optional

string

OAuth2 client ID to use for the authentication flow.

iap.oauth2ClientIdRef

Optional

object

Reference to a ComputeBackendServiceOauth2ClientId.

iap.oauth2ClientIdRef.external

Optional

string

External is the Google OAuth2 Client ID, e.g. `CLIENT_ID.apps.googleusercontent.com` matching the Cloud Asset Inventory Format.

iap.oauth2ClientIdRef.name

Optional

string

Name of the referent.

iap.oauth2ClientIdRef.namespace

Optional

string

Namespace of the referent.

iap.oauth2ClientSecret

Optional

object

OAuth2 client secret to use for the authentication flow.

iap.oauth2ClientSecret.value

Optional

string

Value of the field. Cannot be used if 'valueFrom' is specified.

iap.oauth2ClientSecret.valueFrom

Optional

object

Source for the field's value. Cannot be used if 'value' is specified.

iap.oauth2ClientSecret.valueFrom.secretKeyRef

Optional

object

Reference to a value with the given key in the given Secret in the resource's namespace.

iap.oauth2ClientSecret.valueFrom.secretKeyRef.key

Required*

string

Key that identifies the value to be extracted.

iap.oauth2ClientSecret.valueFrom.secretKeyRef.name

Required*

string

Name of the Secret to extract a value from.

iap.oauth2ClientSecretSha256

Optional

string

[Output Only] SHA256 hash value for the field oauth2_client_secret above.

loadBalancingScheme

Optional

string

Specifies the load balancer type.

localityLbPolicies

Optional

list (object)

A list of locality load-balancing policies to be used in order of preference. When you use localityLbPolicies, you must set at least one value for either the localityLbPolicies[].policy or the localityLbPolicies[].customPolicy field. localityLbPolicies overrides any value set in the localityLbPolicy field. For an example of how to use this field, see Define a list of preferred policies. Caution: This field and its children are intended for use in a service mesh that includes gRPC clients only. Envoy proxies can't use backend services that have this configuration.

localityLbPolicies[]

Optional

object

localityLbPolicies[].customPolicy

Optional

object

The configuration for a custom policy.

localityLbPolicies[].customPolicy.data

Optional

string

An optional, arbitrary JSON object with configuration data.

localityLbPolicies[].customPolicy.name

Required*

string

The name of a custom policy.

localityLbPolicies[].policy

Optional

object

The configuration for a predefined policy.

localityLbPolicies[].policy.name

Required*

string

The name of a locality load balancing policy.

localityLbPolicy

Optional

string

The load balancing algorithm used within the scope of the locality.

location

Required

string

Location of the resource.

logConfig

Optional

object

This field denotes the logging options for the load balancer traffic.

logConfig.enable

Optional

boolean

This field denotes whether to enable logging for the load balancer traffic.

logConfig.sampleRate

Optional

float

This field defines the log sampling rate.

networkRef

Optional

object

ComputeNetworkRef is a reference to a Google Cloud ComputeNetwork.

networkRef.external

Optional

string

A reference to an externally managed ComputeNetwork resource. Should be in the format "projects/{{projectID}}/global/networks/{{networkID}}".

networkRef.name

Optional

string

The name of a ComputeNetwork resource.

networkRef.namespace

Optional

string

The namespace of a ComputeNetwork resource.

outlierDetection

Optional

object

Settings controlling the ejection of unhealthy backend endpoints.

outlierDetection.baseEjectionTime

Optional

object

The base time that a host is ejected for. The real time is equal to the base ejection time multiplied by the number of times the host has been ejected.

outlierDetection.baseEjectionTime.nanos

Optional

integer

Span of time that's a fraction of a second at nanosecond resolution. Must be from 0 to 999,999,999 inclusive.

outlierDetection.baseEjectionTime.seconds

Required*

integer

Span of time at a resolution of a second. Must be from 0 to 315,576,000,000 inclusive.

outlierDetection.consecutiveErrors

Optional

integer

Number of consecutive errors before ejection.

outlierDetection.consecutiveGatewayFailure

Optional

integer

Number of consecutive gateway failures before ejection.

outlierDetection.enforcingConsecutiveErrors

Optional

integer

Percentage of consecutive errors to enforce.

outlierDetection.enforcingConsecutiveGatewayFailure

Optional

integer

Percentage of consecutive gateway failures to enforce.

outlierDetection.enforcingSuccessRate

Optional

integer

Percentage of success rate to enforce.

outlierDetection.interval

Optional

object

Time interval between ejection sweep analysis.

outlierDetection.interval.nanos

Optional

integer

Span of time that's a fraction of a second at nanosecond resolution. Must be from 0 to 999,999,999 inclusive.

outlierDetection.interval.seconds

Required*

integer

Span of time at a resolution of a second. Must be from 0 to 315,576,000,000 inclusive.

outlierDetection.maxEjectionPercent

Optional

integer

Maximum percentage of hosts that can be ejected.

outlierDetection.successRateMinimumHosts

Optional

integer

Minimum number of hosts for success rate analysis.

outlierDetection.successRateRequestVolume

Optional

integer

Minimum request volume for success rate analysis.

outlierDetection.successRateStdevFactor

Optional

integer

Standard deviation factor for success rate analysis.

portName

Optional

string

A named port on a backend instance group representing the port for communication to the backend VMs in that group. The named port must be [defined on each backend instance group](https://cloud.google.com/load-balancing/docs/backend-service#named_ports). This parameter has no meaning if the backends are NEGs. For internal passthrough Network Load Balancers and external passthrough Network Load Balancers, omit port_name.

protocol

Optional

string

The protocol this BackendService uses to communicate with backends. Possible values are HTTP, HTTPS, HTTP2, H2C, TCP, SSL, UDP or GRPC. depending on the chosen load balancer or Traffic Director configuration. Refer to the documentation for the load balancers or for Traffic Director for more information. Must be set to GRPC when the backend service is referenced by a URL map that is bound to target gRPC proxy.

resourceID

Optional

string

The ComputeBackendService name. If not given, the metadata.name will be used.

securityPolicy

Optional

string

The URL of the security policy associated with this backend service.

securityPolicyRef

Optional

object

ComputeSecurityPolicyRef is a reference to a ComputeSecurityPolicy.

securityPolicyRef.external

Optional

string

A reference to an externally managed ComputeSecurityPolicy resource. Should be in the format "projects/{{projectID}}/global/securityPolicies/{{name}}".

securityPolicyRef.name

Optional

string

The name of a ComputeSecurityPolicy resource.

securityPolicyRef.namespace

Optional

string

The namespace of a ComputeSecurityPolicy resource.

securitySettings

Optional

object

This field specifies the security settings that apply to this backend service. This field is applicable to a global backend service with the load_balancing_scheme set to INTERNAL_SELF_MANAGED.

securitySettings.clientTLSPolicyRef

Required*

object

Reference to a ComputeSecuritySettingsClientTLSPolicy.

securitySettings.clientTLSPolicyRef.external

Optional

string

External is the selfLink of the referent.

securitySettings.clientTLSPolicyRef.name

Optional

string

Name of the referent.

securitySettings.clientTLSPolicyRef.namespace

Optional

string

Namespace of the referent.

securitySettings.subjectAltNames

Required*

list (string)

Subject Alternative Names.

securitySettings.subjectAltNames[]

Required*

string

sessionAffinity

Optional

string

Type of session affinity to use. The default is NONE. Only NONE and HEADER_FIELD are supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true. For more details, see: [Session Affinity](https://cloud.google.com/load-balancing/docs/backend-service#session_affinity). sessionAffinity cannot be specified with haPolicy.

subsetting

Optional

object

subsetting cannot be specified with haPolicy.

subsetting.policy

Required*

string

The subsetting policy. The only supported policy is CONSISTENT_HASH_SUBSETTING.

timeoutSec

Optional

integer

The backend service timeout.

* Field is required when parent field is specified

Status

Schema

conditions:
- lastTransitionTime: string
  message: string
  reason: string
  status: string
  type: string
creationTimestamp: string
fingerprint: string
generatedId: integer
observedGeneration: integer
selfLink: string
Fields
conditions

list (object)

Conditions represent the latest available observations of the object'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.

creationTimestamp

string

[Output Only] Creation timestamp in RFC3339 text format.

fingerprint

string

Fingerprint of this resource. A hash of the contents stored in this object.

generatedId

integer

[Output Only] The unique identifier for the resource. This identifier is defined by the server.

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 for the resource.

Sample YAML(s)

External Load Balancing Backend Service

# Copyright 2020 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: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeBackendService
metadata:
  name: computebackendservice-sample-externalloadbalancing
spec:
  description: External backend service with cookie-based session affinity.
  portName: cookie-cloud
  timeoutSec: 30
  healthChecks:
  - healthCheckRef:
      name: computebackendservice-dep-externalloadbalancing
  loadBalancingScheme: EXTERNAL
  location: global
  protocol: HTTPS
  affinityCookieTtlSec: 360
  connectionDrainingTimeoutSec: 60
  securityPolicyRef:
    name: computebackendservice-dep-externalloadbalancing
  sessionAffinity: GENERATED_COOKIE
  customRequestHeaders:
  - "Trailer: custom-trailer"
  logConfig:
    enable: true
    sampleRate: 0.5
  backend:
  - balancingMode: RATE
    capacityScaler: 1
    description: A network endpoint group serving this backend with all its available capacity, as calculated by number of simultaneous connections.
    maxRatePerEndpoint: 10
    group:
      networkEndpointGroupRef:
        name: computebackendservice-dep-externalloadbalancing
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeHealthCheck
metadata:
  name: computebackendservice-dep-externalloadbalancing
spec:
  httpsHealthCheck:
    port: 443
  location: global
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeInstanceGroup
metadata:
  name: computebackendservice-dep-externalloadbalancing
spec:
  namedPort:
  - name: cookie-cloud
    port: 8444
  zone: us-central1-a
  networkRef:
    name: computebackendservice-dep-externalloadbalancing
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeNetwork
metadata:
  name: computebackendservice-dep-externalloadbalancing
spec:
  routingMode: GLOBAL
  autoCreateSubnetworks: false
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeNetworkEndpointGroup
metadata:
  name: computebackendservice-dep-externalloadbalancing
spec:
  networkRef:
    name: computebackendservice-dep-externalloadbalancing
  subnetworkRef:
    name: computebackendservice-dep-externalloadbalancing
  location: us-west1-a
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeSecurityPolicy
metadata:
  name: computebackendservice-dep-externalloadbalancing
spec:
  rule:
  - action: deny(403)
    priority: 2147483647
    match:
      versionedExpr: SRC_IPS_V1
      config:
        srcIpRanges:
        - "*"
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeSubnetwork
metadata:
  name: computebackendservice-dep-externalloadbalancing
spec:
  ipCidrRange: 10.2.0.0/16
  region: us-west1
  networkRef:
    name: computebackendservice-dep-externalloadbalancing

Internal Managed Load Balancing Backend Service

# Copyright 2020 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: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeBackendService
metadata:
  name: computebackendservice-sample-internalmanagedloadbalancing
spec:
  description: Internal managed backend service with Maglev session affinity.
  localityLbPolicy: MAGLEV
  timeoutSec: 86400
  consistentHash:
    httpHeaderName: "Hash_String"
  healthChecks:
  - healthCheckRef:
      name: computebackendservice-dep-internalmanagedloadbalancing
  loadBalancingScheme: INTERNAL_MANAGED
  location: us-east1
  protocol: HTTP
  connectionDrainingTimeoutSec: 10
  sessionAffinity: HEADER_FIELD
  circuitBreakers:
    connectTimeout:
      nanos: 999999999
      seconds: 0
    maxConnections: 1024
    maxPendingRequests: 1024
    maxRequests: 1024
    maxRequestsPerConnection: 1
    maxRetries: 3
  logConfig:
    enable: false
  outlierDetection:
    consecutiveGatewayFailure: 5
    enforcingConsecutiveErrors: 100
    enforcingSuccessRate: 100
    successRateMinimumHosts: 5
    successRateRequestVolume: 100
    baseEjectionTime:
      nanos: 999999999
      seconds: 29
    consecutiveErrors: 5
    enforcingConsecutiveGatewayFailure: 0
    interval:
      nanos: 999999999
      seconds: 9
    maxEjectionPercent: 10
    successRateStdevFactor: 1900
  backend:
  - balancingMode: RATE
    capacityScaler: 0.9
    description: An instance group serving this backend with 90% of its capacity, as calculated by requests per second.
    maxRate: 10000
    group:
      instanceGroupRef:
        name: computebackendservice-dep-internalmanagedloadbalancing
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeHealthCheck
metadata:
  name: computebackendservice-dep-internalmanagedloadbalancing
spec:
  httpHealthCheck:
    port: 80
  location: global
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeInstanceGroup
metadata:
  name: computebackendservice-dep-internalmanagedloadbalancing
spec:
  zone: us-east1-c
  networkRef:
    name: computebackendservice-dep-internalmanagedloadbalancing
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeNetwork
metadata:
  name: computebackendservice-dep-internalmanagedloadbalancing
spec:
  routingMode: REGIONAL
  autoCreateSubnetworks: false

Oauth2clientid Backend Service

# Copyright 2020 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: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeBackendService
metadata:
  name: computebackendservice-sample-oauth2clientid
spec:
  description: Internal managed backend service with Maglev session affinity.
  localityLbPolicy: MAGLEV
  timeoutSec: 86400
  consistentHash:
    httpHeaderName: "Hash string"
  healthChecks:
  - healthCheckRef:
      name: computebackendservice-dep-oauth2clientid
  loadBalancingScheme: INTERNAL_MANAGED
  location: us-east1
  protocol: HTTP
  connectionDrainingTimeoutSec: 10
  sessionAffinity: HEADER_FIELD
  circuitBreakers:
    connectTimeout:
      nanos: 999999999
      seconds: 0
    maxConnections: 1024
    maxPendingRequests: 1024
    maxRequests: 1024
    maxRequestsPerConnection: 1
    maxRetries: 3
  logConfig:
    enable: false
  outlierDetection:
    consecutiveGatewayFailure: 5
    enforcingConsecutiveErrors: 100
    enforcingSuccessRate: 100
    successRateMinimumHosts: 5
    successRateRequestVolume: 100
    baseEjectionTime:
      nanos: 999999999
      seconds: 29
    consecutiveErrors: 5
    enforcingConsecutiveGatewayFailure: 0
    interval:
      nanos: 999999999
      seconds: 9
    maxEjectionPercent: 10
    successRateStdevFactor: 1900
  backend:
  - balancingMode: RATE
    capacityScaler: 0.9
    description: An instance group serving this backend with 90% of its capacity, as calculated by requests per second.
    maxRate: 10000
    group:
      instanceGroupRef:
        name: computebackendservice-dep-oauth2clientid
  iap:
    oauth2ClientIdRef:
      external: computebackendservice-dep-oauth2clientid
    oauth2ClientSecret:
      value: "test-secret-value"
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeHealthCheck
metadata:
  name: computebackendservice-dep-oauth2clientid
spec:
  httpHealthCheck:
    port: 80
  location: global
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeInstanceGroup
metadata:
  name: computebackendservice-dep-oauth2clientid
spec:
  zone: us-east1-c
  networkRef:
    name: computebackendservice-dep-oauth2clientid
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeNetwork
metadata:
  name: computebackendservice-dep-oauth2clientid
spec:
  routingMode: REGIONAL
  autoCreateSubnetworks: false
---
apiVersion: iap.cnrm.cloud.google.com/v1beta1
kind: IAPBrand
metadata:
  name: computebackendservice-dep-oauth2clientid
spec:
  applicationTitle: "test brand"
  supportEmail: "support@example.com"
---
apiVersion: iap.cnrm.cloud.google.com/v1beta1
kind: IAPIdentityAwareProxyClient
metadata:
  name: computebackendservice-dep-oauth2clientid
spec:
  displayName: "Test Client"
  brandRef:
    name: computebackendservice-dep-oauth2clientid