fog-kubevirt 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fog/kubevirt/compute/compute.rb +28 -6
  3. data/lib/fog/kubevirt/compute/models/persistentvolume.rb +82 -0
  4. data/lib/fog/kubevirt/compute/models/persistentvolumes.rb +73 -0
  5. data/lib/fog/kubevirt/compute/models/storageclass.rb +33 -0
  6. data/lib/fog/kubevirt/compute/models/storageclasses.rb +61 -0
  7. data/lib/fog/kubevirt/compute/models/vm_base.rb +13 -2
  8. data/lib/fog/kubevirt/compute/models/vm_data.rb +11 -13
  9. data/lib/fog/kubevirt/compute/models/vminstance.rb +11 -2
  10. data/lib/fog/kubevirt/compute/models/vms.rb +48 -19
  11. data/lib/fog/kubevirt/compute/models/volume.rb +44 -69
  12. data/lib/fog/kubevirt/compute/models/volumes.rb +3 -58
  13. data/lib/fog/kubevirt/compute/requests/{create_volume.rb → create_persistentvolume.rb} +2 -2
  14. data/lib/fog/kubevirt/compute/requests/create_storageclass.rb +18 -0
  15. data/lib/fog/kubevirt/compute/requests/{delete_volume.rb → delete_persistentvolume.rb} +2 -2
  16. data/lib/fog/kubevirt/compute/requests/{get_volume.rb → delete_storageclass.rb} +3 -3
  17. data/lib/fog/kubevirt/compute/requests/delete_vm.rb +1 -1
  18. data/lib/fog/kubevirt/compute/requests/delete_vminstance.rb +3 -3
  19. data/lib/fog/kubevirt/compute/requests/get_persistentvolume.rb +16 -0
  20. data/lib/fog/kubevirt/compute/requests/get_storageclass.rb +16 -0
  21. data/lib/fog/kubevirt/compute/requests/list_persistentvolumes.rb +22 -0
  22. data/lib/fog/kubevirt/compute/requests/list_storageclasses.rb +22 -0
  23. data/lib/fog/kubevirt/compute/requests/list_volumes.rb +14 -6
  24. data/lib/fog/kubevirt/version.rb +1 -1
  25. data/spec/create_vm_spec.rb +101 -0
  26. data/spec/fixtures/kubevirt/{volume/volumes_crud.yml → persistentvolume/persistent_volumes_crud.yml} +0 -0
  27. data/spec/fixtures/kubevirt/pvc/pvcs_crud.yml +122 -76
  28. data/spec/fixtures/kubevirt/storageclass/storageclasses_crud.yml +400 -0
  29. data/spec/fixtures/kubevirt/vm/vm_create_multi.yml +459 -0
  30. data/spec/fixtures/kubevirt/vm/vm_create_single.yml +362 -0
  31. data/spec/{volumes_v1alpha2_spec.rb → persistent_volumes_v1alpha2_spec.rb} +11 -11
  32. data/spec/pvcs_v1alpha2_spec.rb +7 -0
  33. data/spec/storage_classes_v1_spec.rb +46 -0
  34. metadata +28 -9
