-
Notifications
You must be signed in to change notification settings - Fork 22
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(HMS-2440): private IPv4 address for GCP #704
Conversation
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.
Other than that, LGTM.
@@ -10,7 +10,6 @@ X-Rh-Identity: {{identity}} | |||
"image_id": "https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/images/rhel-9-v20230411", | |||
"amount": 1, | |||
"machine_type": "e2-micro", | |||
"launch_template_id": "{{launch_template_id}}", |
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.
Intentional? Just checking, might be useful.
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.
Just removed for testing, commited by mistake, thanks for catching that! 🧡
@@ -316,6 +316,7 @@ func (c *gcpClient) GetInstanceDescriptionByID(ctx context.Context, id, zone str | |||
instanceId := strconv.FormatUint(instance.GetId(), 10) | |||
instanceDesc := clients.InstanceDescription{ID: instanceId} | |||
for _, n := range instance.NetworkInterfaces { | |||
instanceDesc.PrivateIPv4 = *n.NetworkIP |
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.
Similarly, I would perhaps check for nil unless there is a documentation remark somewhere that this is never unallocated pointer.
Can you add example similarly as I did in AWS please? |
bbadddc
to
0edc54c
Compare
I've added example and check for nil pointers :) |
@@ -316,6 +316,9 @@ func (c *gcpClient) GetInstanceDescriptionByID(ctx context.Context, id, zone str | |||
instanceId := strconv.FormatUint(instance.GetId(), 10) | |||
instanceDesc := clients.InstanceDescription{ID: instanceId} | |||
for _, n := range instance.NetworkInterfaces { | |||
if n.NetworkIP != nil { |
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 suggest to even check for n != nil, but I do not know what documentation says.
if n.NetworkIP != nil { | |
if n != nil && n.NetworkIP != nil { |
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.
It is rare to put nil
into slice/map I would not worry too much about thi.
We have a ptr.FromOrEmpty
generic helper, can you use that instead?
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've used the generic helper, but did not fix the range, I guess it'd be very weird to have nil in an array.
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.
Yeah, this was just a suggestion, we do not have to check necessarily:)
0edc54c
to
37b3c99
Compare
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 agree, @avitova?
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.
LGTM;)
No description provided.