-
Notifications
You must be signed in to change notification settings - Fork 24
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
⭐️ os cloud resource for azure #5305
base: main
Are you sure you want to change the base?
Conversation
3d554d0
to
06318e7
Compare
06318e7
to
3d39678
Compare
Part 3 of #5284 This PR enables the new os resource `cloud` in Azure VMs. Signed-off-by: Salim Afiune Maya <[email protected]>
3d39678
to
bac882e
Compare
@@ -787,6 +787,9 @@ func (print *Printer) Data(typ types.Type, data interface{}, codeID string, bund | |||
return print.Secondary(data.(string)) | |||
|
|||
case types.IP: | |||
if data == nil { | |||
return print.Secondary("null") | |||
} |
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 is fixed separately here #5307
metadataIdentityScriptWindows = `Invoke-RestMethod -TimeoutSec 5 -Headers @{"Metadata"="true"} -Method GET -URI http://169.254.169.254/metadata/instance?api-version=2021-02-01 -UseBasicParsing | ConvertTo-Json` | ||
|
||
loadbalancerMetadataScriptUnix = "curl --retry 5 --retry-delay 1 --connect-timeout 1 --retry-max-time 5 --max-time 10 --noproxy '*' -H Metadata:true http://169.254.169.254/metadata/loadbalancer?api-version=2021-02-01" |
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.
can we use a newer api-version?
https://learn.microsoft.com/en-us/azure/virtual-machines/instance-metadata-service?tabs=windows#supported-api-versions
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.
Updated it ✅
We are not using version 2023-11-15 since it is still being rolled out and it may not be available in some regions. Docs: https://learn.microsoft.com/en-us/azure/virtual-machines/instance-metadata-service?tabs=windows#supported-api-versions Signed-off-by: Salim Afiune Maya <[email protected]>
0e49c08
to
8b43a91
Compare
} | ||
|
||
// AddOrUpdatePrivateIP adds or updates one or many Ipv4Addresses | ||
func (m *InstanceMetadata) AddOrUpdatePrivateIP(ips ...Ipv4Address) { |
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.
whats the use case in which we get the same ip twice so it needs to be updated? i'd expect the metadata to give us the IP addresses just once
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.
After doing extensive research, I discovered that the public IP address may come from two different endpoints within the IMDS, either the instance/
metadata or the loadbalander/
one.
So we don't know where will it come from, but we check both places looking. The question is, what do we do if it is present in both places? I say we merge the information in the best possible way, which is this implementation, but I am open to suggestions.
Part 3 of #5284
This PR enables the new os resource
cloud
in Azure VMs.How to test this change
os
provider (how? docs here)cnquery
binarycnquery shell
)cloud
resource, trycloud.provider
andcloud.instance {*}