@@ -0,0 +1,362 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://10.8.254.82:8443/apis/kubevirt.io/v1alpha3/namespaces/default/virtualmachines
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - rest-client/2.0.2 (linux-gnu x86_64) ruby/2.3.3p222
16
+ Authorization:
17
+ - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImZvcmVtYW4tYWNjb3VudC10b2tlbi1yY3ByMiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJmb3JlbWFuLWFjY291bnQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI1OGY3NTc4NC0yMjUyLTExZTktYjU1NS01MjU0MDA3ZDM1M2QiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6ZGVmYXVsdDpmb3JlbWFuLWFjY291bnQifQ.UDzZu0_mLkJZvgeGE-lgKJOXtwWGt6WoNuEpm8k7VK61_bQFavEsETRUrGar68cebUPdUTWFoFlVStcQXoQoS0PUvqNPmznBcHDUW5Jw7pKaLHUhsqQkOoNzDD4eGcl1KDoagL1E-CkTglcYiMYHM9yykxnK58jyP3HF1rsDLG-c8N-T3bK_tLQ__eqKwPJ7R3RHuCg3M5FX1mH86wuaEsOPW3KW7tlGQpP5hj33-97KMp4GgH3pZMTLgo1JDwGT2GXPW12V7juE18KEvvot6q5S0Akl85Vp_5NCxNANRG9YCsSnUiB1opHBqfTxIO1ykSYHfg2IkuovQh68HDNV5A
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - application/json
25
+ Date:
26
+ - Sun, 24 Mar 2019 20:41:19 GMT
27
+ Content-Length:
28
+ - '1998'
29
+ body:
30
+ encoding: UTF-8
31
+ string: '{"apiVersion":"kubevirt.io/v1alpha3","items":[{"apiVersion":"kubevirt.io/v1alpha3","kind":"VirtualMachine","metadata":{"creationTimestamp":"2019-03-24T20:41:19Z","generation":1,"labels":{"kubevirt.io/vm":"test2"},"name":"test2","namespace":"default","resourceVersion":"3260847","selfLink":"/apis/kubevirt.io/v1alpha3/namespaces/default/virtualmachines/test2","uid":"2dbf05ef-4e75-11e9-8e8c-5254007d353d"},"spec":{"running":false,"template":{"metadata":{"creationTimestamp":null,"labels":{"kubevirt.io/vm":"test2"}},"spec":{"domain":{"cpu":{"cores":1},"devices":{"disks":[{"disk":{"bus":"virtio"},"name":"test2-disk-00"}]},"machine":{"type":""},"resources":{"requests":{"memory":"64M"}}},"terminationGracePeriodSeconds":0,"volumes":[{"name":"test2-disk-00","persistentVolumeClaim":{"claimName":"mypvc3"}}]}}}},{"apiVersion":"kubevirt.io/v1alpha3","kind":"VirtualMachine","metadata":{"creationTimestamp":"2019-03-21T08:53:21Z","generation":3,"labels":{"special":"vm-multus-pvc"},"name":"vm-multus-pvc","namespace":"default","resourceVersion":"2744764","selfLink":"/apis/kubevirt.io/v1alpha3/namespaces/default/virtualmachines/vm-multus-pvc","uid":"c7c8e72d-4bb6-11e9-8e8c-5254007d353d"},"spec":{"running":true,"template":{"metadata":{"creationTimestamp":null,"labels":{"kubevirt.io/vm":"vm-multus-pvc"}},"spec":{"domain":{"cpu":{"cores":1},"devices":{"disks":[{"disk":{"bus":"virtio"},"name":"vm-multus-pvc-volume"}],"interfaces":[{"bootOrder":1,"bridge":{},"macAddress":"de:00:00:11:11:de","name":"ovs-foreman"}]},"machine":{"type":"q35"},"resources":{"requests":{"memory":"512M"}}},"networks":[{"multus":{"networkName":"ovs-foreman"},"name":"ovs-foreman"}],"terminationGracePeriodSeconds":0,"volumes":[{"name":"vm-multus-pvc-volume","persistentVolumeClaim":{"claimName":"example-local-claim"}}]}}},"status":{"created":true,"ready":true}}],"kind":"VirtualMachineList","metadata":{"continue":"","resourceVersion":"3260847","selfLink":"/apis/kubevirt.io/v1alpha3/namespaces/default/virtualmachines"}}
32
+
33
+ '
34
+ http_version:
35
+ recorded_at: Sun, 24 Mar 2019 20:41:19 GMT
36
+ - request:
37
+ method: get
38
+ uri: https://10.8.254.82:8443/apis/kubevirt.io
39
+ body:
40
+ encoding: US-ASCII
41
+ string: ''
42
+ headers:
43
+ Accept:
44
+ - "*/*"
45
+ Accept-Encoding:
46
+ - gzip, deflate
47
+ User-Agent:
48
+ - rest-client/2.0.2 (linux-gnu x86_64) ruby/2.3.3p222
49
+ response:
50
+ status:
51
+ code: 200
52
+ message: OK
53
+ headers:
54
+ Content-Type:
55
+ - application/json
56
+ Date:
57
+ - Mon, 25 Mar 2019 09:40:38 GMT
58
+ Content-Length:
59
+ - '213'
60
+ body:
61
+ encoding: UTF-8
62
+ string: '{"kind":"APIGroup","apiVersion":"v1","name":"kubevirt.io","versions":[{"groupVersion":"kubevirt.io/v1alpha3","version":"v1alpha3"}],"preferredVersion":{"groupVersion":"kubevirt.io/v1alpha3","version":"v1alpha3"}}
63
+
64
+ '
65
+ http_version:
66
+ recorded_at: Mon, 25 Mar 2019 09:40:38 GMT
67
+ - request:
68
+ method: get
69
+ uri: https://10.8.254.82:8443/apis/kubevirt.io
70
+ body:
71
+ encoding: US-ASCII
72
+ string: ''
73
+ headers:
74
+ Accept:
75
+ - "*/*"
76
+ Accept-Encoding:
77
+ - gzip, deflate
78
+ User-Agent:
79
+ - rest-client/2.0.2 (linux-gnu x86_64) ruby/2.3.3p222
80
+ response:
81
+ status:
82
+ code: 200
83
+ message: OK
84
+ headers:
85
+ Content-Type:
86
+ - application/json
87
+ Date:
88
+ - Mon, 25 Mar 2019 09:40:38 GMT
89
+ Content-Length:
90
+ - '213'
91
+ body:
92
+ encoding: UTF-8
93
+ string: '{"kind":"APIGroup","apiVersion":"v1","name":"kubevirt.io","versions":[{"groupVersion":"kubevirt.io/v1alpha3","version":"v1alpha3"}],"preferredVersion":{"groupVersion":"kubevirt.io/v1alpha3","version":"v1alpha3"}}
94
+
95
+ '
96
+ http_version:
97
+ recorded_at: Mon, 25 Mar 2019 09:40:38 GMT
98
+ - request:
99
+ method: get
100
+ uri: https://10.8.254.82:8443/apis/kubevirt.io/v1alpha3
101
+ body:
102
+ encoding: US-ASCII
103
+ string: ''
104
+ headers:
105
+ Accept:
106
+ - "*/*"
107
+ Accept-Encoding:
108
+ - gzip, deflate
109
+ User-Agent:
110
+ - rest-client/2.0.2 (linux-gnu x86_64) ruby/2.3.3p222
111
+ Authorization:
112
+ - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImZvcmVtYW4tYWNjb3VudC10b2tlbi1yY3ByMiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJmb3JlbWFuLWFjY291bnQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI1OGY3NTc4NC0yMjUyLTExZTktYjU1NS01MjU0MDA3ZDM1M2QiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6ZGVmYXVsdDpmb3JlbWFuLWFjY291bnQifQ.UDzZu0_mLkJZvgeGE-lgKJOXtwWGt6WoNuEpm8k7VK61_bQFavEsETRUrGar68cebUPdUTWFoFlVStcQXoQoS0PUvqNPmznBcHDUW5Jw7pKaLHUhsqQkOoNzDD4eGcl1KDoagL1E-CkTglcYiMYHM9yykxnK58jyP3HF1rsDLG-c8N-T3bK_tLQ__eqKwPJ7R3RHuCg3M5FX1mH86wuaEsOPW3KW7tlGQpP5hj33-97KMp4GgH3pZMTLgo1JDwGT2GXPW12V7juE18KEvvot6q5S0Akl85Vp_5NCxNANRG9YCsSnUiB1opHBqfTxIO1ykSYHfg2IkuovQh68HDNV5A
113
+ response:
114
+ status:
115
+ code: 200
116
+ message: OK
117
+ headers:
118
+ Content-Type:
119
+ - application/json
120
+ Date:
121
+ - Mon, 25 Mar 2019 09:40:38 GMT
122
+ Content-Length:
123
+ - '1526'
124
+ body:
125
+ encoding: UTF-8
126
+ string: '{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"kubevirt.io/v1alpha3","resources":[{"name":"virtualmachineinstancemigrations","singularName":"virtualmachineinstancemigration","namespaced":true,"kind":"VirtualMachineInstanceMigration","verbs":["delete","deletecollection","get","list","patch","create","update","watch"],"shortNames":["vmim","vmims"]},{"name":"virtualmachineinstancepresets","singularName":"virtualmachineinstancepreset","namespaced":true,"kind":"VirtualMachineInstancePreset","verbs":["delete","deletecollection","get","list","patch","create","update","watch"],"shortNames":["vmipreset","vmipresets"]},{"name":"virtualmachineinstancereplicasets","singularName":"virtualmachineinstancereplicaset","namespaced":true,"kind":"VirtualMachineInstanceReplicaSet","verbs":["delete","deletecollection","get","list","patch","create","update","watch"],"shortNames":["vmirs","vmirss"]},{"name":"virtualmachineinstancereplicasets/scale","singularName":"","namespaced":true,"group":"autoscaling","version":"v1","kind":"Scale","verbs":["get","patch","update"]},{"name":"virtualmachineinstances","singularName":"virtualmachineinstance","namespaced":true,"kind":"VirtualMachineInstance","verbs":["delete","deletecollection","get","list","patch","create","update","watch"],"shortNames":["vmi","vmis"]},{"name":"virtualmachines","singularName":"virtualmachine","namespaced":true,"kind":"VirtualMachine","verbs":["delete","deletecollection","get","list","patch","create","update","watch"],"shortNames":["vm","vms"]}]}
127
+
128
+ '
129
+ http_version:
130
+ recorded_at: Mon, 25 Mar 2019 09:40:38 GMT
131
+ - request:
132
+ method: post
133
+ uri: https://10.8.254.82:8443/apis/kubevirt.io/v1alpha3/namespaces/default/virtualmachines
134
+ body:
135
+ encoding: UTF-8
136
+ string: '{"kind":"VirtualMachine","metadata":{"labels":{"kubevirt.io/vm":"test2"},"name":"test2","namespace":"default"},"spec":{"running":false,"template":{"metadata":{"creationTimestamp":null,"labels":{"kubevirt.io/vm":"test2"}},"spec":{"domain":{"devices":{"disks":[{"name":"test2-disk-00","disk":{"bus":"virtio"}}]},"machine":{"type":""},"resources":{"requests":{"memory":"64M"}},"cpu":{"cores":1}},"terminationGracePeriodSeconds":0,"volumes":[{"name":"test2-disk-00","persistentVolumeClaim":{"claimName":"mypvc3"}}]}}},"apiVersion":"kubevirt.io/v1alpha3"}'
137
+ headers:
138
+ Accept:
139
+ - "*/*"
140
+ Accept-Encoding:
141
+ - gzip, deflate
142
+ User-Agent:
143
+ - rest-client/2.0.2 (linux-gnu x86_64) ruby/2.3.3p222
144
+ Content-Type:
145
+ - application/json
146
+ Authorization:
147
+ - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImZvcmVtYW4tYWNjb3VudC10b2tlbi1yY3ByMiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJmb3JlbWFuLWFjY291bnQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI1OGY3NTc4NC0yMjUyLTExZTktYjU1NS01MjU0MDA3ZDM1M2QiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6ZGVmYXVsdDpmb3JlbWFuLWFjY291bnQifQ.UDzZu0_mLkJZvgeGE-lgKJOXtwWGt6WoNuEpm8k7VK61_bQFavEsETRUrGar68cebUPdUTWFoFlVStcQXoQoS0PUvqNPmznBcHDUW5Jw7pKaLHUhsqQkOoNzDD4eGcl1KDoagL1E-CkTglcYiMYHM9yykxnK58jyP3HF1rsDLG-c8N-T3bK_tLQ__eqKwPJ7R3RHuCg3M5FX1mH86wuaEsOPW3KW7tlGQpP5hj33-97KMp4GgH3pZMTLgo1JDwGT2GXPW12V7juE18KEvvot6q5S0Akl85Vp_5NCxNANRG9YCsSnUiB1opHBqfTxIO1ykSYHfg2IkuovQh68HDNV5A
148
+ Content-Length:
149
+ - '550'
150
+ response:
151
+ status:
152
+ code: 201
153
+ message: Created
154
+ headers:
155
+ Content-Type:
156
+ - application/json
157
+ Date:
158
+ - Mon, 25 Mar 2019 09:40:38 GMT
159
+ Content-Length:
160
+ - '763'
161
+ body:
162
+ encoding: UTF-8
163
+ string: '{"apiVersion":"kubevirt.io/v1alpha3","kind":"VirtualMachine","metadata":{"creationTimestamp":"2019-03-25T09:40:38Z","generation":1,"labels":{"kubevirt.io/vm":"test2"},"name":"test2","namespace":"default","resourceVersion":"3291939","selfLink":"/apis/kubevirt.io/v1alpha3/namespaces/default/virtualmachines/test2","uid":"0c0afe5d-4ee2-11e9-8e8c-5254007d353d"},"spec":{"running":false,"template":{"metadata":{"creationTimestamp":null,"labels":{"kubevirt.io/vm":"test2"}},"spec":{"domain":{"cpu":{"cores":1},"devices":{"disks":[{"disk":{"bus":"virtio"},"name":"test2-disk-00"}]},"machine":{"type":""},"resources":{"requests":{"memory":"64M"}}},"terminationGracePeriodSeconds":0,"volumes":[{"name":"test2-disk-00","persistentVolumeClaim":{"claimName":"mypvc3"}}]}}}}
164
+
165
+ '
166
+ http_version:
167
+ recorded_at: Mon, 25 Mar 2019 09:40:38 GMT
168
+ - request:
169
+ method: get
170
+ uri: https://10.8.254.82:8443/apis/kubevirt.io
171
+ body:
172
+ encoding: US-ASCII
173
+ string: ''
174
+ headers:
175
+ Accept:
176
+ - "*/*"
177
+ Accept-Encoding:
178
+ - gzip, deflate
179
+ User-Agent:
180
+ - rest-client/2.0.2 (linux-gnu x86_64) ruby/2.3.3p222
181
+ response:
182
+ status:
183
+ code: 200
184
+ message: OK
185
+ headers:
186
+ Content-Type:
187
+ - application/json
188
+ Date:
189
+ - Mon, 25 Mar 2019 09:40:38 GMT
190
+ Content-Length:
191
+ - '213'
192
+ body:
193
+ encoding: UTF-8
194
+ string: '{"kind":"APIGroup","apiVersion":"v1","name":"kubevirt.io","versions":[{"groupVersion":"kubevirt.io/v1alpha3","version":"v1alpha3"}],"preferredVersion":{"groupVersion":"kubevirt.io/v1alpha3","version":"v1alpha3"}}
195
+
196
+ '
197
+ http_version:
198
+ recorded_at: Mon, 25 Mar 2019 09:40:38 GMT
199
+ - request:
200
+ method: get
201
+ uri: https://10.8.254.82:8443/apis/kubevirt.io/v1alpha3/namespaces/default/virtualmachines/test2
202
+ body:
203
+ encoding: US-ASCII
204
+ string: ''
205
+ headers:
206
+ Accept:
207
+ - "*/*"
208
+ Accept-Encoding:
209
+ - gzip, deflate
210
+ User-Agent:
211
+ - rest-client/2.0.2 (linux-gnu x86_64) ruby/2.3.3p222
212
+ Authorization:
213
+ - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImZvcmVtYW4tYWNjb3VudC10b2tlbi1yY3ByMiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJmb3JlbWFuLWFjY291bnQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI1OGY3NTc4NC0yMjUyLTExZTktYjU1NS01MjU0MDA3ZDM1M2QiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6ZGVmYXVsdDpmb3JlbWFuLWFjY291bnQifQ.UDzZu0_mLkJZvgeGE-lgKJOXtwWGt6WoNuEpm8k7VK61_bQFavEsETRUrGar68cebUPdUTWFoFlVStcQXoQoS0PUvqNPmznBcHDUW5Jw7pKaLHUhsqQkOoNzDD4eGcl1KDoagL1E-CkTglcYiMYHM9yykxnK58jyP3HF1rsDLG-c8N-T3bK_tLQ__eqKwPJ7R3RHuCg3M5FX1mH86wuaEsOPW3KW7tlGQpP5hj33-97KMp4GgH3pZMTLgo1JDwGT2GXPW12V7juE18KEvvot6q5S0Akl85Vp_5NCxNANRG9YCsSnUiB1opHBqfTxIO1ykSYHfg2IkuovQh68HDNV5A
214
+ response:
215
+ status:
216
+ code: 200
217
+ message: OK
218
+ headers:
219
+ Content-Type:
220
+ - application/json
221
+ Date:
222
+ - Mon, 25 Mar 2019 09:40:38 GMT
223
+ Content-Length:
224
+ - '763'
225
+ body:
226
+ encoding: UTF-8
227
+ string: '{"apiVersion":"kubevirt.io/v1alpha3","kind":"VirtualMachine","metadata":{"creationTimestamp":"2019-03-25T09:40:38Z","generation":1,"labels":{"kubevirt.io/vm":"test2"},"name":"test2","namespace":"default","resourceVersion":"3291939","selfLink":"/apis/kubevirt.io/v1alpha3/namespaces/default/virtualmachines/test2","uid":"0c0afe5d-4ee2-11e9-8e8c-5254007d353d"},"spec":{"running":false,"template":{"metadata":{"creationTimestamp":null,"labels":{"kubevirt.io/vm":"test2"}},"spec":{"domain":{"cpu":{"cores":1},"devices":{"disks":[{"disk":{"bus":"virtio"},"name":"test2-disk-00"}]},"machine":{"type":""},"resources":{"requests":{"memory":"64M"}}},"terminationGracePeriodSeconds":0,"volumes":[{"name":"test2-disk-00","persistentVolumeClaim":{"claimName":"mypvc3"}}]}}}}
228
+
229
+ '
230
+ http_version:
231
+ recorded_at: Mon, 25 Mar 2019 09:40:38 GMT
232
+ - request:
233
+ method: get
234
+ uri: https://10.8.254.82:8443/apis/kubevirt.io
235
+ body:
236
+ encoding: US-ASCII
237
+ string: ''
238
+ headers:
239
+ Accept:
240
+ - "*/*"
241
+ Accept-Encoding:
242
+ - gzip, deflate
243
+ User-Agent:
244
+ - rest-client/2.0.2 (linux-gnu x86_64) ruby/2.3.3p222
245
+ response:
246
+ status:
247
+ code: 200
248
+ message: OK
249
+ headers:
250
+ Content-Type:
251
+ - application/json
252
+ Date:
253
+ - Mon, 25 Mar 2019 09:40:38 GMT
254
+ Content-Length:
255
+ - '213'
256
+ body:
257
+ encoding: UTF-8
258
+ string: '{"kind":"APIGroup","apiVersion":"v1","name":"kubevirt.io","versions":[{"groupVersion":"kubevirt.io/v1alpha3","version":"v1alpha3"}],"preferredVersion":{"groupVersion":"kubevirt.io/v1alpha3","version":"v1alpha3"}}
259
+
260
+ '
261
+ http_version:
262
+ recorded_at: Mon, 25 Mar 2019 09:40:38 GMT
263
+ - request:
264
+ method: get
265
+ uri: https://10.8.254.82:8443/apis/kubevirt.io/v1alpha3/namespaces/default/virtualmachines/test2
266
+ body:
267
+ encoding: US-ASCII
268
+ string: ''
269
+ headers:
270
+ Accept:
271
+ - "*/*"
272
+ Accept-Encoding:
273
+ - gzip, deflate
274
+ User-Agent:
275
+ - rest-client/2.0.2 (linux-gnu x86_64) ruby/2.3.3p222
276
+ Authorization:
277
+ - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImZvcmVtYW4tYWNjb3VudC10b2tlbi1yY3ByMiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJmb3JlbWFuLWFjY291bnQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI1OGY3NTc4NC0yMjUyLTExZTktYjU1NS01MjU0MDA3ZDM1M2QiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6ZGVmYXVsdDpmb3JlbWFuLWFjY291bnQifQ.UDzZu0_mLkJZvgeGE-lgKJOXtwWGt6WoNuEpm8k7VK61_bQFavEsETRUrGar68cebUPdUTWFoFlVStcQXoQoS0PUvqNPmznBcHDUW5Jw7pKaLHUhsqQkOoNzDD4eGcl1KDoagL1E-CkTglcYiMYHM9yykxnK58jyP3HF1rsDLG-c8N-T3bK_tLQ__eqKwPJ7R3RHuCg3M5FX1mH86wuaEsOPW3KW7tlGQpP5hj33-97KMp4GgH3pZMTLgo1JDwGT2GXPW12V7juE18KEvvot6q5S0Akl85Vp_5NCxNANRG9YCsSnUiB1opHBqfTxIO1ykSYHfg2IkuovQh68HDNV5A
278
+ response:
279
+ status:
280
+ code: 200
281
+ message: OK
282
+ headers:
283
+ Content-Type:
284
+ - application/json
285
+ Date:
286
+ - Mon, 25 Mar 2019 09:40:38 GMT
287
+ Content-Length:
288
+ - '763'
289
+ body:
290
+ encoding: UTF-8
291
+ string: '{"apiVersion":"kubevirt.io/v1alpha3","kind":"VirtualMachine","metadata":{"creationTimestamp":"2019-03-25T09:40:38Z","generation":1,"labels":{"kubevirt.io/vm":"test2"},"name":"test2","namespace":"default","resourceVersion":"3291939","selfLink":"/apis/kubevirt.io/v1alpha3/namespaces/default/virtualmachines/test2","uid":"0c0afe5d-4ee2-11e9-8e8c-5254007d353d"},"spec":{"running":false,"template":{"metadata":{"creationTimestamp":null,"labels":{"kubevirt.io/vm":"test2"}},"spec":{"domain":{"cpu":{"cores":1},"devices":{"disks":[{"disk":{"bus":"virtio"},"name":"test2-disk-00"}]},"machine":{"type":""},"resources":{"requests":{"memory":"64M"}}},"terminationGracePeriodSeconds":0,"volumes":[{"name":"test2-disk-00","persistentVolumeClaim":{"claimName":"mypvc3"}}]}}}}
292
+
293
+ '
294
+ http_version:
295
+ recorded_at: Mon, 25 Mar 2019 09:40:38 GMT
296
+ - request:
297
+ method: get
298
+ uri: https://10.8.254.82:8443/apis/kubevirt.io
299
+ body:
300
+ encoding: US-ASCII
301
+ string: ''
302
+ headers:
303
+ Accept:
304
+ - "*/*"
305
+ Accept-Encoding:
306
+ - gzip, deflate
307
+ User-Agent:
308
+ - rest-client/2.0.2 (linux-gnu x86_64) ruby/2.3.3p222
309
+ response:
310
+ status:
311
+ code: 200
312
+ message: OK
313
+ headers:
314
+ Content-Type:
315
+ - application/json
316
+ Date:
317
+ - Mon, 25 Mar 2019 09:40:38 GMT
318
+ Content-Length:
319
+ - '213'
320
+ body:
321
+ encoding: UTF-8
322
+ string: '{"kind":"APIGroup","apiVersion":"v1","name":"kubevirt.io","versions":[{"groupVersion":"kubevirt.io/v1alpha3","version":"v1alpha3"}],"preferredVersion":{"groupVersion":"kubevirt.io/v1alpha3","version":"v1alpha3"}}
323
+
324
+ '
325
+ http_version:
326
+ recorded_at: Mon, 25 Mar 2019 09:40:38 GMT
327
+ - request:
328
+ method: delete
329
+ uri: https://10.8.254.82:8443/apis/kubevirt.io/v1alpha3/namespaces/default/virtualmachines/test2
330
+ body:
331
+ encoding: US-ASCII
332
+ string: ''
333
+ headers:
334
+ Accept:
335
+ - "*/*"
336
+ Accept-Encoding:
337
+ - gzip, deflate
338
+ User-Agent:
339
+ - rest-client/2.0.2 (linux-gnu x86_64) ruby/2.3.3p222
340
+ Content-Type:
341
+ - application/json
342
+ Authorization:
343
+ - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImZvcmVtYW4tYWNjb3VudC10b2tlbi1yY3ByMiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJmb3JlbWFuLWFjY291bnQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI1OGY3NTc4NC0yMjUyLTExZTktYjU1NS01MjU0MDA3ZDM1M2QiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6ZGVmYXVsdDpmb3JlbWFuLWFjY291bnQifQ.UDzZu0_mLkJZvgeGE-lgKJOXtwWGt6WoNuEpm8k7VK61_bQFavEsETRUrGar68cebUPdUTWFoFlVStcQXoQoS0PUvqNPmznBcHDUW5Jw7pKaLHUhsqQkOoNzDD4eGcl1KDoagL1E-CkTglcYiMYHM9yykxnK58jyP3HF1rsDLG-c8N-T3bK_tLQ__eqKwPJ7R3RHuCg3M5FX1mH86wuaEsOPW3KW7tlGQpP5hj33-97KMp4GgH3pZMTLgo1JDwGT2GXPW12V7juE18KEvvot6q5S0Akl85Vp_5NCxNANRG9YCsSnUiB1opHBqfTxIO1ykSYHfg2IkuovQh68HDNV5A
344
+ response:
345
+ status:
346
+ code: 200
347
+ message: OK
348
+ headers:
349
+ Content-Type:
350
+ - application/json
351
+ Date:
352
+ - Mon, 25 Mar 2019 09:40:38 GMT
353
+ Content-Length:
354
+ - '188'
355
+ body:
356
+ encoding: UTF-8
357
+ string: '{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Success","details":{"name":"test2","group":"kubevirt.io","kind":"virtualmachines","uid":"0c0afe5d-4ee2-11e9-8e8c-5254007d353d"}}
358
+
359
+ '
360
+ http_version:
361
+ recorded_at: Mon, 25 Mar 2019 09:40:38 GMT
362
+ recorded_with: VCR 4.0.0
@@ -6,14 +6,14 @@ require 'spec_helper'
6
6
  describe Fog::Kubevirt::Compute do
7
7
  before :all do
8
8
  vcr = KubevirtVCR.new(
9
- vcr_directory: 'spec/fixtures/kubevirt/volume',
9
+ vcr_directory: 'spec/fixtures/kubevirt/persistentvolume',
10
10
  service_class: Fog::Kubevirt::Compute
11
11
  )
12
12
  @service = vcr.service
13
13
  end
14
14
 
15
15
  it 'CRUD services' do
16
- VCR.use_cassette('volumes_crud') do
16
+ VCR.use_cassette('persistent_volumes_crud') do
17
17
  begin
18
18
  name = 'my-local-storage'
19
19
  access_modes = [ 'ReadWriteOnce' ]
@@ -23,22 +23,22 @@ require 'spec_helper'
23
23
  type = 'hostPath'
24
24
  config = { path: "/mnt/data/datax", type: "Directory" }
25
25
 
26
- @service.volumes.create(name: name,
27
- access_modes: access_modes,
28
- capacity: capacity,
29
- labels: labels,
30
- storage_class: storage_class,
31
- type: type,
32
- config: config)
26
+ @service.persistentvolumes.create(name: name,
27
+ access_modes: access_modes,
28
+ capacity: capacity,
29
+ labels: labels,
30
+ storage_class: storage_class,
31
+ type: type,
32
+ config: config)
33
33
 
34
- volume = @service.volumes.get(name)
34
+ volume = @service.persistentvolumes.get(name)
35
35
  assert_equal(volume.name, 'my-local-storage')
36
36
  assert_equal(volume.access_modes, [ 'ReadWriteOnce' ])
37
37
  assert_equal(volume.capacity, '1Gi')
38
38
  assert_equal(volume.storage_class, 'manual')
39
39
  assert_equal(volume.type, 'hostPath')
40
40
  ensure
41
- @service.volumes.delete(name) if volume
41
+ @service.persistentvolumes.delete(name) if volume
42
42
  end
43
43
  end
44
44
  end
@@ -44,6 +44,13 @@ require 'spec_helper'
44
44
  assert_equal(pvc.volume_name, 'my-local-storage')
45
45
  assert_equal(pvc.requests[:storage], '2Gi')
46
46
  assert_equal(pvc.limits[:storage], '3Gi')
47
+
48
+ # test all volumes based on PVCs
49
+ volumes = @service.volumes.all
50
+ volume = volumes.select { |v| v.name == name }.first
51
+ refute_nil(volume)
52
+ assert_equal(volume.name, 'my-local-storage-pvc')
53
+ assert_equal(volume.type, 'persistentVolumeClaim')
47
54
  ensure
48
55
  @service.pvcs.delete(name) if pvc
49
56
  end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+ require_relative './shared_context'
3
+
4
+ require 'fog/kubevirt'
5
+
6
+ describe Fog::Kubevirt::Compute do
7
+ before :all do
8
+ vcr = KubevirtVCR.new(
9
+ vcr_directory: 'spec/fixtures/kubevirt/storageclass',
10
+ service_class: Fog::Kubevirt::Compute
11
+ )
12
+ @service = vcr.service
13
+ end
14
+
15
+ it 'CRUD services' do
16
+ VCR.use_cassette('storageclasses_crud') do
17
+ begin
18
+ name = 'my-storage-class'
19
+ parameters = {
20
+ 'resturl' => 'http://heketi-storage.glusterfs.svc:8080',
21
+ 'restuser' => 'admin',
22
+ 'secretName' => 'heketi-storage-admin-secret',
23
+ 'secretNamespace' => 'glusterfs'
24
+ }
25
+
26
+ provisioner = 'kubernetes.io/glusterfs'
27
+ reclaim_policy = 'Delete'
28
+ volume_binding_mode = 'Immediate'
29
+
30
+ @service.storageclasses.create(name: name,
31
+ parameters: parameters,
32
+ provisioner: provisioner,
33
+ reclaim_policy: reclaim_policy,
34
+ volume_binding_mode: volume_binding_mode)
35
+
36
+ storageclass = @service.storageclasses.get(name)
37
+ assert_equal(storageclass.name, 'my-storage-class')
38
+ assert_equal(storageclass.provisioner, 'kubernetes.io/glusterfs')
39
+ assert_equal(storageclass.reclaim_policy, 'Delete')
40
+ assert_equal(storageclass.volume_binding_mode, 'Immediate')
41
+ ensure
42
+ @service.storageclasses.delete(name) if storageclass
43
+ end
44
+ end
45
+ end
46
+ end