Skip to content

PTEUDO-2363: Implement AWS provider #407

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

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

PTEUDO-2363: Implement AWS provider #407

wants to merge 26 commits into from

Conversation

bfabricio
Copy link
Contributor

@bfabricio bfabricio commented Feb 27, 2025

tl;dr:

While this may seem like a medium refactor, the core change is simply moving awsprovider.go behind the new provider interface, with some improvements in the code flow.

Design decisions:

  • The provider package is responsible for provisioning databases using a given provider (crossplane aws, crossplane gcp, cloudnative-pg). It remains independent of the controller logic, ensuring a clear separation of concerns. The provider implementations should stay clean, avoiding passing references to DatabaseClaim or other internal controller details.
  • Dependency injection is used to connect the provider with the controller reconciler.
  • Feature toggling: Decommissioning the old logic is optional. The new provider can be enabled behind a feature flag for safety. Once all providers are implemented, we can fully remove the old logic.
  • The overall structure remains similar to what we had, with adjustments to simplify and improve testability.

Testing:

This refactor significantly improves test coverage. Since the provider logic is now decoupled from the reconciler, we can move from almost 0% unit test coverage to full testability of interactions with Crossplane or other providers. Also, we can mock the provider in DatabaseClaimReconciler tests to precisely validate what is being passed.

Along with increased unit test coverage we must ensure the crossplane aws resource creation/update behavior remains unchanged, that can be done trough regression.

Missing:

  • We have some provider operational tagging code which is deeply entangled with the controller reconciler logic. The code seems to be pretty simple, we tag decommissioned databases with were migrated with operational-status: inactive
  • Finish unit tests, discuss more complex test scenarios

@bfabricio bfabricio added the WIP label Feb 27, 2025
@bfabricio bfabricio changed the title PTEUDO-2363 PTEUDO-2363: Implement AWS provider Mar 6, 2025
@bfabricio bfabricio marked this pull request as ready for review March 6, 2025 20:06
@bfabricio bfabricio removed the WIP label Mar 6, 2025
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.

3 participants