-
Notifications
You must be signed in to change notification settings - Fork 6
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: Added support for GCP Private Service Connect #115
Merged
Merged
Changes from 14 commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
5495ef3
feat: Added private service connect support
337accf
added feature to auto approve projects
9f4acbe
added private link support
66700f7
Merge branch 'main' into aman/issue-95
amanpruthi 1e9c925
terraform-docs: automated action
github-actions[bot] 4c8b162
fixed region
e80b4ad
terraform-docs: automated action
github-actions[bot] bdfbd83
Added var for subnets
878f158
terraform-docs: automated action
github-actions[bot] 80098c4
fixed fw
9cdb763
fixed k8s block
bf18836
Merge branch 'main' into aman/issue-95
amanpruthi 485c5e5
chnages ingress name
381eb81
added secondary ingress
72eb887
comments resolved
d26994e
comment resolved
a56e5bb
fixed ingress issue
3642f47
terraform-docs: automated action
github-actions[bot] 092cd25
added chart version in comment
cec6f05
tested chart 0.13.0
7f06a3f
fixed codebase
6c6446e
fixed psc issue
8f05908
terraform-docs: automated action
github-actions[bot] e7f08c5
Merge branch 'main' into aman/issue-95
jsbroks cfc80e6
Merge branch 'main' into aman/issue-95
jsbroks a8abcef
Merge branch 'main' into aman/issue-95
jsbroks d4a46e3
Merge branch 'main' into aman/issue-95
jsbroks 9c91f27
Merge branch 'main' into aman/issue-95
jsbroks 6e5c1ac
Merge branch 'main' into aman/issue-95
jsbroks 24d3781
Merge branch 'main' into aman/issue-95
jsbroks 3086064
Merge branch 'main' into aman/issue-95
jsbroks 812555c
Merge branch 'main' into aman/issue-95
jsbroks 08aa2fe
added timesleep
f790e96
added timesleep
fbf8e70
added timesleep
ba1c3fe
fixed tflint
2bd368c
terraform-docs: automated action
github-actions[bot] ae38e26
Merge branch 'main' into aman/issue-95
amanpruthi 0a9bee1
terraform-docs: automated action
github-actions[bot] 7e6d643
increased time sleep
248aa63
increased time sleep
37eb507
increased time sleep
0331bd5
increased time sleep
8e15c50
increased time sleep
81e0a0e
added try
12ff8af
fixed private link issue
1a4d485
fixing issue
c07f559
fixing issue
7d70eac
fixing issue
f91123b
fixing issue
c4311be
fixing issue
1c96d5e
fixing issue
c42aa3e
fixing issue
a57ef71
fixing issue
ba814a2
fixing issue
0a4c7d5
fixing issue
c1a2768
fixing issue
b673ab9
fixing issue
196b555
fixing issue
181931e
fixing issue
043cefb
fixing issue
bf5c2c3
fixing issue
d7007af
fixing issue
9f8c0b0
fixing issue
3165d29
fix
e6656c2
Fixed LB issue
d2ab582
updated logic
34795d6
updated logic
30278f8
Merge branch 'main' into aman/issue-95
amanpruthi 49d3ddc
terraform-docs: automated action
github-actions[bot] 342ca09
resolved comments
817e56e
terraform-docs: automated action
github-actions[bot] 86adab8
Merge branch 'main' into aman/issue-95
amanpruthi 4ad0735
default false private link
21fb158
terraform-docs: automated action
github-actions[bot] f9982d2
default false
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
data "kubernetes_ingress_v1" "ingress" { | ||
metadata { | ||
name = var.ingress_name | ||
} | ||
} | ||
|
||
locals { | ||
lb_name = data.kubernetes_ingress_v1.ingress.metadata[0].annotations != null ? data.kubernetes_ingress_v1.ingress.metadata[0].annotations["ingress.kubernetes.io/forwarding-rule"] : "" | ||
} | ||
|
||
resource "google_compute_service_attachment" "attachment" { | ||
amanpruthi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name = "${var.namespace}-private-link" | ||
enable_proxy_protocol = false | ||
connection_preference = "ACCEPT_MANUAL" | ||
nat_subnets = [google_compute_subnetwork.subnet.id] | ||
target_service = local.lb_name | ||
|
||
dynamic "consumer_accept_lists" { | ||
for_each = var.allowed_projects != {} ? var.allowed_projects : {} | ||
content { | ||
project_id_or_num = consumer_accept_lists.key | ||
connection_limit = consumer_accept_lists.value | ||
} | ||
} | ||
depends_on = [ data.kubernetes_ingress_v1.ingress ] | ||
} | ||
|
||
resource "google_compute_subnetwork" "subnet" { | ||
amanpruthi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name = "${var.namespace}-psc-ilb-subnet" | ||
network = var.network.id | ||
purpose = "PRIVATE_SERVICE_CONNECT" | ||
ip_cidr_range = var.psc_subnetwork | ||
} | ||
|
||
# proxy-only subnet | ||
resource "google_compute_subnetwork" "proxy_subnet" { | ||
amanpruthi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name = "${var.namespace}-proxy-subnet" | ||
provider = google-beta | ||
ip_cidr_range = var.proxynetwork_cidr | ||
purpose = "REGIONAL_MANAGED_PROXY" | ||
role = "ACTIVE" | ||
network = var.network.id | ||
} | ||
# allow all access from IAP and health check ranges | ||
resource "google_compute_firewall" "fw_iap" { | ||
name = "${var.namespace}-internal-fw" | ||
provider = google-beta | ||
direction = "INGRESS" | ||
network = var.network.id | ||
source_ranges = ["130.211.0.0/22", "35.191.0.0/16", "35.235.240.0/20"] | ||
allow { | ||
protocol = "tcp" | ||
} | ||
} | ||
|
||
# allow tcp from proxy subnet to backends | ||
resource "google_compute_firewall" "rule" { | ||
name = "${var.namespace}-fw-allow-iap-hc" | ||
provider = google-beta | ||
direction = "INGRESS" | ||
network = var.network.id | ||
source_ranges = [var.proxynetwork_cidr] | ||
allow { | ||
protocol = "tcp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "private_attachement_id" { | ||
value = google_compute_service_attachment.attachment.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
variable "namespace" { | ||
type = string | ||
description = "The name prefix for all resources created." | ||
} | ||
|
||
variable "labels" { | ||
description = "Labels which will be applied to all applicable resources." | ||
type = map(string) | ||
default = {} | ||
} | ||
|
||
variable "network" { | ||
description = "Google Compute Engine network to which the cluster is connected." | ||
type = object({ id = string }) | ||
} | ||
|
||
|
||
variable "subnetwork" { | ||
type = object({ | ||
self_link = string | ||
}) | ||
description = "The subnetwork object containing the self-link of the subnetwork." | ||
} | ||
|
||
variable "allowed_projects" { | ||
type = map(number) | ||
default = {} | ||
description = "A map of allowed projects where each key is a project number and the value is the connection limit." | ||
} | ||
|
||
variable "ingress_name" { | ||
description = "Name of the ingress resources which was created by wandb module" | ||
type = string | ||
} | ||
|
||
variable "psc_subnetwork" { | ||
type = string | ||
} | ||
variable "proxynetwork_cidr" { | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lb_name
but you are looking at the forward rulename?Is this value set by the ingress controller when provisioning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forwarding rule name is the actual load balancer name in gcp.
This is not being tested using the published helm version ... It will be tested after helm version upgrade to 0.13
https://github.com/wandb/helm-charts/pull/102/files
Although we have tested this locally by creating the ingress manually on the cluster .So the terraform code works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I approved the helm PR. I would perf not to use data type and pass in the name explicitly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So lets make sure to test it with the new helm chart before we merge it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsbroks ingress doesn't have any annotation that allows you specify the loadbalancer name that will be created by the gce controller .
And we need the name to link the internal load balancer to the private service .
Checked the code also there is no such supported annotation https://github.com/kubernetes/ingress-gce/blob/master/pkg/annotations/ingress.go