solutions/gke/configconnector/gke-cluster-autopilot/host-project/subnet.yaml (24 lines of code) (raw):

# Copyright 2021 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. ######### # subnet has : # - logging enabled for flow logs https://cloud.google.com/vpc/docs/using-flow-logs # - private google access enabled https://cloud.google.com/vpc/docs/private-google-access ######### # AC-4, AC-4(21) - GKE Subnet that has private google access enabled and flow logs enabled # AU-12 - Enable Logging for subnet # IA-3(3) - IP space is assigned for dynamic allocation # Private Google Access allows to access external IP address of Google apis and services in a secured way # Flow logs on subnet captures all traffic for a subnet and publishes to cloud logging apiVersion: compute.cnrm.cloud.google.com/v1beta1 kind: ComputeSubnetwork metadata: name: project-id-cluster-name-snet # kpt-set: ${project-id}-${cluster-name}-snet annotations: cnrm.cloud.google.com/project-id: host-project-id # kpt-set: ${host-project-id} spec: resourceID: project-id-cluster-name-snet # kpt-set: ${project-id}-${cluster-name}-snet # IA-3(3) ipCidrRange: 10.1.32.0/24 # kpt-set: ${subnet-primary-cidr} # Notes about secondary ranges # You can create 30 secondary ranges in a given subnet. For each cluster, you need two secondary ranges: one for Pods and one for Services. # Note: The primary range and the Pod secondary range can be shared between clusters, but this is not a recommended configuration # https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-shared-vpc#notes_about_secondary_ranges # IA-3(3) secondaryIpRange: - ipCidrRange: 10.1.33.0/24 # kpt-set: ${subnet-services-cidr} rangeName: servicesrange - ipCidrRange: 172.16.0.0/23 # kpt-set: ${subnet-pod-cidr} rangeName: podrange region: northamerica-northeast1 # kpt-set: ${location} description: GKE Subnet privateIpGoogleAccess: true networkRef: name: host-project-id-global-network-connectivity-profile-vpc # kpt-set: ${host-project-id}-global-${network-connectivity-profile}-vpc namespace: client-name-networking # kpt-set: ${client-name}-networking # AU-12 logConfig: aggregationInterval: INTERVAL_5_SEC flowSampling: 0.5 metadata: INCLUDE_ALL_METADATA