Skip to content
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

WIP: refactor/adapters #180

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

WIP: refactor/adapters #180

wants to merge 2 commits into from

Conversation

wwmoraes
Copy link
Owner

@wwmoraes wwmoraes commented Aug 17, 2022

Changes

Added a separate tool to be used with go generate and ease adapter maintenance, namely:

  • adapter gen - zero code adapter implementation for a kubernetes resource type. The end result enables kubegraph to create nodes for the target kind with an icon, if provided. Resources with dependencies must still override the Create and/or Configure methods and implement the proper logic.
  • adapter dep - injects type aliases and a getter function to retrieve adapter instances for external kinds. This prevents circular references between adapter packages.
  • adapter scheme - imports and composes schemes with the main decoder scheme to add support for virtually any resource.

With the tool above, the adapters received the following changes:

  • most boilerplate code that was copy-pasted is now gone; it is now handled by the generator
  • basic resource types now have only the generated adapter files, as no Create/Configure is needed
  • schemes are now implemented through generated files to import and compose the scheme during runtime
  • registry now provides aliases for indirect types, so adapters don't need to import transient dependencies, such as dot and k8s API runtime.

Non-breaking

  • feat - adds functionality for the user
  • fix - fixes an issue for the user
  • docs - changes to the documentation
  • style - formatting, missing semi colons, etc
  • refactor - refactoring production code, eg. renaming a variable
  • test - adding missing tests, refactoring tests
  • chore - configuration of lint, IDE, issue template, etc

Breaking

  • feat! - adds functionality for the user, but changes existing functionality
  • fix! - fixes an issue for the user, but changes existing functionality
  • refactor! - changes that replaces existing functionality, eg. changing arity of a function
  • chore! - updating build scripts, etc

@wwmoraes wwmoraes force-pushed the refactor/adapters branch 4 times, most recently from 9d97899 to b4df69b Compare August 19, 2022 16:30
@wwmoraes wwmoraes force-pushed the refactor/adapters branch 2 times, most recently from 9f86a3a to 7acf816 Compare August 27, 2022 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant