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

doc: add action api spec #16

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 80 additions & 1 deletion doc/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,83 @@ The overall architecture of Bifrost is as follows:
![arch](./images/bifrost-arch.drawio.png)

1. The `bifrost dashboard` will communicate with the backend through a RESTful API to handle workflow management.
1. `bifrost apiserver` will offer a standard API that, when invoked, stores the workflow in the database using the `database connector`.


### Specification

#### Action specification

##### Action API specification

The API specification will follow the following demo format:
```yaml
name: NginxRoutesConfig
# It will ssh to the remote server and add the 7-layer routes into the nginx configuration file
description: Config nginx routes
image: opennaslab/nginxroutesconfig:v0.1
parameter:
in:
server:
type: string
description: The server ip address or domain address used for ssh connection
default: 127.0.0.1
required: true
serverPort:
type: int
description: The server port used for ssh connection
default: 22
required: true
routes:
type: array
description: The route list to append
required: true
items:
domain:
type: string
description: The domain name of the route
required: true
backendHost:
type: string
description: The backend ip address of the route
required: true
backendPort:
type: int
description: The backend port of the route
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the description can be written in a description file for page rendering rather than directly in yaml. This will aid the community's ability to support more languages. : )

Copy link
Contributor Author

@richardli1598 richardli1598 Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个就像CRD一样,action的接口就是返回这个的json格式,用于前端表格渲染,如果用其他文件承载,感觉意义不大。

多语言感觉可以先不考虑,太复杂了

required: true
out:
domainList:
type: array
description: The current domain route list
required: true
items:
domain:
type: string
description: The domain name of the route
required: true
backendHost:
type: string
description: The backend ip address of the route
required: true
backendPort:
type: int
description: The backend port of the route
required: true
```

* `name`: It must be a unique name in bifrost.
* `description`: The action's description.
* `image`: The docker image for the action.
* `parameter`: The action's parameter.
* `in`: The input parameter for the action.
* For a single parameter, it can be of three types: string, int, or array.
* If it is an array type, it should have an additional field called `items`, which contains detailed fields for each element in the array.
* `out`: The output parameter for the action. It follows the same specifications as the input (`in`) parameter.

##### Action implementation specification


#### Workflow API specification

#### Transmission of action information

#### Action implementation specification
Loading