...
Code Block |
---|
language | js |
---|
title | Logical Cloud Creation API |
---|
|
URL: /v2/projects/<project-name>/logical-clouds
POST BODY:
{
"metadata" : {
"name": "lc-1", //unique name for the record
"logical-cloud-name" : "logical-cloud-1",
"namespace" : "ns-1", // one namespace per logical cloud
"description": "logical cloud for walmart finance department", //description for the logical cloud
"useruserData1" :"<user {data>",
"user-nameuserData2" : :"<user data>"
},
"spec" : {
"namespace" : "ns-1", // one namespace per logical cloud
"user" : {
"user-name" : "user-1", //name of user for this cloud (username and logical cloud name would be used as subject for the user key)
"type" : "certificate", //type of authentication credentials used by user (certificate, Token, UNPW)
"user-permissions" : [
{ "permission-name" : "permission-1",
"apiGroups" : ["stable.example.com"],
"resources" : ["secrets", "pods"],
"verbs" : ["get", "watch", "list", "create"]
},
{ "permission-name" : "permission-2",
"apiGroups" : [""],
"resources" : ["configmaps"],
"verbs" : ["*"]
}
]
}
}
}
Return Status: 201
Return Body:
{
"name" : "logical-cloud-1",
"logical-cloud-name" : "logical-cloud-1",
"namespace" : "ns-1",
"user-name" : "user-1"
} |
...
- cluster CA and cluster CRT will be gotten when a cluster is registered and this will be used to create the user crt after the user csr and user key are created
Kubeconfig will be generated for the logical cloudput in the mongoDB
2. Get Logical Cloud kubeconfig
...
Code Block |
---|
language | js |
---|
title | PUT Logical Cloud |
---|
|
URL: /v2/projects/<project-name>/logical-clouds/<name>
PUT BODY:
{
"logical-cloud-namemetadata" : "logical-cloud-1",
"namespace" : "ns-1", // one namespace per logical cloud
{
"description": "logical cloud for walmart finance department", //description for the logical cloud
"useruserData1" :"<user {data>",
"user-nameuserData2" :"<user data>"user-1",
//name of user for this cloud
"type },
"spec" : {
"namespace" : "certificatens-1", //type ofone authenticationnamespace credentialsper used by user (certificate, Token, UNPW)
"user-permissionslogical cloud
"user" : [{
{ "permissionuser-name" : "permissionuser-1",
//name of user for this cloud (username and logical cloud name would "apiGroups"be : ["stable.example.com"],
used as subject for the user key)
"resourcestype" : ["secretscertificate", "pods"],
//type of authentication credentials used by "verbs" : ["get", "watch", "list", "create"]user (certificate, Token, UNPW)
"user-permissions" : },[
{ "permission-name" : "permission-21",
"apiGroups" : ["stable.example.com"],
"resources" : ["secrets", "configmapspods"],
"verbs" : ["*"get", "watch", "list", "create"]
},
]
}
}
Return Status: 200 (OK)
Return Body:
{
"{ "permission-name" : "logicalpermission-cloud-12",
"logical-cloud-nameapiGroups" : ["logical-cloud-1"],
"namespaceresources" : ["ns-1configmaps"],
"user" : "user-1"
}
|
4. POST (Associate cluster with logical cloud )
Code Block |
---|
language | js |
---|
title | Associate logical cloud with cluster |
---|
|
URL: /v2/projects/<project-name>/logical-clouds/<logical-cloud-name>/cluster-references/
POST BODY:
{
"name": "cluster-reference-1", //cluster reference record
"description" : "edge a cluster", //cluster description
"cluster-name" : "cluster-1" //Name of the cluster
} "verbs" : ["*"]
}
]
}
}
}
Return Status: 200 (OK)
Return Body:
{
"name" : "clusterlogical-referencecloud-1",
"clusterlogical-cloud-name" : "clusterlogical-cloud-1"
}
,
"namespace" : "ns-1",
"user" : "user-1"
}
|
4. POST (Associate cluster with logical cloud )5. GET Logical Cloud
Code Block |
---|
language | js |
---|
title | GET Logical Cloud | Associate logical cloud with cluster |
---|
|
GET
URL: /v2/projects/<project-name>/logical-clouds/<name>
RESPONSE/<logical-cloud-name>/cluster-references/
POST BODY:
{
"logical-cloud-namemetadata" : "logical-cloud-1",{
"namespacename" : "nscluster-reference-1", //cluster one namespace per logical cloudreference record
"description" : "logicaledge cloud for walmart finance departmenta cluster", //cluster description for the logical cloud
"user"
},
spec : {
"usercluster-name" : "usercluster-1", //nameName of userthe for this cloud
"typecluster
}
}
Return Status: 200 (OK)
Return Body:
{
"name" : "certificate", //type of authentication credentials used by user (certificate, Token, UNPW)cluster-reference-1",
"usercluster-permissionsname" : "cluster-1"
}
|
5. GET Logical Cloud
Code Block |
---|
language | js |
---|
title | GET Logical Cloud |
---|
|
GET
URL: /v2/projects/<project-name>/logical-clouds/<name>
RESPONSE BODY:
{
"logical-cloud[
{ "permission-name" : "permissionlogical-cloud-1",
"namespace" : "ns-1", // one namespace per logical cloud
"apiGroupsdescription" : ["stable.example.com"],
"logical cloud for walmart finance department", //description for the logical cloud
"user" : {
"resourcesuser-name" : ["secretsuser-1", "pods"],
//name of user for this cloud
"verbstype" : ["get", "watch", "list", "create"]certificate", //type of authentication credentials used by user (certificate, Token, UNPW)
"user-permissions" : [
{ "permission-name" : "permission-1",
"apiGroups" : ["stable.example.com"],
"resources" : ["secrets", "pods"],
"verbs" : ["get", "watch", "list", "create"]
},
{ "permission-name" : "permission-2",
"apiGroups" : [""],
"resources" : ["configmaps"],
"verbs" : ["*"]
}
]
"clusters" : ["cluster-1", "cluster-2", "cluster-3]
}
}
|
6. DELETE Logical Cloud
Code Block |
---|
language | js |
---|
title | DELETE Logical Cloud |
---|
|
DELETE
URL: /v2/projects/<project-name>/logical-clouds/<name>
RESPONSE STATUS: 204
|
7. Add user permissions
Code Block |
---|
language | js |
---|
title | Add User permissions |
---|
|
URL: /v2/projects/<project-name>/logical-clouds/<logical-cloud-name>/user-permissions
POST BODY:
},
{ "permission-name" : "permission-23",
"apiGroups" : [""],
"resources" : ["configmapsjobs"],
"verbs" : ["*list"]
}
}
Return Status: 200 ]
(OK)
Return Body:
{ "clustersname" : ["clusterpermission-13",
"cluster-2", "cluster-3]
}
}
|
6. DELETE Logical Cloud
Code Block |
---|
language | js |
---|
title | DELETE Logical Cloud |
---|
|
DELETE
URL: /v2/projects/<project-name>/logical-clouds/<name>
RESPONSE STATUS: 204
|
...
apiGroups" : [""],
"resources" : ["jobs"],
"verbs" : ["list"]
}
|
8. GET User Permissions
Code Block |
---|
language | js |
---|
title | Add Get User permissions |
---|
|
URL: /v2/projects/<project-name>/logical-clouds/<logical-cloud-name>/user-permissions
POST BODY:
GET:
Return Body:
{"permissions" : [
{ "name" : "permission-31",
"apiGroups" : ["stable.example.com"],
,
"resources" : ["jobssecrets"],
"verbs" : ["list"]
}pods"],
Return Status: 200 (OK)
Return Body:
{ "name" : "permission-3",
"apiGroups" : [""],
"resources" : ["jobs"],
"verbs"verbs" : ["get", "watch", "list", "create"]
},
{ "name" : "permission-2",
"apiGroups" : ["list"]
}
|
8. GET User Permissions
Code Block |
---|
language | js |
---|
title | Get User permissions |
---|
|
URL: /v2/projects/<project-name>/logical-clouds/<logical-cloud-name>/user-permissions
GET:
Return Body:"],
{"permissionsresources" : ["configmaps"],
{ "nameverbs" : ["permission-1"*"]
},
{ "apiGroupsname" : ["stable.example.com"]"permission-3",
"resourcesapiGroups" : ["secrets", "pods"],
"verbsresources" : ["getjobs"], "watch",
"listverbs", : ["createlist"]
},
{ "name" : "permission-2",]
}
|
9. PUT (Update User permissions)
Code Block |
---|
language | js |
---|
title | Update User permissions |
---|
|
URL: /v2/projects/<project-name>/logical-clouds/<logical-cloud-name>/user-permissions/permission-3
POST BODY:
{
"apiGroups" : [""],
"resources" : ["configmapspvc"],
"verbs" : ["*list"]
}
},
Return Status: 200 (OK)
Return Body:
{ "name" : "permission-3",
"apiGroups" : [""],
"resources" : ["jobs"],
pvc"],
"verbs" : ["list"]
}
|
10. Delete Permissions
Code Block |
---|
language | js |
---|
title | Delete User permissions |
---|
|
DELETE
URL: /v2/projects/<project-name>/logical-clouds/<logical-cloud-name>/user-permissions/<permission-name>
RETURN STATUS: ]204
}
|
11. Create logical cloud Quota ( quota will be applied to each cluster in the logical cloud)
This allows resources to be tuned for the logical cloud9. PUT (Update User permissions)
Code Block |
---|
language | js |
---|
title | Update User permissionsCreate Logical cloud quota |
---|
|
URL: /v2/projects/<project-name>/logical-clouds/<logical-cloud-name>/user-permissions/permission-3cluster-quotas
POST BODY:
{
"metadata" :
{
"apiGroups" : [""],
"resourcesname" : ["pvcquota-1"],
"verbsdescription" : ["listdesc"]
},
"spec" : {
Return Status: 200 (OK)
Return Body:
{ "namecpu" : "permission-3400",
"apiGroupsmemory" : ["1000Gi"],
"resourcespods" : ["pvc500"],
"verbs" : ["list"]
}
|
10. Delete Permissions
Code Block |
---|
language | js |
---|
title | Delete User permissions |
---|
|
DELETE
URL: /v2/projects/<project-name>/logical-clouds/<logical-cloud-name>/user-permissions/<permission-name>}
}
RETURN STATUS: 204
201 |
1112. Create GET logical cloud QuotaThis allows resources to be tuned for the logical cloud
Code Block |
---|
language | js |
---|
title | Create Get Logical cloud quota |
---|
|
GET
URL: /v2/projects/<project-name>/logical-clouds/<logical-cloud-name>/quotas
POST BODY:
-cloud-name>/cluster-quotas/<quota-name>
RETURN BODY:
{
"metadata" : {
"name" : "quota-1",
"description": "desc"
},
"spec" : {
"cpu": "400",
"memory": "1000Gi",
"pods": "500"
}
}
RETURN STATUS: 201 |
13. Update Logical Cloud 12. GET logical cloud Quota
Code Block |
---|
language | js |
---|
title | Get Update Logical cloud quota |
---|
|
GET
URL: /v2/projects/<project-name>/logical-clouds/<logical-cloud-name>/cluster-quotas/<quota-name>
RETURNPUT BODY:
{
"cpumetadata" : "400",{
"memoryname" : "1000Giquota-1",
"podsdescription": "500desc"
}
|
13. Update Logical Cloud Quota
Code Block |
---|
language | js |
---|
title | Update Logical cloud quota |
---|
|
URL: /v2/projects/<project-name>/logical-clouds/<logical-cloud-name>/quotas
PUT BODY:
,
"spec" : {
"cpu": "400",
"memory": "1000Gi",
"pods": "500"
}
}
RETURN STATUS: 201 |
14. POST (Apply all the created configuration, this creates the K8s resources)
...
Code Block |
---|
language | js |
---|
title | Get Operation status |
---|
|
URL: /v2/projects/<project-name>/logical-clouds/<logical-cloud-name>/status
GET BODY:
GET
Return Status: 201
Return Body :
{
"name" : "logical-cloud-1"
"user" : "user-1",
"status": "Creation in Progress " //Created, Creation Failed
} |
...