Skip to content

Break down the Custom Resource Adapter

Summary

We can break down gitlab.CustomResourceAdapter into two separate interfaces to distinguish between "generic" and "specific" parts.

The generic part is anything that can be associated to any Custom Resource and not just GitLab. This includes Custom Resource wrapping, and access to the value bindings.

The specific part is anything that is directly related to a GitLab resource, for example ChartVersion, IsUpgrade, etc. This still needs to be an interface despite the fact that it is specific. This will contain the CRD version changes. More of GitLab resource specific operations can be pulled into this interface (or more interfaces), for example IsXyzEnabled helpers. This interface embeds the generic interface.

Acceptance criteria

  • Factor out the generic aspects of gitlab.CustomResourceAdapter into another interface(s).
  • Factor out the specific aspects of gitlab.CustomResourceAdapter into another interface, e.g. GitLabWrapper.
  • Refactor NewCustomResourceAdapter.
  • Change all the references to gitlab.CustomResourceAdapter and replace them with new interfaces.
  • Relocate the "generic" interface(s) to /pkg directory under adapter package.
  • Relocate the "specific" interface(s) and builder function(s) to /internal directory under adapter package.
Edited by Hossein Pursultani