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.
104
-
105
-
### Fields for creating or updating
106
-
107
-
| field | required | type | description |
108
-
| --- | --- | --- | --- |
109
-
| name | required | string | it should be a valid resource name for kubernetes |
110
-
| displayName | optional | string | display name for this dataset |
111
-
| description | optional | string ||
112
-
| global | optional | boolean | when a dataset is global, it could be seen for each group |
113
-
| type | required | string | one of ['pv', 'nfs', 'hostPath', 'git', 'env']|
114
-
| url | conditional | string |**MUST** use with `git` type |
115
-
| pvProvisioning | conditional | string | onf of ['auto', 'manual'], **MUST** use with `pv` type. This field only uses in `CREATE` action |
116
-
| nfsServer | conditional | string |**MUST** use with `nfs` type |
117
-
| nfsPath | conditional | string |**MUST** use with `nfs` type |
118
-
| hostPath | conditional | string |**MUST** use with `hostPath` type |
119
-
| 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"}`. |
120
-
| groups | optional | list of connected groups (dict) | please see the `connect` examples |
121
-
| secret | optional | dict |**MAY** use with `git` type | bind a `secret` to the `git` dataset |
122
-
| volumeSize | conditional | integer |**MUST** use with `pv` type. The unit is `GB`.|
123
-
| enableUploadServer | optional | boolean | it only works with one of ['pv', 'nfs', 'hostPath'] writable types |
124
-
125
-
> There is a simple rule to use fields for `UPDATE`. All required fields should not be in the payload.
126
-
127
-
For example, there is a configuration for creating env dataset:
128
-
129
-
```bash
130
-
primehub datasets create <<EOF
131
-
{
132
-
"name": "env-dataset",
133
-
"description": "",
134
-
"type": "env",
135
-
"variables": {
136
-
"ENV": "prod",
137
-
"LUCKY_NUMBER": "7"
138
-
}
139
-
}
140
-
EOF
141
-
```
142
-
143
-
After removing required `name` and `type` fields, it could be used with updating:
144
-
145
-
```bash
146
-
primehub datasets update env-dataset <<EOF
147
-
{
148
-
"description": "make changes to the description",
149
-
"variables": {
150
-
"ENV": "prod",
151
-
"LUCKY_NUMBER": "8"
152
-
}
153
-
}
154
-
EOF
155
-
```
156
-
157
-
For updating, giving things that you want to make different:
158
-
159
-
```bash
160
-
primehub datasets update env-dataset <<EOF
161
-
{
162
-
"groups": {
163
-
"connect": [
164
-
{
165
-
"id": "a7a283b5-c0e2-4b79-a78c-39c630324762",
166
-
"writable": false
167
-
}
168
-
]
169
-
}
170
-
}
171
-
EOF
172
-
```
173
-
174
-
175
-
176
-
177
-
178
-
### PV type
179
-
180
-
```json
181
-
{
182
-
"name": "pv-dataset",
183
-
"displayName": "the dataset created by SDK",
184
-
"description": "It is a PV dataset",
185
-
"type": "pv",
186
-
"global": false,
187
-
"groups": {
188
-
"connect": [
189
-
{
190
-
"id": "a7a283b5-c0e2-4b79-a78c-39c630324762",
191
-
"writable": true
192
-
},
193
-
{
194
-
"id": "a962305b-c884-4413-9358-ef56373b287c",
195
-
"writable": false
196
-
}
197
-
]
198
-
},
199
-
"pvProvisioning": "auto",
200
-
"volumeSize": 1
201
-
}
202
-
```
203
-
204
-
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.
329
-
330
-
### Group connect/disconnect
331
-
332
-
All dataset types could connect or disconnect to groups, but there is subtle difference between `CREATE` and `UPDATE`.
0 commit comments