Slice Workspace
A slice workspace is associated with one or more namespaces and a user.
Create a Slice Workspace
Use this API to create a slice workspace.
Method and URL
POST /api/v1/slice-workspace
Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
clusters | List of strings | The list of clusters registered with the controller. | Mandatory |
namespaces | List of strings | The list of namespaces name associated with the slice workspace. | Mandatory |
username | String | The user (team/job/project) name associated with the slice workspace. | Mandatory |
workspaceName | String | The name of the slice workspace that can be user/team /job-slice workspace/project name. | Mandatory |
String | The registered email address of the user. | Mandatory |
Example Request
POST /api/v1/slice-workspace
{
"workspaceName": "workspaceName",
"clusters": [
"cluster-name registered with EGS"
],
"namespaces": [
"namespace-name"
],
"username": "John Doe",
"email": "john.doe@avesha.io"
}
Example Responses
Response: Success
{
"statusCode": 200,
"status": "OK",
"message": "Success",
"data": {
"workspaceName": "workspace-name"
}
}
Example
curl --location --globoff '{{host}}/api/v1/slice-workspace' \
--data-raw '{
"workspaceName": "workspaceName",
"clusters": [
"worker-1"
],
"namespaces" : [
"namespace-1",
"namespace-2"
],
"username": "John Doe",
"email": "john.doe@avesha.io"
}'
Response: Already Exists
{
"statusCode": 409,
"status": "Error",
"message": "Already Exists",
"data": null,
"error": {
"errorKey": "",
"message": "Already Exists",
"data": "{\"error\":{\"Message\":\"Error registering Slice\",\"Status\":409,\"DetailedError\":{\"Errormessage\":\"sliceconfigs.controller.kubeslice.io \\\"evening\\\" already exists\",\"Reason\":\"AlreadyExists\",\"Details\":\"\"},\"StatusCode\":409,\"ReferenceDocumentation\":\"https://kubeslice.io/documentation/open-source/0.2.0/getting-started-with-cloud-clusters/installing-kubeslice/creating-a-slice\"}}"
}
}
Response: Bad Request
{
"statusCode": 422,
"status": "Error",
"message": "Bad Request",
"data": null,
"error": {
"errorKey": "",
"message": "Bad Request",
"data": "{\"error\":{\"Message\":\"Error registering Slice\",\"Status\":422,\"DetailedError\":{\"Errormessage\":\"admission webhook \\\"vsliceconfig.kb.io\\\" denied the request: SliceConfig.controller.kubeslice.io \\\"evening\\\" is invalid: Spec.NamespaceIsolationProfile.ApplicationNamespaces.Clusters: Required value: clusters\",\"Reason\":\"Invalid\",\"Details\":[{\"reason\":\"FieldValueRequired\",\"message\":\"Required value: clusters\",\"field\":\"Spec.NamespaceIsolationProfile.ApplicationNamespaces.Clusters\"}]},\"StatusCode\":422,\"ReferenceDocumentation\":\"https://kubeslice.io/documentation/open-source/0.2.0/getting-started-with-cloud-clusters/installing-kubeslice/creating-a-slice\"}}"
}
}
List Slice Workspaces
List slice workspace API returns list of workspaces and the corresponding details.
Method and URL
GET /api/v1/slice-workspace/list
Example Request
GET /api/v1/slice-workspace/list
curl --location --globoff '{{host}}/api/v1/slice-workspace/list'
Example Responses
Response: Success
{
"statusCode": 200,
"status": "OK",
"message": "Success",
"data": {
"workspaces": [
{
"name": "workspace1",
"overlayNetworkDeploymentMode": "no-network",
"maxClusters": 16,
"sliceDescription": "Created via slice workspace API",
"clusters": [
"worker-1"
],
"namespaces": [
{
"namespace": "namespace-3",
"clusters": [
"worker-1"
]
}
]
},
{
"name": "workspace2",
"overlayNetworkDeploymentMode": "no-network",
"maxClusters": 16,
"sliceDescription": "Created via slice workspace API",
"clusters": [
"worker-1"
],
"namespaces": [
{
"namespace": "namespace-1",
"clusters": [
"worker-1"
]
},
{
"namespace": "namespace-2",
"clusters": [
"worker-1"
]
}
]
}
]
}
}
Generate KubeConfig
Use this API to get the KubeConfig to access the namespaces onboarded onto a slice workspace. You can use this KubeConfig to deploy the AI workloads in the namespaces.
Method and URL
GET /api/v1/slice-workspace/kube-config
Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
workspaceName | String | The name of the slice workspace for which you want to generate KubeConfig. | Mandatory |
clusterName | String | The name of the worker cluster. | Mandatory |
Example Request
curl -X GET --location --globoff '{{host}}/api/v1/slice-workspace/kube-config' \
--data '{
"workspaceName": "<workspaceName>"
"clusterName": "<cluster-name>"
}'
Example Response
Response: Success
{
"statusCode": 200,
"status": "OK",
"message": "Success",
"data": {
"kubeConfig": "apiVersion: v1\nkind: Config\nclusters:\n - name: worker-1\n cluster:\n server: https://x.x.x.x\n certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0ttCk1JSUVMVENDQXBXZ0F3SUJBZ0lSQUptUWNiTjdRUXZzYnExR3I0MFdFNsdUFKSDF2UE40agpic3VES3BKSThqNnUyWjFBS28yemRIdTBVTjRjclFhNWs0UmxaYm15djM3Vm83RytEdGZxUEpwVGNjQVFTYkFBCm4xTExwODNYUU5jUmFPem1RSlRCWHdwbWQyUXZ2ODVWb2dvWFNGNGhCQXZCVXB4T2NVTkRycnlyUlk1VU9NUTEKb1p5RGMrRnNVaTNsak4rV2M5NmNWM2s9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K\nusers:\n - name: afternoon-workspace\n user:\n token: eyJhbGciOiJSUzI1NiIsImtpZCI6ImtsMUNpZDR5ZmlKb2dsVzVOTjFmdGN0emhKbjR2dEh5RWN2RmYtaTRNS28ifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9I6qvdkapR8_YTlugVdhdxIhrCppWhKsCeX0g3wT2tmjV90rcJXia1jejUmhfIwkxOj2R2-N57UfSB5dIb1DPZ_XX21yxJhcBua3GAe0v908wiMRTj_BlLVZyOj31d2d_0M4aQl2JCe0tUg4pL0BBEavk-cUXLHC8wOlT2BlmMqq6G1m3ZZPcrW4Eljt17OZVpGlMIjR4ZN1ag78fSFhr2trPkQNEYygIGJBI5oLDYH04SHURvJMA-LIqWodoLJq-s7uhgZFi4UfIp5m6bw2UATWt8AyffDnLww\ncontexts:\n - name: workspace1@worker-1\n context:\n cluster: worker-1\n user: workspace1\n namespace: namespace-3\ncurrent-context: afternoon-workspace@worker-1\n"
}
}
Response: Worker name is required as a query parameter
{
"statusCode": 400,
"status": "UPSTREAM_REQUEST_ERROR",
"message": "Worker name is required as a query parameter",
"data": null,
"error": {
"errorKey": "UPSTREAM_REQUEST_ERROR",
"message": "Worker name is required as a query parameter",
"data": ""
}
}
Delete a Slice Workspace
This API can be used to delete a slice workspace. The request is queued and processed by the EGS backend. Use LIST workspaces API to see the workspaces and the corresponding details.
Method and URL
DELETE /api/v1/slice-workspace
Example Request
DELETE /api/v1/slice-workspace
{
"workspaceName": "workspace-name"
}
Example Responses
Response: Success
{
"statusCode": 200,
"status": "OK",
"message": "Success",
"data": {}
}