You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "damondouglas (via GitHub)" <gi...@apache.org> on 2023/03/10 17:09:04 UTC

[GitHub] [beam] damondouglas commented on a diff in pull request #25686: Infrastructure-as-Code to provision a private GKE autopilot kubernetes cluster and strimzi kafka

damondouglas commented on code in PR #25686:
URL: https://github.com/apache/beam/pull/25686#discussion_r1132635366


##########
.test-infra/terraform/google-cloud-platform/google-kubernetes-engine/modules/02-network/network.tf:
##########
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+// Provision virtual custom 02-network
+resource "google_compute_network" "default" {
+  depends_on              = [google_project_service.compute]
+  name                    = var.network_base_name
+  auto_create_subnetworks = false
+}
+
+// Provision subnetwork of the virtual custom 02-network
+resource "google_compute_subnetwork" "default" {
+  name                     = google_compute_network.default.name
+  ip_cidr_range            = var.subnetwork_cidr_range
+  network                  = google_compute_network.default.name
+  private_ip_google_access = true
+  region                   = var.region
+}
+
+// Provision firewall rule for internal 02-network traffic only
+resource "google_compute_firewall" "default" {
+  name    = "allow-${google_compute_network.default.name}-internal"
+  network = google_compute_network.default.name
+
+  allow {
+    protocol = "tcp"
+  }
+
+  source_service_accounts = [
+    var.kubernetes_node_service_account.email

Review Comment:
   FYI, this may be too stringent of a firewall when attempting to connect from someone's local machine.  In a future PR, I may want to test whether impersonating this service account would allow someone to connect from their local machine.  Nontheless, I was able to read from and write to kafka deployed on a k8s cluster in this network within a Dataflow worker in the same.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org