-
Notifications
You must be signed in to change notification settings - Fork 398
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
Migrated databricks_cluster
resource to Go SDK
#3376
Conversation
…ricks into migrate-cluster
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3376 +/- ##
==========================================
- Coverage 83.51% 82.95% -0.56%
==========================================
Files 178 178
Lines 16595 16575 -20
==========================================
- Hits 13859 13750 -109
- Misses 1891 1967 +76
- Partials 845 858 +13
|
databricks_cluster
resource to Go SDK databricks_cluster
resource to Go SDK
…ricks into migrate-cluster
…ricks into migrate-cluster
…ricks into migrate-cluster
databricks_cluster
resource to Go SDK databricks_cluster
resource to Go SDK
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.
Some comments, but otherwise looking good!
…ricks into migrate-cluster
…ricks into migrate-cluster
clusters/resource_cluster.go
Outdated
} | ||
} | ||
|
||
type LibraryList struct { |
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.
We need this type (with struct annotations) below, so we have to explicitly declare it.
var libraryList LibraryList
common.DataToStructPointer(d, clusterSchema, &libraryList)
Given it's only used in clusters and to not encourage wide use, I think we should keep it here as compared to libraries_api.
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.
cc: @miles, I am not sure if there is a better / easier way to do this, we could probably get the type from ClusterSpec.Libraries using reflection but I think having a 2 line struct would be simpler.
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 to use ClusterSpec
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.
Two very small nits, but otherwise this LGTM!
var libraryList compute.InstallLibraries | ||
common.DataToStructPointer(d, clusterSchema, &libraryList) |
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 point of adding libraries to the schema was that we don't need to call DataToStructPointer
multiple times, right?
var libraryList compute.InstallLibraries | |
common.DataToStructPointer(d, clusterSchema, &libraryList) | |
libraryList := compute.InstallLibraries{ | |
ClusterId: clusterInfo.ClusterId, | |
Libraries: cluster.Libraries, | |
} |
var libraryList ClusterSpec | ||
common.DataToStructPointer(d, clusterSchema, &libraryList) | ||
libsToInstall, libsToUninstall := libraries.GetLibrariesToInstallAndUninstall(libraryList.Libraries, libsClusterStatus) |
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 as well?
var libraryList ClusterSpec | |
common.DataToStructPointer(d, clusterSchema, &libraryList) | |
libsToInstall, libsToUninstall := libraries.GetLibrariesToInstallAndUninstall(libraryList.Libraries, libsClusterStatus) | |
libsToInstall, libsToUninstall := libraries.GetLibrariesToInstallAndUninstall(cluster.Libraries, libsClusterStatus) |
Going ahead with merge for now, need to check issues arising due to differences between ClusterSpec and other Cluster structs. |
Changes
Migrated cluster resource to Go SDK along with migrating major references of libraries api and method across clusters, jobs, exporter etc.
Note: Many resources use old clusters API, methods -- migration for these would be part of when we will be migrating those resources to Go SDK to account for resource specific OpenAPI changes, extra methods at that time like we did with the libraries resource.
Tests
Unit tests, Nightly tests are running ...
make test
run locallydocs/
folderinternal/acceptance