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

[DO NOT MERGE] Translation Layer Template #1610

Closed
wants to merge 1 commit into from

Conversation

josvazg
Copy link
Collaborator

@josvazg josvazg commented May 24, 2024

This is an example template that can help understand the gist of a translation layer, or even be used as a starting point to implement a translation layer for a new resource or refactor an existing one.

Translation layer public interface:

  • An resource interface with the operations the reconciliation would need to do on the resource.
    • All arguments and return types are internal and or Kubernetes CRDs.
  • A way to create the internal version of the resource from the CRD and some attachments, like secrets, etc.
  • A way to normalize the resource internal type defined in Kubernetes to allow it to be compered with the same type converted from Atlas.
  • Optionally, the comparison function of internal resource types might also be defined in the translation layer.

Key features:

  • The translation layer completely encapsulates the Atlas API interactions:
    • No Atlas API calls are exposed elsewhere in the code.
    • No Atlas API data types are used or imported anywhere else in the code. Nothing else imports the Atlas SDK.
  • The translation layer is an internal package, not exposed to operator consumers.
    • Adding a translation layer does not affect the rest of the codebase util it is used.
  • The translation layer allows for easy Contract Testing of each of the API endpoints encapsulated.
    • This enables easy Atlas behavior verification up front, even before the reconcilation state machine is coded.
  • Other than that, unit testing of the type conversions, normalization and comparisons is also to be expected within this layer.

All Submissions:

  • Have you signed our CLA?

@josvazg josvazg marked this pull request as draft May 24, 2024 15:49
@josvazg josvazg requested a review from filipcirtog June 25, 2024 15:31
@josvazg josvazg force-pushed the translation-layer-template branch from 74092e6 to 466609c Compare July 1, 2024 16:24
@josvazg
Copy link
Collaborator Author

josvazg commented Jul 17, 2024

Do not think we need this template anymore, we already have plenty of translation layers by different author merged in.

@josvazg josvazg closed this Jul 17, 2024
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