You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For `create` and `update` require a dataset configuration, please see above examples.
168
+
169
+
### Fields for creating or updating
170
+
171
+
| field | required | type | description |
172
+
| --- | --- | --- | --- |
173
+
| name | required | string | it should be a valid resource name for kubernetes |
174
+
| displayName | optional | string | display name for this dataset |
175
+
| description | optional | string ||
176
+
| global | optional | boolean | when a dataset is global, it could be seen for each group |
177
+
| type | required | string | one of ['pv', 'nfs', 'hostPath', 'git', 'env']|
178
+
| url | conditional | string |**MUST** use with `git` type |
179
+
| pvProvisioning | conditional | string | onf of ['auto', 'manual'], **MUST** use with `pv` type. This field only uses in `CREATE` action |
180
+
| nfsServer | conditional | string |**MUST** use with `nfs` type |
181
+
| nfsPath | conditional | string |**MUST** use with `nfs` type |
182
+
| hostPath | conditional | string |**MUST** use with `hostPath` type |
183
+
| variables | optional | dict |**MAY** use with `env` type. It is key value pairs. All values have to a string value. For example: `{"key1":"value1","key2":"value2"}`. |
184
+
| groups | optional | list of connected groups (dict) | please see the `connect` examples |
185
+
| secret | optional | dict |**MAY** use with `git` type | bind a `secret` to the `git` dataset |
186
+
| volumeSize | conditional | integer |**MUST** use with `pv` type. The unit is `GB`.|
187
+
| enableUploadServer | optional | boolean | it only works with one of ['pv', 'nfs', 'hostPath'] writable types |
188
+
189
+
> There is a simple rule to use fields for `UPDATE`. All required fields should not be in the payload.
190
+
191
+
For example, there is a configuration for creating env dataset:
192
+
193
+
```bash
194
+
primehub datasets create <<EOF
195
+
{
196
+
"name": "env-dataset",
197
+
"description": "",
198
+
"type": "env",
199
+
"variables": {
200
+
"ENV": "prod",
201
+
"LUCKY_NUMBER": "7"
202
+
}
203
+
}
204
+
EOF
205
+
```
206
+
207
+
After removing required `name` and `type` fields, it could be used with updating:
208
+
209
+
```bash
210
+
primehub datasets update env-dataset <<EOF
211
+
{
212
+
"description": "make changes to the description",
213
+
"variables": {
214
+
"ENV": "prod",
215
+
"LUCKY_NUMBER": "8"
216
+
}
217
+
}
218
+
EOF
219
+
```
220
+
221
+
For updating, giving things that you want to make different:
222
+
223
+
```bash
224
+
primehub datasets update env-dataset <<EOF
225
+
{
226
+
"groups": {
227
+
"connect": [
228
+
{
229
+
"id": "a7a283b5-c0e2-4b79-a78c-39c630324762",
230
+
"writable": false
231
+
}
232
+
]
233
+
}
234
+
}
235
+
EOF
236
+
```
237
+
238
+
239
+
240
+
241
+
242
+
### PV type
243
+
244
+
```json
245
+
{
246
+
"name": "pv-dataset",
247
+
"displayName": "the dataset created by SDK",
248
+
"description": "It is a PV dataset",
249
+
"type": "pv",
250
+
"global": false,
251
+
"groups": {
252
+
"connect": [
253
+
{
254
+
"id": "a7a283b5-c0e2-4b79-a78c-39c630324762",
255
+
"writable": true
256
+
},
257
+
{
258
+
"id": "a962305b-c884-4413-9358-ef56373b287c",
259
+
"writable": false
260
+
}
261
+
]
262
+
},
263
+
"pvProvisioning": "auto",
264
+
"volumeSize": 1
265
+
}
266
+
```
267
+
268
+
Save the configuration to `create-dataset.json` and run `create`:
The example creates a hostPath dataset. According to the type `hostPath`, the `hostPath` field becomes `required`. You should put an absolute path that available in the node.
The example creates an ENV dataset. According to the type `env`, `variables` field becomes `required`. You could put many key-value pairs. Be careful, the key and value should be string values.
393
+
394
+
### Group connect/disconnect
395
+
396
+
All dataset types could connect or disconnect to groups, but there is subtle difference between `CREATE` and `UPDATE`.
0 commit comments