# ComputeRegionNetworkEndpointGroup

| **Property** | **Value** |
|---|---|
| Google Cloud Service Name | Compute Engine |
| Google Cloud Service Documentation | [/compute/docs/](https://docs.cloud.google.com/compute/docs) |
| Google Cloud REST Resource Name | beta.regionNetworkEndpointGroups |
| Google Cloud REST Resource Documentation | <https://docs.cloud.google.com/compute/docs/reference/rest/beta/regionNetworkEndpointGroups> |
| Config Connector Resource Short Names | computeregionnetworkendpointgroup gcpcomputeregionnetworkendpointgroup gcpcomputeregionnetworkendpointgroups |
| Config Connector Service Name | compute.googleapis.com |
| Config Connector Resource Fully Qualified Name | computeregionnetworkendpointgroups.compute.cnrm.cloud.google.com |
| Can Be Referenced by IAMPolicy/IAMPolicyMember | No |
| Config Connector Default Average Reconcile Interval In Seconds | 600 |

## Custom Resource Definition Properties

### Annotations

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

### Spec

#### Schema

    cloudFunction:
      functionRef:
        external: string
        name: string
        namespace: string
      urlMask: string
    cloudRun:
      serviceRef:
        external: string
        name: string
        namespace: string
      tag: string
      urlMask: string
    description: string
    networkEndpointType: string
    networkRef:
      external: string
      name: string
      namespace: string
    pscTargetService: string
    region: string
    resourceID: string
    subnetworkRef:
      external: string
      name: string
      namespace: string

| Fields ||
|---|---|
| `cloudFunction` *Optional* | `object` Immutable. Only valid when networkEndpointType is "SERVERLESS". Only one of cloud_run, app_engine, cloud_function or serverless_deployment may be set. |
| `cloudFunction.functionRef` *Optional* | `object` Immutable. A user-defined name of the Cloud Function. The function name is case-sensitive and must be 1-63 characters long. Example value: "func1". |
| `cloudFunction.functionRef.external` *Optional* | `string` Allowed value: The \`name\` field of a \`CloudFunctionsFunction\` resource. |
| `cloudFunction.functionRef.name` *Optional* | `string` Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names |
| `cloudFunction.functionRef.namespace` *Optional* | `string` Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ |
| `cloudFunction.urlMask` *Optional* | `string` Immutable. A template to parse function field from a request URL. URL mask allows for routing to multiple Cloud Functions without having to create multiple Network Endpoint Groups and backend services. For example, request URLs "mydomain.com/function1" and "mydomain.com/function2" can be backed by the same Serverless NEG with URL mask "/". The URL mask will parse them to { function = "function1" } and { function = "function2" } respectively. |
| `cloudRun` *Optional* | `object` Immutable. Only valid when networkEndpointType is "SERVERLESS". Only one of cloud_run, app_engine, cloud_function or serverless_deployment may be set. |
| `cloudRun.serviceRef` *Optional* | `object` Immutable. Cloud Run service is the main resource of Cloud Run. The service must be 1-63 characters long, and comply with RFC1035. Example value: "run-service". |
| `cloudRun.serviceRef.external` *Optional* | `string` Allowed value: The \`name\` field of a \`RunService\` resource. |
| `cloudRun.serviceRef.name` *Optional* | `string` Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names |
| `cloudRun.serviceRef.namespace` *Optional* | `string` Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ |
| `cloudRun.tag` *Optional* | `string` Immutable. Cloud Run tag represents the "named-revision" to provide additional fine-grained traffic routing information. The tag must be 1-63 characters long, and comply with RFC1035. Example value: "revision-0010". |
| `cloudRun.urlMask` *Optional* | `string` Immutable. A template to parse service and tag fields from a request URL. URL mask allows for routing to multiple Run services without having to create multiple network endpoint groups and backend services. For example, request URLs "foo1.domain.com/bar1" and "foo1.domain.com/bar2" an be backed by the same Serverless Network Endpoint Group (NEG) with URL mask ".domain.com/". The URL mask will parse them to { service="bar1", tag="foo1" } and { service="bar2", tag="foo2" } respectively. |
| `description` *Optional* | `string` Immutable. An optional description of this resource. Provide this property when you create the resource. |
| `networkEndpointType` *Optional* | `string` Immutable. Type of network endpoints in this network endpoint group. Defaults to SERVERLESS Default value: "SERVERLESS" Possible values: \["SERVERLESS", "PRIVATE_SERVICE_CONNECT"\]. |
| `networkRef` *Optional* | `object` Immutable. This field is only used for PSC. The URL of the network to which all network endpoints in the NEG belong. Uses "default" project network if unspecified. |
| `networkRef.external` *Optional* | `string` Allowed value: The \`selfLink\` field of a \`ComputeNetwork\` resource. |
| `networkRef.name` *Optional* | `string` Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names |
| `networkRef.namespace` *Optional* | `string` Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ |
| `pscTargetService` *Optional* | `string` Immutable. The target service url used to set up private service connection to a Google API or a PSC Producer Service Attachment. |
| `region` *Required* | `string` Immutable. A reference to the region where the Serverless NEGs Reside. |
| `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. |
| `subnetworkRef` *Optional* | `object` Immutable. This field is only used for PSC. Optional URL of the subnetwork to which all network endpoints in the NEG belong. |
| `subnetworkRef.external` *Optional* | `string` Allowed value: The \`selfLink\` field of a \`ComputeSubnetwork\` resource. |
| `subnetworkRef.name` *Optional* | `string` Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names |
| `subnetworkRef.namespace` *Optional* | `string` Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ |

### Status

#### Schema

    conditions:
    - lastTransitionTime: string
      message: string
      reason: string
      status: string
      type: string
    observedGeneration: integer
    selfLink: 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. |
| `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` <br /> |

## Sample YAML(s)

### Cloud Function Region Network Endpoint Group

    # 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: ComputeRegionNetworkEndpointGroup
    metadata:
      name: computeregionnetworkendpointgroup-sample-cloudfunction
    spec:
      region: us-west1
      description: A sample regional network endpoint group.
      cloudFunction:
        functionRef:
          external: computeregionnetworkendpointgroup-dep-cloudfunction
    ---
    apiVersion: cloudfunctions.cnrm.cloud.google.com/v1beta1
    kind: CloudFunctionsFunction
    metadata:
      name: computeregionnetworkendpointgroup-dep-cloudfunction
    spec:
      projectRef:
        # Replace ${PROJECT_ID?} with your project ID
        external: "projects/${PROJECT_ID?}"
      region: us-west1
      runtime: "nodejs10"
      sourceArchiveUrl: "gs://config-connector-samples/cloudfunctionsfunction/http_trigger.zip"
      entryPoint: "helloGET"
      httpsTrigger:
        securityLevel: "SECURE_OPTIONAL"

### Cloud Run Region Network Endpoint Group

    # 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: ComputeRegionNetworkEndpointGroup
    metadata:
      name: computeregionnetworkendpointgroup-sample-cloudrun
    spec:
      region: us-west1
      description: A sample regional network endpoint group.
      cloudRun:
        serviceRef:
          external: computeregionnetworkendpointgroup-dep-cloudrun
    ---
    apiVersion: run.cnrm.cloud.google.com/v1beta1
    kind: RunService
    metadata:
      name: computeregionnetworkendpointgroup-dep-cloudrun
    spec:
      ingress: "INGRESS_TRAFFIC_ALL"
      launchStage: "GA"
      location: us-west1
      projectRef:
        # Replace ${PROJECT_ID?} with your project ID.
        external: projects/${PROJECT_ID?}
      template:
        containers:
          - env:
              - name: "FOO"
                value: "bar"
            image: "gcr.io/cloudrun/hello"
        scaling:
          maxInstanceCount: 2
      traffic:
        - percent: 100
          type: "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"

### Private Service Connection Region Network Endpoint Group

    # 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.

    # Caution: There is a known issue when deleting all resources in this sample
    # in parallel. If you see deletion errors, try waiting to delete the
    # ComputeServiceAttachment resource until the
    # ComputeRegionNetworkEndpointGroup resource is fully deleted.
    apiVersion: compute.cnrm.cloud.google.com/v1beta1
    kind: ComputeRegionNetworkEndpointGroup
    metadata:
      name: computeregionnetworkendpointgroup-sample-psc
      annotations:
        # Replace ${PROJECT_ID?} with your project ID
        cnrm.cloud.google.com/project-id: ${PROJECT_ID?}
    spec:
      region: us-west3
      networkEndpointType: PRIVATE_SERVICE_CONNECT
      pscTargetService: https://www.googleapis.com/compute/v1/projects/${PROJECT_ID?}/regions/us-west3/serviceAttachments/computeregionnetworkendpointgroup-dep-psc
      networkRef:
        name: computeregionnetworkendpointgroup-dep-psc
      subnetworkRef:
        name: computeregionnetworkendpointgroup-dep2-psc
    ---
    apiVersion: compute.cnrm.cloud.google.com/v1beta1
    kind: ComputeBackendService
    metadata:
      name: computeregionnetworkendpointgroup-dep-psc
      annotations:
        # Replace ${PROJECT_ID?} with your project ID
        cnrm.cloud.google.com/project-id: ${PROJECT_ID?}
    spec:
      location: us-west3
      networkRef:
        name: computeregionnetworkendpointgroup-dep-psc
      loadBalancingScheme: INTERNAL
    ---
    apiVersion: compute.cnrm.cloud.google.com/v1beta1
    kind: ComputeForwardingRule
    metadata:
      name: computeregionnetworkendpointgroup-dep-psc
      annotations:
        # Replace ${PROJECT_ID?} with your project ID
        cnrm.cloud.google.com/project-id: ${PROJECT_ID?}
    spec:
      location: us-west3
      networkRef:
        name: computeregionnetworkendpointgroup-dep-psc
      subnetworkRef:
        name: computeregionnetworkendpointgroup-dep2-psc
      loadBalancingScheme: INTERNAL
      backendServiceRef:
        name: computeregionnetworkendpointgroup-dep-psc
      networkTier: PREMIUM
      allPorts: true
    ---
    apiVersion: compute.cnrm.cloud.google.com/v1beta1
    kind: ComputeNetwork
    metadata:
      name: computeregionnetworkendpointgroup-dep-psc
      annotations:
        # Replace ${PROJECT_ID?} with your project ID
        cnrm.cloud.google.com/project-id: ${PROJECT_ID?}
    spec:
      routingMode: REGIONAL
      autoCreateSubnetworks: false
    ---
    apiVersion: compute.cnrm.cloud.google.com/v1beta1
    kind: ComputeServiceAttachment
    metadata:
      name: computeregionnetworkendpointgroup-dep-psc
    spec:
      projectRef:
         # Replace ${PROJECT_ID?} with your project ID
         external: "projects/${PROJECT_ID?}"
      location: us-west3
      description: A sample service attachment
      targetServiceRef:
        name: computeregionnetworkendpointgroup-dep-psc
      connectionPreference: ACCEPT_AUTOMATIC
      natSubnets:
        - name: computeregionnetworkendpointgroup-dep1-psc
      enableProxyProtocol: false
    ---
    apiVersion: compute.cnrm.cloud.google.com/v1beta1
    kind: ComputeSubnetwork
    metadata:
      name: computeregionnetworkendpointgroup-dep1-psc
      annotations:
        # Replace ${PROJECT_ID?} with your project ID
        cnrm.cloud.google.com/project-id: ${PROJECT_ID?}
    spec:
      region: us-west3
      ipCidrRange: 10.180.0.0/10
      networkRef:
        name: computeregionnetworkendpointgroup-dep-psc
      purpose: PRIVATE_SERVICE_CONNECT
    ---
    apiVersion: compute.cnrm.cloud.google.com/v1beta1
    kind: ComputeSubnetwork
    metadata:
      name: computeregionnetworkendpointgroup-dep2-psc
      annotations:
        # Replace ${PROJECT_ID?} with your project ID
        cnrm.cloud.google.com/project-id: ${PROJECT_ID?}
    spec:
      ipCidrRange: 10.180.0.0/20
      region: us-west3
      networkRef:
        name: computeregionnetworkendpointgroup-dep-psc

> [!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).