Skip to content

Commit b756d69

Browse files
authored
Performance Improvements (#173)
* Added Source Repo Name and Control plane type vars * Updated GW CRDs to v0.5.0 Co-authored-by: Nick Eberts <[email protected]>
1 parent d85263c commit b756d69

36 files changed

+848
-292
lines changed

cli/cmd/update.go

+18
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,24 @@ var updateCmd = &cobra.Command{
4242
}
4343
lifecycle.InitTF("cluster_build")
4444
lifecycle.ApplyTF("cluster_build")
45+
46+
// Authenticate Kubernetes client-go to all clusters
47+
log.Info("☸️ Generating Kubeconfig...")
48+
kc, err := lifecycle.GenerateKubeConfig(conf)
49+
if err != nil {
50+
log.Errorf("🚨 Failed to generate kube config: %s", err)
51+
} else {
52+
log.Infof("✅ Kubeconfig generated: %+v", kc)
53+
}
54+
55+
// Verify access to Kubernetes API on all clusters
56+
log.Info("☸️ Verifying Kubernetes API access for all clusters...")
57+
err = lifecycle.ListNamespaces(kc)
58+
if err != nil {
59+
log.Errorf("🚨 Failed API access check on clusters: %s", err)
60+
} else {
61+
log.Info("✅ Clusters API access check passed.")
62+
}
4563
},
4664
}
4765

cli/pkg/cli_init/cluster_build/main.tf

