ansible / pinakes

Apache License 2.0
18 stars 2 forks source link

Remove Inventory refresh for on-premise #18

Open Ladas opened 3 years ago

Ladas commented 3 years ago

Description

Remove Inventory refresh for on-premise to get better UX

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

We can add Inventory class in backend, that will call Controller directly (having the proxy class, so we can write different adapter for the cloud version).

Or we can call Controller API directly from the UI, with configuration that would point to a different service for cloud version we'd build a service that responds to the Controller API queries we're using)

Adding product to portfolios would cache the templates to local DB as id/name/description. (so it's taggable)

List of current catalog API calls to see which would be replaced by calling Controller API:

  1. Add product to portfolio

    • list available job templates: use paginated Controller API and cache job templates picked by user locally
  2. Order product ...

Related PRs

Add PRs here when ready

Possible issues

We'd still need Inventory refresh at least for cleanup? So deleting/archiving products when the job templates get deleted on Controller side?

Ladas commented 3 years ago

Review what Controller API calls are being done and which needs to be fully cached locally:

from original doc: https://docs.google.com/document/d/1hm1yNAP-IMGkJBMVh8cfnuh5av45xOxGG8oyuOTqSzg/edit?ts=60e5b970

Workflow Job Templates | ServiceOffering | /api/v2/wokflow_job_templates

used for:

  1. List which product to add to portfolio

Can be taken directly form Controller API and cached upon adding into portfolio (id, name, description)

  1. Template can be changed/deleted so there needs to be background worker syncing this

Survey Spec(Job Template) | ServicePlan | /api/v2/job_templates/nnn/survey_spec

used for:

  1. Rendered before ordering product. Can be fetched dynamically from Tower?
  2. Survey can be changed, so there needs to be background worker fetching new versions (although this can be done dynamically when ordering? )

Survey Spec (Workflow Job Template) | ServicePlan | /api/v2/workflow_job_templates/nnn/survey_spec

(same as Job template)

Job | ServiceInstance | /api/v2/jobs/nnn

uUsed for:

  1. Id obtained upon ordering and cached there. Then we can just cache the job was finished and obtain details from Controller API?

Workflow Job | ServiceInstance | /api/v2/workflow_jobs/nnn

same as Job

Inventories | ServiceInventory | /api/v2/inventories

used for: Tagging. We can call Controller API directly and just store tags locally? (just with inventory id?

Credentials | ServiceCredential | /api/v2/credentials

used for: ?

Credential Types | ServiceCredentialType | /api/v2/credential_types

used for: ?

Workflow Nodes | ServiceOfferingNode | /api/v2/workflow_job_templates/nnn/workflow_nodes

used for:

  1. Fetching nested inventories

can be dropped entirely if tower exposes associated inventories https://github.com/ansible/awx/issues/10603

mkanoor commented 3 years ago

The Credentials and Credential Types are left over from the CloudForms inventory collection process they have never been used and can be dropped. When doing live fetch if multiple users are interacting with the UI would they all be making separate Tower calls. This would increase the traffic to the tower.