-
Notifications
You must be signed in to change notification settings - Fork 47
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
adopt internal/ layout structure #106
Comments
This PR moves Config struct and related code to `internal/config`. It's part of breakdown of the refactor to `internal/`. Part of #106
This PR is part of a refactoring effort (#106). It moves some helper code to another internal subpackage.
Are we ready to close this issue or should it remain open until all resources are fully migrated into internal? I have created another issue to track resources migration to framework where we force move them to internal during migration #612 |
Moving to internal/ could be done ahead of Framework migration which can be trickier. I think we should leave this open until the resources are moved to internal and the teams supporting this work should take this step before Framework migration. |
…#700) This updates the `metal_virtual_circuit` resource and data source to use `equinix-sdk-go` instead of `packngo`. As mentioned in #402, the `packngo` SDK has been deprecated, and moving to `equinix-sdk-go` makes it possible for these resources to gain new features in the future. As an added bonus, the affected code has also been moved to `internal/resources/metal` to align with #106.
This PR moves the helper functions from provider.go to a new comparisons package. This package will be used by provider, tests, and resources. The refactoring will assist with splitting resources into resource specific packages. #106 The previous helper functions have been deprecated and will be removed in a future commit. Extracted from #622 (PR grew to large to maintain. Refactoring is not a priority and rebasing gets hard as the underlying code changes) Related to #674 Related to #654 Signed-off-by: Marques Johansson <[email protected]>
This moves the device resource and data sources out of the `equinix` package and into an isolated directory & package to align with #106.
To ensure that we continue to make progress on #106, this updates the `Validate PR` GitHub Actions Workflow to check if new Go files have been added to the `equinix/` directory. The workflow only checks for [files with `"added"` status](https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests-files) that are directly under the `equinix/` directory. This leaves room for renaming/copying files and for adding new packages in `equinix/<subdirectory>/`.
The number of files in
equinix/
has been expanding with recent additions. The developer experience can be improved by compartmentalizing resources into an alternate structure. This practice has become more popular in the past year or so.Proposed structure:
equinix/provider.go
By maintaining the "provider" package, downstream tooling such as Pulumi, Kubeform, Crossplane, and the OpenShift IPI driver (under development, paused) may continue to import the project
internal/services/metal/device/schema.go
This would combine all schemas into a single file.
This is a pattern found in Kubebuilder
{resourcename}_types.go
files for a single resource. In Kubebuilder all resources reside in their own file, packaged by API version.Crossplane follows a similar pattern with an extra service path (https://github.com/crossplane-contrib/provider-tf-equinix-metal/tree/main/apis/connection/v1alpha1). An interesting distinction about Crossplane's pattern is that the schema symbols are exported. This may be a requirement for some downstream tooling (I haven't researched or identified this).
internal/services/metal/device/resource.go
internal/services/metal/device/datasource.go
internal/services/networkedge/device/resource.go
internal/migrationtool/
_test.go
for each fileConsiderations:
equinix/
is a breaking change from a Go and user perspective. I believe we can safely assert from the aforementioned consumers, that most if not all Go consumers are interested in theProvider
type, and nothing else.Inspiration:
internal/services
pattern could be useful in the Equinix provider to keep service implementation code away from, migration tool code, for example.)The text was updated successfully, but these errors were encountered: