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

how to realize this sentence: "please use RESTful API to assign storage to the groups of the user"? #4806

Closed
yingunjun opened this issue Aug 12, 2020 · 9 comments

Comments

@yingunjun
Copy link

I'm not familiar with k8s. In the Admin Mannual, there is a sentence with words "please use RESTful API to assign storage to the groups of the user" in "Assign Storage to PAI Groups" part, I don't know how to handle it. Could you give me some examples?

@hzy46
Copy link
Contributor

hzy46 commented Aug 12, 2020

Do you know about HTTP request? It means you send several requests to PAI's rest server. The rest-server url is http(s)://<pai-master-ip>/rest-server

@yingunjun
Copy link
Author

Do you know about HTTP request? It means you send several requests to PAI's rest server. The rest-server url is http(s):///rest-server

Thank you very much for your answer. I'm not good at http request, but I used Postman to send GET request with token, I got the result as flow:
{
"groupname": "default",
"description": "group for default vc",
"externalName": "",
"extension": {
"acls": {
"admin": false,
"virtualClusters": ["default"]
}
}
}
no "storageConfigs": [], line exist. Could you tell me what the problem with it?

@hzy46
Copy link
Contributor

hzy46 commented Aug 13, 2020

No problem, just add it by your self.

@yingunjun
Copy link
Author

yingunjun commented Aug 13, 2020

No problem, just add it by your self.

Could you tell me how to add storage? I used Postman to send post request as follow, but got error message. Please check the picture as follow for detail.
图片

if you cannot open image above. Please refer to the information below.

post Params:
key: storageConfigs
value: nfs-storage
post was sent like this: http://node11/rest-server/api/v2/groups/default/?storageConfigs=nfs-storage
result body:
{
"code": "NoApiError",
"message": "API /api/v2/groups/default/?storageConfigs=nfs-storage is not found."
}

@hzy46
Copy link
Contributor

hzy46 commented Aug 13, 2020

Add it to your request body, like:

{
  "data": {
    "groupname": "default",
    "extension": {
      "acls": {
        "storageConfigs": ["nfs-storage"],
        "admin": false,
        "virtualClusters": ["default"]
      }
    }
  },
  "patch": true
}

@yingunjun
Copy link
Author

Add it to your request body, like:

{
  "data": {
    "groupname": "default",
    "extension": {
      "acls": {
        "storageConfigs": ["nfs-storage"],
        "admin": false,
        "virtualClusters": ["default"]
      }
    }
  },
  "patch": true
}

Thank you very much for your advice. please help me to check the POST setting. it still has some problem result.

post图片

@hzy46
Copy link
Contributor

hzy46 commented Aug 13, 2020

Use PUT, not post, and the URL should be http://node1/rest-server/api/v2/groups. You can see the api here: https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/microsoft/pai/master/src/rest-server/docs/swagger.yaml#operation/updateGroup

@yingunjun
Copy link
Author

Use PUT, not post, and the URL should be http://node1/rest-server/api/v2/groups. You can see the api here: https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/microsoft/pai/master/src/rest-server/docs/swagger.yaml#operation/updateGroup

Aha, thank you a lot, I made a mistake, I saw the 'PUT' as 'POST'. That's very kind of you to remind me. Thank you again. It works.
put图片

@hzy46
Copy link
Contributor

hzy46 commented Aug 13, 2020

Thanks for the information. I think this function should have a UI to make it more easy-to-use.

@scarlett2018 scarlett2018 mentioned this issue Sep 7, 2020
5 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants