Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(multitenant): enforce private cluster control plane ip address #214

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions 2-multitenant/modules/env_baseline/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ module "gke-standard" {
]

// Private Cluster Configuration
enable_private_nodes = true
enable_private_nodes = true
enable_private_endpoint = true

deletion_protection = false # set to true to prevent the module from deleting the cluster on destroy
}
Expand Down Expand Up @@ -220,7 +221,8 @@ module "gke-autopilot" {
]

// Private Cluster Configuration
enable_private_nodes = true
enable_private_nodes = true
enable_private_endpoint = true

deletion_protection = false # set to true to prevent the module from deleting the cluster on destroy
}
4 changes: 4 additions & 0 deletions test/integration/multitenant/multitenant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ func TestMultitenant(t *testing.T) {
clusterName := regexp.MustCompile(`\/clusters\/([^\/]*)$`).FindStringSubmatch(membershipOp.Get("endpoint.gkeCluster.resourceLink").String())[1]
clusterOp := gcloud.Runf(t, "container clusters describe %s --location %s --project %s", clusterName, clusterLocation, clusterProjectID)

// Extract enablePrivateEndpoint flag value
enablePrivateEndpoint := clusterOp.Get("privateClusterConfig.enablePrivateEndpoint").Bool()
apeabody marked this conversation as resolved.
Show resolved Hide resolved
assert.True(enablePrivateEndpoint, "The cluster external endpoint must be disabled.")
caetano-colin marked this conversation as resolved.
Show resolved Hide resolved

// Validate if all nodes inside node pool does not contain an external NAT IP address
nodePoolName := clusterOp.Get("nodePools.0.name").String()
nodeInstances := gcloud.Runf(t, "compute instances list --filter=\"labels.goog-k8s-node-pool-name=%s\" --project=%s", nodePoolName, clusterProjectID).Array()
Expand Down