Skip to content
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

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

ezr-ondrej
Copy link
Member

No description provided.

Copy link
Member

@lzap lzap left a 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}}",
Copy link
Member

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.

Copy link
Member Author

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
Copy link
Member

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.

@lzap
Copy link
Member

lzap commented Oct 10, 2023

Can you add example similarly as I did in AWS please?

@ezr-ondrej
Copy link
Member Author

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 {
Copy link
Member

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.

Suggested change
if n.NetworkIP != nil {
if n != nil && n.NetworkIP != nil {

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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:)

Copy link
Member

@lzap lzap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, @avitova?

Copy link
Member

@avitova avitova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM;)

@avitova avitova merged commit 7b4e49d into RHEnVision:main Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants