diff --git a/AGENTS.md b/AGENTS.md index 7aa7643c..4057712a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -36,7 +36,7 @@ Folders relative to the root of the repository for each service: | Runner | runner | | LogCollector | logcollector | -## Examples +## Function Examples ### Router @@ -74,6 +74,10 @@ Folders relative to the root of the repository for each service: - `runner/component/service.go` implements runner component to trigger deploy process by call knative api. - `docker/spaces/builder/Dockerfile*` are Dockerfile that builds the space image. +### Cluster + +- `component/cluster.go` is a component that deals with cluster-related business logic. + ## Code Style & Conventions: - Each layer's interface should only expose data structures defined within its own layer or common type definitions from the common.types package. For example, interfaces in the Component layer (such as UserComponent) should not return data structures from the underlying database layer (such as database.User structure), as the database layer is considered lower-level than the component layer. diff --git a/common/types/cluster.go b/common/types/cluster.go index 61b58b54..c08ed1bc 100644 --- a/common/types/cluster.go +++ b/common/types/cluster.go @@ -65,6 +65,7 @@ type DeployRes struct { Status string `json:"status"` TotalTimeInMin int `json:"total_time_in_min"` TotalFeeInCents int `json:"total_fee_in_cents"` + SvcName string `json:"svc_name"` // service name of the deployment, used for inference endpoint } type NodeResourceInfo struct { diff --git a/component/cluster.go b/component/cluster.go index 1101b98e..98f00eb1 100644 --- a/component/cluster.go +++ b/component/cluster.go @@ -221,6 +221,7 @@ func (c *clusterComponentImpl) GetDeploys(ctx context.Context, req types.DeployR Resource: deploy.Hardware, TotalTimeInMin: totalTime, TotalFeeInCents: totalFee, + SvcName: deploy.SvcName, }) } return res, total, nil diff --git a/component/cluster_test.go b/component/cluster_test.go index 4eb36d1d..7505d14a 100644 --- a/component/cluster_test.go +++ b/component/cluster_test.go @@ -164,6 +164,7 @@ func TestClusterComponent_GetDeploys(t *testing.T) { require.Equal(t, "cpu=2,memory=4Gi", res[0].Resource) require.Equal(t, 200, res[0].TotalTimeInMin) require.Equal(t, 123, res[0].TotalFeeInCents) + require.Equal(t, "service-1", res[0].SvcName) } func TestClusterComponent_GetClusterByID(t *testing.T) {