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
Refactor Azure provider into pkg/cloud/azure #1869
Refactor Azure provider into pkg/cloud/azure #1869
Conversation
fc463e2
to
b08186f
Compare
@Sean-Holcomb @Pokom does this relate to #1787 and #1788? |
@mattray this is a follow up from our discussion here: #1842 (review) |
Oh darn, I hadn't seen that PR - I'm going to look through it now and see if I can harmonise this more. |
Ok - it looks like @Pokom and I took very similar approaches, so the PRs are pretty compatible. The differences as I see them:
What do people think? |
49df404
to
586d33b
Compare
I ended up keeping the name utils since |
@babbageclunk sorry for the delay here, was on vacation last week! My apologies for not taking better notes and dropping them into #1787 after meeting with @Sean-Holcomb, but the short of it was the refactor was welcomed but likely too large and would require a lot of testing on the kubecost team to see through. In general, we agreed upon the overall structure that both of our PR's happened to land upon. I'd love to see this PR work its way through and be the foundation for our to refactor the remaining cloud packages. I can take a deeper look at your PR over the week, however your summary is pretty spot on. Here's my attempt to respond to each of your points:
Love the contribution and I think it addresses a common challenge folks have. Really cool to see us both land on similar implementations 😉 |
8ea06f1
to
0c2f7c6
Compare
This is a first step to enable moving providers into their own packages - it avoids dependency cycles such as: pkg/cloud.GetProvider -> pkg/cloud/azure.Azure -> pkg/cloud.CustomPricing Signed-off-by: Christian Muirhead <christian.muirhead@microsoft.com>
This required moving a few more things into the shared pkg/cloud/types package. Potentially it should be renamed to pkg/cloud/base? Signed-off-by: Christian Muirhead <christian.muirhead@microsoft.com>
Now they're not in a package named azurepricesheet, the names for Downloader and NewClient were too vague. Also the type parameter on Downloader was a trick to avoid a circular dependency on the type in pkg/cloud, but since everything's in pkg/cloud/azure we don't need it anymore. Signed-off-by: Christian Muirhead <christian.muirhead@microsoft.com>
Signed-off-by: Christian Muirhead <christian.muirhead@microsoft.com>
We needed to use the unreleased version because the price sheet download operation was returning a completed status that wasn't supported by the poller in 1.4.1. Signed-off-by: Christian Muirhead <christian.muirhead@microsoft.com>
0c2f7c6
to
17ca618
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.
These Changes look good, lets get you guys unblocked
Following the move by Azure folks to refactor the azure module in opencost#1869, I am refactoring AWS and GCP into their own dedicated folders. This was for the most part straight forward. The one caveat is that the customprovider had hard dependencies on AWS resources. This didn't feel right to me, so instead of the two sharing certain structs, I opted to copy over the pvKey implementation to customprovider and a regex.
Following the move by Azure folks to refactor the azure module in opencost#1869, I am refactoring AWS and GCP into their own dedicated folders. This was for the most part straight forward. The one caveat is that the customprovider had hard dependencies on AWS resources. This didn't feel right to me, so instead of the two sharing certain structs, I opted to copy over the pvKey implementation to customprovider and a regex. Signed-off-by: pokom <mark.poko@grafana.com>
Following the move by Azure folks to refactor the azure module in opencost#1869, I am refactoring AWS and GCP into their own dedicated folders. This was for the most part straight forward. The one caveat is that the customprovider had hard dependencies on AWS resources. This didn't feel right to me, so instead of the two sharing certain structs, I opted to copy over the pvKey implementation to customprovider and a regex.
Following the move by Azure folks to refactor the azure module in opencost#1869, I am refactoring AWS and GCP into their own dedicated folders. This was for the most part straight forward. The one caveat is that the customprovider had hard dependencies on AWS resources. This didn't feel right to me, so instead of the two sharing certain structs, I opted to copy over the pvKey implementation to customprovider and a regex. Signed-off-by: pokom <mark.poko@grafana.com>
Following the move by Azure folks to refactor the azure module in opencost#1869, I am refactoring AWS and GCP into their own dedicated folders. This was for the most part straight forward. The one caveat is that the customprovider had hard dependencies on AWS resources. This didn't feel right to me, so instead of the two sharing certain structs, I opted to copy over the pvKey implementation to customprovider and a regex. Signed-off-by: pokom <mark.poko@grafana.com>
What does this PR change?
It combines the Azure cloud provider and
pkg/cloud/azurepricesheet
into one more-coherentpkg/cloud/azure
package. To avoid circular imports betweenpkg/cloud
andpkg/cloud/azure
the core types shared between the providers have been pulled out intopkg/cloud/models
.The type parameter on
pkg/cloud/azurepricesheet.Downloader
was a workaround to avoid an import cycle as well, so it's been removed frompkg/cloud/azure.PriceSheetDownloader
.Does this PR relate to any other PRs?
How will this PR impact users?
Does this PR address any GitHub or Zendesk issues?
How was this PR tested?
Does this PR require changes to documentation?
Have you labeled this PR and its corresponding Issue as "next release" if it should be part of the next Opencost release? If not, why not?