+23-17
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ module "cluster_build" {
22
source = "{{.TFModuleRepo}}cluster_build?ref={{.TFModuleBranch}}"
33
project_id = var.project_id
44
governance_project_id = var.governance_project_id
5+
regional_clusters = var.regional_clusters
56
region = var.region
67
zones = var.zones
78
shared_vpc = var.shared_vpc
89
vpc_name = var.vpc_name
910
ip_range_pods_name = var.ip_range_pods_name
10-
bastion_members = var.bastion_members
11-
ip_source_ranges_ssh = var.ip_source_ranges_ssh
1211
vpc_project_id = var.vpc_project_id
1312
vpc_ip_range_pods_name = var.vpc_ip_range_pods_name
1413
vpc_ip_range_services_name = var.vpc_ip_range_services_name
@@ -22,6 +21,7 @@ module "cluster_build" {
2221
private_endpoint = var.private_endpoint
2322
auth_cidr = var.auth_cidr
2423
config_sync = var.config_sync
24+
config_sync_repo = var.config_sync_repo
2525
policy_controller = var.policy_controller
2626
config_connector = var.config_connector
2727
windows_nodepool = var.windows_nodepool
@@ -30,7 +30,7 @@ module "cluster_build" {
3030
k8s_users = var.k8s_users
3131
multi_cluster_gateway = var.multi_cluster_gateway
3232
anthos_service_mesh = var.anthos_service_mesh
33-
acm_tf_module_repo = "{{.TFModuleRepo}}acm?ref={{.TFModuleBranch}}"
33+
gke_module_bypass = var.gke_module_bypass
3434
}
3535

3636
variable "project_id" {
@@ -43,6 +43,12 @@ variable "governance_project_id" {
4343
description = "The project ID to host governance resources"
4444
}
4545

46+
variable "regional_clusters" {
47+
type = bool
48+
description = "Enable regional control plane."
49+
default = true
50+
}
51+
4652
variable "region" {
4753
type = string
4854
description = "The region to host the cluster in"
@@ -79,18 +85,6 @@ variable "ip_range_services_name" {
7985
default = "ip-range-svc"
8086
}
8187

82-
variable "bastion_members" {
83-
type = list(string)
84-
description = "List of users, groups, SAs who need access to the bastion host"
85-
default = []
86-
}
87-
88-
variable "ip_source_ranges_ssh" {
89-
type = list(string)
90-
description = "Additional source ranges to allow for ssh to bastion host. 35.235.240.0/20 allowed by default for IAP tunnel."
91-
default = []
92-
}
93-
9488
variable "vpc_project_id" {
9589
type = string
9690
description = "The Share VPC Project ID - This is optional and only valid if a Shared VPC is used"
@@ -161,6 +155,12 @@ variable "config_sync" {
161155
default = true
162156
}
163157

158+
variable "config_sync_repo" {
159+
type = string
160+
description = "Name of Cloud Source Repo for Config Sync"
161+
default = "gke-poc-config-sync"
162+
}
163+
164164
variable "policy_controller" {
165165
type = bool
166166
description = "Enable Policy Controller on all clusters."
@@ -170,7 +170,7 @@ variable "policy_controller" {
170170
variable "config_connector" {
171171
type = bool
172172
description = "(Beta) Whether ConfigConnector is enabled for this cluster."
173-
default = true
173+
default = false
174174
}
175175

176176
variable "windows_nodepool" {
@@ -207,4 +207,10 @@ variable "anthos_service_mesh" {
207207
type = bool
208208
description = "Enable Anthos Service Mesh on all clusters."
209209
default = true
210-
}
210+
}
211+
212+
variable "gke_module_bypass" {
213+
type = bool
214+
description = "Experimental: Setting this to true allows you to use the TF GKE resource directly instead of the GKE module"
215+
default = false
216+
}

cli/pkg/cli_init/samples/default-config.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,23 @@ terraformState: cloud
66
clustersProjectId: "my-project"
77
governanceProjectId: "my-project"
88
region: "us-central1"
9+
regionalClusters: true
910
enablePreemptibleNodepool: false # Enforced on Linux Node pools only
1011
enableWindowsNodepool: false
1112
privateEndpoint: false
1213
releaseChannel: REGULAR
1314
defaultNodepoolOS: cos
14-
initialNodeCount: 1
15+
initialNodeCount: 10
1516
maxNodeCount: 10
1617
minNodeCount: 1
1718
configSync: true
19+
configSyncRepo: "config-sync-repo"
1820
policyController: true
1921
multiClusterGateway: false
2022
anthosServiceMesh: false
2123
tfModuleRepo: "github.com/GoogleCloudPlatform/gke-poc-toolkit//terraform/modules/"
2224
tfModuleBranch: "main"
25+
gkeModuleBypass: false
2326
sendAnalytics: false
2427
vpcConfig:
2528
vpcName: "gke-poc-toolkit"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
terraformState: cloud # local, cloud
2+
clustersProjectId: "my-project"
3+
governanceProjectId: "my-project"
4+
regionalClusters: false # Control plane availability
5+
region: "us-east1" # Region for resources aside from GKE clusters
6+
enableWindowsNodepool: false
7+
enablePreemptibleNodepool: false # Enforced on Linux Node pools only
8+
privateEndpoint: false
9+
releaseChannel: REGULAR
10+
defaultNodepoolOS: cos
11+
initialNodeCount: 10
12+
maxNodeCount: 10
13+
minNodeCount: 1
14+
configSync: true
15+
configSyncRepo: "config-sync-repo"
16+
policyController: true
17+
multiClusterGateway: true
18+
anthosServiceMesh: true
19+
tfModuleRepo: "github.com/GoogleCloudPlatform/gke-poc-toolkit//terraform/modules/"
20+
tfModuleBranch: "main"
21+
gkeModuleBypass: true
22+
sendAnalytics: false
23+
vpcConfig:
24+
vpcName: "gke-poc-toolkit"
25+
vpcType: "standalone" # standalone, shared
26+
vpcProjectId: "my-host-project"
27+
podCIDRName: "mypodcidr"
28+
svcCIDRName: "mysvccidr"
29+
authCIDR: "0.0.0.0/0" # Change to your workstation public IP
30+
clustersConfig: # a list of one or more clusters, each with their own config
31+
- clusterName: "gke-central"
32+
machineType: "e2-standard-4"
33+
region: "us-central1"
34+
zones: ["us-central1-b"]
35+
subnetName: "us-central1"
36+
- clusterName: "gke-east"
37+
machineType: "e2-standard-4"
38+
region: "us-east1"
39+
zones: ["us-east1-b"]
40+
subnetName: "us-east1"
41+
- clusterName: "gke-west"
42+
machineType: "e2-standard-4"
43+
region: "us-west1"
44+
zones: ["us-west1-b"]
45+
subnetName: "us-west1"
46+
- clusterName: "gke-eu-north"
47+
machineType: "e2-standard-4"
48+
region: "europe-north1"
49+
zones: ["europe-north1-c"]
50+
subnetName: "europe-north1"

cli/pkg/cli_init/samples/multi-clusters-acm-shared-vpc.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
1-
# sample-config.yaml
21
terraformState: cloud # local, cloud
32
clustersProjectId: "my-project"
43
governanceProjectId: "my-project"
4+
regionalClusters: true # Control plane availability
55
region: "us-east1" # Region for resources aside from GKE clusters
66
enableWindowsNodepool: false
77
enablePreemptibleNodepool: false # Enforced on Linux Node pools only
88
privateEndpoint: false
99
releaseChannel: REGULAR
1010
defaultNodepoolOS: cos
11-
initialNodeCount: 1
11+
initialNodeCount: 10
1212
maxNodeCount: 10
1313
minNodeCount: 1
1414
configSync: true
15+
configSyncRepo: "config-sync-repo"
1516
policyController: true
1617
multiClusterGateway: false
1718
anthosServiceMesh: false
1819
tfModuleRepo: "github.com/GoogleCloudPlatform/gke-poc-toolkit//terraform/modules/"
1920
tfModuleBranch: "main"
21+
gkeModuleBypass: false
2022
sendAnalytics: false
2123
vpcConfig:
2224
vpcName: "gke-poc-toolkit"
2325
vpcType: "shared" # standalone, shared
24-
vpcProjectId: "my-host-project" # Required if you are using a sharedVPC
26+
vpcProjectId: "my-host-project"
2527
podCIDRName: "mypodcidr"
2628
svcCIDRName: "mysvccidr"
27-
authCIDR: "0.0.0.0/0" # only needed if enabling private endpoints for clusters
29+
authCIDR: "0.0.0.0/0" # Change to your workstation public IP
2830
clustersConfig: # a list of one or more clusters, each with their own config
2931
- clusterName: "gke-central"
3032
machineType: "e2-standard-4"

cli/pkg/cli_init/samples/multi-clusters-acm-standalone-vpc.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
1-
# sample-config.yaml
21
terraformState: cloud # local, cloud
32
clustersProjectId: "my-project"
43
governanceProjectId: "my-project"
4+
regionalClusters: true # Control plane availability
55
region: "us-east1" # Region for resources aside from GKE clusters
66
enableWindowsNodepool: false
77
enablePreemptibleNodepool: false # Enforced on Linux Node pools only
88
privateEndpoint: false
99
releaseChannel: REGULAR
1010
defaultNodepoolOS: cos
11-
initialNodeCount: 1
11+
initialNodeCount: 10
1212
maxNodeCount: 10
1313
minNodeCount: 1
1414
configSync: true
15+
configSyncRepo: "config-sync-repo"
1516
policyController: true
1617
multiClusterGateway: false
1718
anthosServiceMesh: false
1819
tfModuleRepo: "github.com/GoogleCloudPlatform/gke-poc-toolkit//terraform/modules/"
1920
tfModuleBranch: "main"
21+
gkeModuleBypass: false
2022
sendAnalytics: false
2123
vpcConfig:
2224
vpcName: "gke-poc-toolkit"
2325
vpcType: "standalone" # standalone, shared
24-
vpcProjectId: "my-host-project" # Required if you are using a sharedVPC
26+
vpcProjectId: "my-host-project"
2527
podCIDRName: "mypodcidr"
2628
svcCIDRName: "mysvccidr"
27-
authCIDR: "0.0.0.0/0" # only needed if enabling private endpoints for clusters
29+
authCIDR: "0.0.0.0/0" # Change to your workstation public IP
2830
clustersConfig: # a list of one or more clusters, each with their own config
2931
- clusterName: "gke-central"
3032
machineType: "e2-standard-4"

cli/pkg/cli_init/samples/multi-clusters-networking-acm-shared-vpc.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
1-
# multi-cluster.yaml
21
terraformState: cloud # local, cloud
32
clustersProjectId: "my-project"
43
governanceProjectId: "my-project"
4+
regionalClusters: true # Control plane availability
55
region: "us-east1" # Region for resources aside from GKE clusters
66
enableWindowsNodepool: false
77
enablePreemptibleNodepool: false # Enforced on Linux Node pools only
88
privateEndpoint: false
99
releaseChannel: REGULAR
1010
defaultNodepoolOS: cos
11-
initialNodeCount: 1
11+
initialNodeCount: 10
1212
maxNodeCount: 10
1313
minNodeCount: 1
1414
configSync: true
15+
configSyncRepo: "config-sync-repo"
1516
policyController: true
1617
multiClusterGateway: true
1718
anthosServiceMesh: true
1819
tfModuleRepo: "github.com/GoogleCloudPlatform/gke-poc-toolkit//terraform/modules/"
1920
tfModuleBranch: "main"
21+
gkeModuleBypass: false
2022
sendAnalytics: false
2123
vpcConfig:
2224
vpcName: "gke-poc-toolkit"
2325
vpcType: "shared" # standalone, shared
24-
vpcProjectId: "my-host-project" # Required if you are using a sharedVPC
26+
vpcProjectId: "my-host-project"
2527
podCIDRName: "mypodcidr"
2628
svcCIDRName: "mysvccidr"
27-
authCIDR: "0.0.0.0/0" # only needed if enabling private endpoints for clusters
29+
authCIDR: "0.0.0.0/0" # Change to your workstation public IP
2830
clustersConfig: # a list of one or more clusters, each with their own config
2931
- clusterName: "gke-central"
3032
machineType: "e2-standard-4"

cli/pkg/cli_init/samples/multi-clusters-networking-acm-standalone-vpc.yaml

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
1-
# sample-config.yaml
21
terraformState: cloud # local, cloud
32
clustersProjectId: "my-project"
43
governanceProjectId: "my-project"
4+
regionalClusters: true # Control plane availability
55
region: "us-east1" # Region for resources aside from GKE clusters
66
enableWindowsNodepool: false
77
enablePreemptibleNodepool: false # Enforced on Linux Node pools only
88
privateEndpoint: false
99
releaseChannel: REGULAR
1010
defaultNodepoolOS: cos
11-
initialNodeCount: 1
11+
initialNodeCount: 10
1212
maxNodeCount: 10
1313
minNodeCount: 1
1414
configSync: true
15+
configSyncRepo: "config-sync-repo"
1516
policyController: true
1617
multiClusterGateway: true
1718
anthosServiceMesh: true
1819
tfModuleRepo: "github.com/GoogleCloudPlatform/gke-poc-toolkit//terraform/modules/"
1920
tfModuleBranch: "main"
21+
gkeModuleBypass: false
2022
sendAnalytics: false
2123
vpcConfig:
2224
vpcName: "gke-poc-toolkit"
2325
vpcType: "standalone" # standalone, shared
24-
vpcProjectId: "my-host-project" # Required if you are using a sharedVPC
26+
vpcProjectId: "my-host-project"
2527
podCIDRName: "mypodcidr"
2628
svcCIDRName: "mysvccidr"
27-
authCIDR: "0.0.0.0/0" # only needed if enabling private endpoints for clusters
29+
authCIDR: "0.0.0.0/0" # Change to your workstation public IP
2830
clustersConfig: # a list of one or more clusters, each with their own config
2931
- clusterName: "gke-central"
3032
machineType: "e2-standard-4"
31-
region: "us-central1"
32-
zones: ["us-central1-a"]
33+
region: "us-central1"
34+
zones: ["us-central1-b"]
3335
subnetName: "us-central1"
3436
- clusterName: "gke-east"
3537
machineType: "e2-standard-4"

cli/pkg/cli_init/samples/multi-clusters-shared-vpc.yaml

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
1-
# sample-config.yaml
21
terraformState: cloud # local, cloud
32
clustersProjectId: "my-project"
43
governanceProjectId: "my-project"
4+
regionalClusters: true # Control plane availability
55
region: "us-east1" # Region for resources aside from GKE clusters
66
enableWindowsNodepool: false
77
enablePreemptibleNodepool: false # Enforced on Linux Node pools only
88
privateEndpoint: false
99
releaseChannel: REGULAR
1010
defaultNodepoolOS: cos
11-
initialNodeCount: 1
11+
initialNodeCount: 10
1212
maxNodeCount: 10
1313
minNodeCount: 1
14-
configSync: false
14+
configSync: true
15+
configSyncRepo: "config-sync-repo"
1516
policyController: false
1617
multiClusterGateway: false
1718
anthosServiceMesh: false
1819
tfModuleRepo: "github.com/GoogleCloudPlatform/gke-poc-toolkit//terraform/modules/"
1920
tfModuleBranch: "main"
21+
gkeModuleBypass: false
2022
sendAnalytics: false
2123
vpcConfig:
2224
vpcName: "gke-poc-toolkit"
2325
vpcType: "shared" # standalone, shared
24-
vpcProjectId: "my-host-project" # Required if you are using a sharedVPC
26+
vpcProjectId: "my-host-project"
2527
podCIDRName: "mypodcidr"
2628
svcCIDRName: "mysvccidr"
27-
authCIDR: "0.0.0.0/0" # only needed if enabling private endpoints for clusters
29+
authCIDR: "0.0.0.0/0" # Change to your workstation public IP
2830
clustersConfig: # a list of one or more clusters, each with their own config
2931
- clusterName: "gke-central"
3032
machineType: "e2-standard-4"

0 commit comments

Comments
 (0)