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

Allow developers to run esi-leap without keystone #159

Open
larsks opened this issue Jun 26, 2024 · 0 comments · May be fixed by #162
Open

Allow developers to run esi-leap without keystone #159

larsks opened this issue Jun 26, 2024 · 0 comments · May be fixed by #162
Assignees

Comments

@larsks
Copy link
Member

larsks commented Jun 26, 2024

It would be incredibly convenient for development purposes if it were possible to run the esi-leap service without requiring a keystone instance. Unfortunately, the existing implementation is strongly coupled to keystone. Solving this dependency issue is trickier than it needs to be due to some previous design decisions:

  1. esi_leap/api/controllers/v1/utils.py has a bunch of standalone functions that should be instance methods.

    • offer_get_dict_with_added_info should be part of OffersController.

    • lease_get_dict_with_added_info should be part of LeasesController

    Because these functions are not part of their respective class instance, it is effectively impossible to modify their behavior through configuration at runtime.

  2. Several of the existing controllers make calls directly to the esp_leap.common.keystone module.

The path forward is to replace this strong coupling with dependency injection. In particular, the controller classes should receive an IDP implementation object when they are instantiated, and use that for obtaining necessary metadata. That is, instead of call keystone.get_project_list(), we should have a base IDP interface like this:

class BaseIDP(abc.ABC):
  def get_project_list():
    ...

  def get_project_name(self, id, project_list=None):
    ...

  def get_project_uuid(project_ident):
    ...

Then we should implement a KeystoneIDP class that implements this interface; for normal production use we would pass that into the controllers.

For development use, we would have something like a StaticIDP that would take a project id, name, etc from a section in the esi-leap.conf file.

In addition to make development much more convenient, this also makes testing easier: it is no longer necessary to mock out keystone-related functions; we can instead just pass in a test-specific IDP class that always returns known values.

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 a pull request may close this issue.

2 participants