-
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
Enable TPUs to use Shared VPC #3939
Merged
megan07
merged 10 commits into
GoogleCloudPlatform:master
from
borg-land:tpu-shared-vpc
Sep 17, 2020
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
71c3aeb
Merge pull request #1 from GoogleCloudPlatform/master
upodroid e1a9488
Merge branch 'master' of github.com:GoogleCloudPlatform/magic-modules
upodroid 51eaff6
Merge branch 'master' of github.com:GoogleCloudPlatform/magic-modules
upodroid 6e215bc
add support for shared vpc
upodroid 60d3923
make cidr_block computable
upodroid a781e7b
add diffsuppression
upodroid 8a2eadf
tweak diffsupression to ignore when network has a change
upodroid 72e2f5b
rework diffsupress
upodroid 7a99ede
add customizediff
upodroid 5df6e20
switch the diff checks
upodroid 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
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.
This seems to be overwriting the
network
block from line 36, and also, I don't think we want to always suppress this diff. What if the intent is to change the network, I don't think it'd recognize the change.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.
I thought it was suppressing the values the api returns from get call in the Read function.
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.
Reworked it to check for a change in network.
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.
I'm not sure this will make a huge difference, because if the user really wants to change the network, this will prevent them from doing so. I wonder if we could maybe do a diffsuppress that would parse the network and see if the only difference is the project and then check that the project number is the correct project number? Does that make sense? It's a little hacky, but would be the workaround until the upstream issue was solved.
Also, I think we want to use the
diff_suppress_func
from line 38 above rather than creating a newnetwork
block here. Then, in the new diff suppress func that you're implementing, make sure you include the same logic that is incompareSelfLinkOrResourceName
so we don't lose that as well. Does that make sense?Let me know if you have questions.
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.
Have a look my last commit. How do I get the
*Config
in to the diffsupress function? I'm using other functions that expect the config block as arguments.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.
Hi @upodroid! What a finicky issue! I spent my morning looking into how we can do this. Although diff suppress would be ideal, it looks like we can't use it here. If we want access to
config
we'll have to use aCustomizeDiff
.Basically what I did in the CustomizeDiff was get the
old
(value using project number) andnew
(value using project name) values, used regex to find the submatch for project. Then called out to the projects API using the project name and if the returnedproject.Number
was the same as the project number, then i did adiff.SetNew(old)
. Does that make sense? So basically if they're the same project, we're just going to set it to use the project number so there is no diff.Let me know if you have questions! Thanks again!!
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.
I amended it to use CustomizeDiff now but i'm still getting diffs.
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.
nvm. It is ready to go.