Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
chore: Fix server list return type (#187)
Browse files Browse the repository at this point in the history
Signed-off-by: xieydd <[email protected]>
  • Loading branch information
xieydd authored Oct 10, 2023
1 parent 05da1cb commit ececa26
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 2 deletions.
90 changes: 89 additions & 1 deletion agent/pkg/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,38 @@ const docTemplate = `{
}
}
}
},
"delete": {
"description": "Delete the namespace.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"namespace"
],
"summary": "Delete the namespace.",
"parameters": [
{
"description": "Namespace name",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/types.NamespaceRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/types.NamespaceRequest"
}
}
}
}
},
"/system/scale-inference": {
Expand Down Expand Up @@ -1226,7 +1258,7 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"type": "string"
"$ref": "#/definitions/types.Server"
}
}
}
Expand Down Expand Up @@ -1531,6 +1563,31 @@ const docTemplate = `{
}
}
},
"types.NodeSystemInfo": {
"type": "object",
"properties": {
"architecture": {
"description": "The Architecture reported by the node",
"type": "string"
},
"kernelVersion": {
"description": "Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64).",
"type": "string"
},
"machineID": {
"description": "MachineID reported by the node. For unique machine identification\nin the cluster this field is preferred. Learn more from man(5)\nmachine-id: http://man7.org/linux/man-pages/man5/machine-id.5.html",
"type": "string"
},
"operatingSystem": {
"description": "The Operating System reported by the node",
"type": "string"
},
"osImage": {
"description": "OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)).",
"type": "string"
}
}
},
"types.ProviderInfo": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1567,6 +1624,9 @@ const docTemplate = `{
"types.ScaleServiceRequest": {
"type": "object",
"properties": {
"attempt": {
"type": "integer"
},
"eventMessage": {
"type": "string"
},
Expand Down Expand Up @@ -1607,6 +1667,17 @@ const docTemplate = `{
}
}
},
"types.Server": {
"type": "object",
"properties": {
"spec": {
"$ref": "#/definitions/types.ServerSpec"
},
"status": {
"$ref": "#/definitions/types.ServerStatus"
}
}
},
"types.ServerSpec": {
"type": "object",
"properties": {
Expand All @@ -1621,6 +1692,23 @@ const docTemplate = `{
}
}
},
"types.ServerStatus": {
"type": "object",
"properties": {
"allocatable": {
"$ref": "#/definitions/types.ResourceList"
},
"capacity": {
"$ref": "#/definitions/types.ResourceList"
},
"phase": {
"type": "string"
},
"system": {
"$ref": "#/definitions/types.NodeSystemInfo"
}
}
},
"types.VersionInfo": {
"type": "object",
"properties": {
Expand Down
4 changes: 3 additions & 1 deletion agent/pkg/server/handler_server_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ import (
"net/http"

"github.com/gin-gonic/gin"
"github.com/tensorchord/openmodelz/agent/api/types"
)

// @Summary List the servers.
// @Description List the servers.
// @Tags namespace
// @Accept json
// @Produce json
// @Success 200 {object} []string
// @Success 200 {object} []types.Server
// @Router /system/servers [get]
func (s *Server) handleServerList(c *gin.Context) error {
ns := []types.Server{}
ns, err := s.runtime.ServerList(c.Request.Context())
if err != nil {
return errFromErrDefs(err, "namespace-list")
Expand Down

0 comments on commit ececa26

Please sign in to comment.