Skip to content

Commit

Permalink
feat(HMS-2439): Add private IP address in Azure details
Browse files Browse the repository at this point in the history
Fetch Azure private IP address as well as public one.
  • Loading branch information
ezr-ondrej committed Oct 10, 2023
1 parent 12d1ae5 commit 59180a8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/openapi.gen.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"instances": [
{
"detail": {
"privateipv4": "",
"privateipv4": "172.22.0.1",
"privateipv6": "",
"publicdns": "",
"publicipv4": "10.0.0.88"
Expand Down
2 changes: 1 addition & 1 deletion api/openapi.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ components:
instance_size: Basic_A0
instances:
- detail:
privateipv4: ""
privateipv4: 172.22.0.1
privateipv6: ""
publicdns: ""
publicipv4: 10.0.0.88
Expand Down
5 changes: 3 additions & 2 deletions cmd/spec/example_reservation.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ var AzureReservationResponsePayloadDoneExample = payloads.AzureReservationRespon
Instances: []payloads.InstanceResponse{{
InstanceID: "/subscriptions/4b9d213f-712f-4d17-a483-8a10bbe9df3a/resourceGroups/redhat-deployed/providers/Microsoft.Compute/images/composer-api-92ea98f8-7697-472e-80b1-7454fa0e7fa7",
Detail: models.ReservationInstanceDetail{
PublicDNS: "",
PublicIPv4: "10.0.0.88",
PublicDNS: "",
PublicIPv4: "10.0.0.88",
PrivateIPv4: "172.22.0.1",
},
}},
}
Expand Down
5 changes: 5 additions & 0 deletions internal/clients/http/azure/create_vms.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ func (c *client) CreateVMs(ctx context.Context, vmParams clients.AzureInstancePa
}

vmDescriptions[i].IPv4 = *publicIP.Properties.IPAddress
// can be nil if IPv6 is default in the future
privateIPv4 := networkInterface.Properties.IPConfigurations[0].Properties.PrivateIPAddress
if privateIPv4 != nil {
vmDescriptions[i].PrivateIPv4 = *privateIPv4
}

resumeTokens[i], err = c.BeginCreateVM(ctx, networkInterface, vmParams, vmName)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion internal/jobs/launch_instance_azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ func DoLaunchInstanceAzure(ctx context.Context, args *LaunchInstanceAzureTaskArg
ReservationID: args.ReservationID,
InstanceID: instanceDescription.ID,
Detail: models.ReservationInstanceDetail{
PublicIPv4: instanceDescription.IPv4,
PublicIPv4: instanceDescription.IPv4,
PrivateIPv4: instanceDescription.PrivateIPv4,
},
})
if err != nil {
Expand Down

0 comments on commit 59180a8

Please sign in to comment.