An organization network policy defines the network access control for
organization-level managed services exposed through Google Distributed Cloud (GDC) air-gapped. You can define these access controls using the
[`OrganizationNetworkPolicy`](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/apis/service/networking/v1/networking-v1.md.txt#organizationnetworkpolicy)
resource from the
[Networking API](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/apis/service/networking/networking-api-overview.md.txt).

To get the permissions you need to configure the organization network policy,
ask your IAM Org Admin to grant you the
Organization Network Policy Admin (`org-network-policy-admin`) role.

You can define an organization network policy for access controls for the
following GDC managed services:

- All services
- GDC console
- [Distributed Cloud CLI](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/resources/gdcloud-overview.md.txt)
- [Global API server](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/resources/multi-zone/api-servers.md.txt)
- [Identity and Access Management (IAM)](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform/pa-user/iam/set-up-role-bindings.md.txt)
- [Key Management Systems (KMS)](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform/pa-user/kms/kms.md.txt)
- [Object storage](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform/pa-user/storage.md.txt#object_storage)
- System Artifact Registry (SAR)
- [Vertex AI](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform/pa-user/vertex-pre-trained-apis)
  - Services within Vertex AI that a policy supports include the [Optical Character Recognition API](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/quickstart-ocr.md.txt), [Speech-to-Text API](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/quickstart-stt.md.txt), [Translation API](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/quickstart-translation.md.txt), and [Workbench](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/vertex-ai-workbench-intro.md.txt).
- [Virtual Machine Management (VMM)](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/vms/vm-introduction.md.txt)

## Default policy

By default, the following GDC managed services have
the following principles:

| GDC service | Principle |
|---|---|
| All services | `allow-all` |
| GDC console | `allow-all` |
| gdcloud CLI | `allow-all` |
| Global API server | `deny-by-default` |
| IAM | `deny-by-default` |
| KMS | `deny-by-default` |
| Object storage | `deny-by-default` |
| SAR | `allow-all` |
| Vertex AI and supported services | `deny-by-default` |
| VMM | `deny-by-default` |

## Example organization network policy

The following is an example of an `OrganizationNetworkPolicy` resource that
allows traffic from an IP address to access a GDC
managed service.

```bash
kubectl --kubeconfig MANAGEMENT_API_SERVER apply -f - <<EOF
apiVersion: networking.gdc.goog/v1
kind: OrganizationNetworkPolicy
metadata:
  name: POLICY_NAME
  namespace: platform
spec:
  subject:
    services:
      matchTypes:
      - "SERVICE_NAME"
  ingress:
    - from:
      - ipBlock:
          cidr: CIDR
      - ipBlock:
          cidr: CIDR
EOF
```

Replace the following variables:

| Variable | Description |
|---|---|
| <var translate="no">MANAGEMENT_API_SERVER</var> | The zonal API server's kubeconfig path. If you have not yet generated a kubeconfig file for the API server in your targeted zone, see [Sign in](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform/pa-user/iam/sign-in.md.txt#cli) for details. |
| <var translate="no">POLICY_NAME</var> | The name to give the policy. For example, `allow-ui-access`. |
| <var translate="no">SERVICE_NAME</var> | The name of the service to apply the policy. Use the following values for each service: - **All services** : `all` - **GDC console** : `ui-console` - **gdcloud CLI** : `api-server` - **Global API server** : `global-api-server` - **IAM** : `iam` - **KMS** : `kms` - **Object storage** : `object-storage` - **SAR** : `system-artifact-registry` - **Vertex AI** : `ai` - **VMM** : `vmm` |
| <var translate="no">CIDR</var> | The IP address range in CIDR notation from which to allow access, such as `10.251.0.0/24`. You can add multiple `ipBlock` entries to allow access from multiple ranges. |