-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add NetworkConfig and NetworkConfigs to TPU v2 QueuedResource #12482
Open
zeleena
wants to merge
4
commits into
GoogleCloudPlatform:main
Choose a base branch
from
zeleena:qr-network-configs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3e0b1f2
Add NetworkConfig and NetworkConfigs to TPU v2 QueuedResource
zeleena d2cd2e2
Remove default_from_api from queue_count
zeleena bd5cc82
Add dedicated array field network_configs test
zeleena d0f8e46
Update mmv1/templates/terraform/examples/tpu_v2_queued_resource_netwo…
zeleena 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
44 changes: 44 additions & 0 deletions
44
mmv1/templates/terraform/examples/tpu_v2_queued_resource_full.tf.tmpl
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,44 @@ | ||
resource "google_tpu_v2_queued_resource" "{{$.PrimaryResourceId}}" { | ||
provider = google-beta | ||
|
||
name = "{{index $.Vars "qr_name"}}" | ||
zone = "us-central1-c" | ||
project = "{{index $.TestEnvVars "project"}}" | ||
|
||
tpu { | ||
node_spec { | ||
parent = "projects/{{index $.TestEnvVars "project"}}/locations/us-central1-c" | ||
node_id = "{{index $.Vars "tpu_name"}}" | ||
node { | ||
runtime_version = "tpu-vm-tf-2.13.0" | ||
accelerator_type = "v2-8" | ||
description = "Text description of the TPU." | ||
|
||
network_config { | ||
can_ip_forward = true | ||
enable_external_ips = true | ||
network = google_compute_network.network.id | ||
subnetwork = google_compute_subnetwork.subnet.id | ||
queue_count = 32 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
resource "google_compute_subnetwork" "subnet" { | ||
provider = google-beta | ||
|
||
name = "{{index $.Vars "subnet_name"}}" | ||
ip_cidr_range = "10.0.0.0/16" | ||
region = "us-central1" | ||
network = google_compute_network.network.id | ||
} | ||
|
||
resource "google_compute_network" "network" { | ||
provider = google-beta | ||
|
||
name = "{{index $.Vars "network_name"}}" | ||
auto_create_subnetworks = false | ||
} | ||
|
67 changes: 67 additions & 0 deletions
67
mmv1/templates/terraform/examples/tpu_v2_queued_resource_network_configs.tf.tmpl
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,67 @@ | ||
resource "google_tpu_v2_queued_resource" "{{$.PrimaryResourceId}}" { | ||
provider = google-beta | ||
|
||
name = "{{index $.Vars "qr_name"}}" | ||
zone = "us-central1-c" | ||
project = "{{index $.TestEnvVars "project"}}" | ||
|
||
tpu { | ||
node_spec { | ||
parent = "projects/{{index $.TestEnvVars "project"}}/locations/us-central1-c" | ||
node_id = "{{index $.Vars "tpu_name"}}" | ||
node { | ||
runtime_version = "tpu-vm-tf-2.13.0" | ||
accelerator_type = "v2-8" | ||
|
||
network_configs = [ | ||
{ | ||
can_ip_forward = true | ||
enable_external_ips = true | ||
network = google_compute_network.network_0.id | ||
subnetwork = google_compute_subnetwork.subnet_0.id | ||
queue_count = 32 | ||
}, | ||
{ | ||
can_ip_forward = true | ||
enable_external_ips = true | ||
network = google_compute_network.network_1.id | ||
subnetwork = google_compute_subnetwork.subnet_1.id | ||
queue_count = 32 | ||
} | ||
] | ||
zeleena marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
} | ||
} | ||
|
||
resource "google_compute_subnetwork" "subnet_0" { | ||
provider = google-beta | ||
|
||
name = "{{index $.Vars "subnet_name"}}-0" | ||
ip_cidr_range = "10.0.0.0/16" | ||
region = "us-central1" | ||
network = google_compute_network.network_0.id | ||
} | ||
|
||
resource "google_compute_network" "network_0" { | ||
provider = google-beta | ||
|
||
name = "{{index $.Vars "network_name"}}-0" | ||
auto_create_subnetworks = false | ||
} | ||
|
||
resource "google_compute_subnetwork" "subnet_1" { | ||
provider = google-beta | ||
|
||
name = "{{index $.Vars "subnet_name"}}-1" | ||
ip_cidr_range = "10.1.0.0/16" | ||
region = "us-central1" | ||
network = google_compute_network.network_1.id | ||
} | ||
|
||
resource "google_compute_network" "network_1" { | ||
provider = google-beta | ||
|
||
name = "{{index $.Vars "network_name"}}-1" | ||
auto_create_subnetworks = false | ||
} |
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.
default_from_api has a couple drawbacks:
I just want to double-check that this field (and the rest marked with default_from_api) don't have other options?
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.
Thanks for highlighting. The
network
andsubnetwork
fields do get a default value from the API if not set. Consequently, those are subfields ofnetworkConfig
, which has subfields where some have API defaults and some do not, so I setnetworkConfig
to get its default from the API so that its subfields likenetwork
andsubnetwork
can get these default values. This is also the case for a similar resource TPUv2 VM, wherenetworkConfig
hasdefault_from_api: true
and has been working as expected.I double checked
queueCount
and that does not get a default value from the TPU API, so I removeddefault_from_api
from thequeueCount
subfield here and below.