-
Notifications
You must be signed in to change notification settings - Fork 1k
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(aws): Improving AWS EC2 instance types API integration and caching, feat(aws): Adding archi type to images API and caching #5609
feat(aws): Improving AWS EC2 instance types API integration and caching, feat(aws): Adding archi type to images API and caching #5609
Conversation
Reviewers, please also review the |
Haven't had a chance to look at the code yet, but for the release note - not everybody deploys Spinnaker using Halyard. Are there instructions for other installation methods (i.e. what is that flag actually doing?) |
Thanks for the callout @mattgogerly. That is where I need help :) |
feat(aws): Adding archi type to images API and caching spinnaker/spinnaker#5989
7a4cbbb
to
bfa9ce6
Compare
...rc/main/groovy/com/netflix/spinnaker/clouddriver/aws/provider/agent/ImageCachingAgent.groovy
Show resolved
Hide resolved
All I can find is that it wipes the Redis instance, but that would only work if you're using the built in Redis. Why is it necessary to do that? |
attributes.put("account", account.getName()); | ||
attributes.put("region", region); | ||
attributes.put("name", i.getInstanceType()); | ||
attributes.put("defaultVCpus", i.getVCpuInfo().getDefaultVCpus()); |
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 .getVCpuInfo()
or getMemoryInfo()
ever return null
? There's a null
check for getInstanceStorageInfo()
below so wanted to be sure these were different.
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.
getVCpuInfo()
and getMemoryInfo()
can never be null. getInstanceStorageInfo()
can return null for instance types that don't support instance storage, and support EBS-only for example. Here are some examples - https://aws.amazon.com/ec2/instance-types/
} | ||
|
||
if (i.getNetworkInfo() != null) { | ||
attributes.put("ipv6Supported", i.getNetworkInfo().getIpv6Supported()); |
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.
Would it be better to have this attribute not be optional? It's always a bit clunky consuming these values from the map when you have to do something like if (attributes.get("key") != null && attributes.get("key") == true)
or equivalent.
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.
The i
- InstanceTypeInfo here is a result object returned from the AWS API DescribeInstanceTypes
and networkInfo
is an optional parameter. Also, not all instance types support IPv6, hence, the null check. Hope this adds clarification.
@mattgogerly |
Does the cache not get updated by normal clouddriver caching? The equivalent to the hal command for SQL/non-Halyard would be to wipe the database, at least of AWS data, which isn't ideal operationally. |
Gotcha! That doesn't sound ideal. As part of testing these changes, I couldn't see the new cache fields without flushing caches in my setup. Any ideas on how to confirm if flushing caches can be avoided? I will try a few things on my setup and update here. |
I was able to verify in my setup that flushing caches is required in order to see the changes to the cached data. May be that is too extreme? Do you know if there is a softer option like a refresh? Will reach on Slack again to see if anyone has a solution - https://spinnakerteam.slack.com/archives/C091CCWRJ/p1649183109750109 Without running |
7073938
to
1d3b82e
Compare
Hm, that seems weird (or a bug?) Tagging @german-muzquiz who might be more familiar with cache data schema updates |
I'm not too familiar with the AWS provider, but as a general principle the cache in clouddriver should be able to automatically rebuild itself if the underlying datastore is deleted (sql or redis), which according to the comments is working fine. Then what I'm hearing is that the cache for instance types only gets populated once and then never gets updated. Probably that was expected in the beginning since instance types is not something that changes regularly, but then I think ideally this PR needs to automatically refresh that cache. If there are no caching agents for instance types, maybe refresh it upon startup or use something like |
Thanks for the pointer @german-muzquiz. I will dig into this further and get back to you. |
@german-muzquiz Within images API, there are 2 kinds: My observations:
Some questions we need help with:
|
@pdk27 I don't see anything wrong in the code leading to the issue of the architecture not showing up in My suggestion is to investigate as follows:
Where you replace {account} and {image name} for their respective values.
The best approach is to not having to delete the cache (redis or sql) in order for this change to work, because the images cache is rebuilt every 30 seconds anyway. |
Apologies for the delay following-up on this. @mattgogerly @dbyron-sf I tried the instructions provided by @german-muzquiz and it worked. i.e. I didn't need to flush infrastructure caches to see the architecture type in response. There is no other pending action from my side. Can you please help me identify the right reviewers for this PR? |
...ava/com/netflix/spinnaker/clouddriver/aws/provider/agent/AmazonInstanceTypeCachingAgent.java
Outdated
Show resolved
Hide resolved
...ava/com/netflix/spinnaker/clouddriver/aws/provider/agent/AmazonInstanceTypeCachingAgent.java
Outdated
Show resolved
Hide resolved
Here is a demo of the testing done: Spinnaker-imagesApi-demo-reduced.mov |
@dbyron-sf ✅ Updated release preview PR. |
Changes:
Clouddriver API response before-after:
Before:
After:
Use cases / reasoning for the changes:
See draft PR and demo in Improvements to AMI and instance type validations, custom instance type selector deck#9793
Instructions to be included in release (preview) notes:
As part of upgrading to a Spinnaker version that includes these changes, repopulate caches by runninghal deploy apply --flush-infrastructure-caches
.See feat(aws): Improving AWS EC2 instance types API integration and caching, feat(aws): Adding archi type to images API and caching #5609 (comment)