open-horizon / anax

Horizon agent control system
https://open-horizon.github.io/docs/anax/docs/
Apache License 2.0
72 stars 98 forks source link

Provide Agbot APIs to list compatible nodes for given constrains or patterns #3918

Open LiilyZhang opened 10 months ago

LiilyZhang commented 10 months ago

Add 2 APIs to return compatible nodes in given org:

  1. given constrains, return list of nodes. GET /compatibility/constraints/node?policyType={policyType} (policy type could be: nmp or dp) Input body:

    {
    "node_org":  "userdev",
    "constraints": [
         "node.owner == user123 && cpu > 200",
         "purpose == test",
         ...
    ]
    }

    Check the node property based on the policy type

  2. given list of patterns (GET /compatibility/patterns/node) Input body:

    {
    "node_org":  "userdev",
    "patterns": [
        "userdev/pattern1",
        "publicOrg/pattern1",
        ...
    
    ]
    }

User experience:

  1. root or hub admin: can get results
  2. org admin: (check against the node org) can get results
  3. regular user: receive 403. Org admin of a different org will be treated as regular user in the org that he doesn't have admin privileged.
  4. node: receive 403