fog-kubevirt 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
1
+ require 'recursive_open_struct'
2
+
3
+ module Fog
4
+ module Compute
5
+ class Kubevirt
6
+ class Real
7
+ def list_services(_filters = {})
8
+ services = kube_client.get_services(namespace: @namespace)
9
+ entities = services.map do |kubevirt_obj|
10
+ Service.parse object_to_hash(kubevirt_obj)
11
+ end
12
+ EntityCollection.new(services.kind, services.resourceVersion, entities)
13
+ end
14
+ end
15
+
16
+ class Mock
17
+ def list_services(_filters = {})
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
data/lib/fog/kubevirt.rb CHANGED
@@ -12,6 +12,7 @@ module Fog
12
12
  class ServiceError < Fog::Errors::Error; end
13
13
  class AlreadyExistsError < Fog::Errors::Error; end
14
14
  class ClientError < Fog::Errors::Error; end
15
+ class ValidationError < Fog::Errors::Error; end
15
16
  end
16
17
 
17
18
  service(:compute, 'Compute')
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Kubevirt
3
- VERSION = '0.1.6'
3
+ VERSION = '0.1.7'
4
4
  end
5
5
  end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+ require_relative './shared_context'
3
+
4
+ require 'fog/kubevirt'
5
+
6
+ describe Fog::Compute do
7
+ before :all do
8
+ vcr = KubevirtVCR.new(
9
+ :vcr_directory => 'spec/fixtures/kubevirt/service/v1alpha2',
10
+ :service_class => Fog::Compute
11
+ )
12
+ @service = vcr.service
13
+ end
14
+
15
+ it 'CRUD services' do
16
+ VCR.use_cassette('services_crud') do
17
+ begin
18
+ port = 30000
19
+ vmi_name = "vmi-fedora"
20
+ srv_name = "#{vmi_name}-ssh"
21
+ srv_type = "NodePort"
22
+ @service.services.create(port: port, name: srv_name, target_port: 22, vmi_name: vmi_name, service_type: srv_type)
23
+
24
+ srv = @service.services.get(srv_name)
25
+ ensure
26
+ @service.services.delete(srv_name) if srv
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,172 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://192.168.122.51:8443/api/v1
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.4.2p198
16
+ Authorization:
17
+ - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJldmlydC1wcml2aWxlZ2VkLXRva2VuLW1xN252Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Imt1YmV2aXJ0LXByaXZpbGVnZWQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJjNGQyODA4MS1jZDNlLTExZTgtOGYzYy1hYzAxYzZkMzhmZWIiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06a3ViZXZpcnQtcHJpdmlsZWdlZCJ9.BUBWJi9a_A_rOrsiil7wEqxxdDOtpYt9M42HHdQr0JQ5Y2ES5xI2yecpdXPypfX4wa-8blj7xJyU3EZCSTUUX2Z-KXoYieYr6sKB-umYiK4MR4eSiBFL8J0QP_2zxZleUOAuAT8JZCHh7JbccUM0ebOtNPBCVDPb_j-zSsuSISBtayGzTzo7RgkyyO_2NfyYBv1b3gxlznGsWuqw6Kw01OE5Xs7EIDAbGn6Z51NUU3fE_UGZg5588z_WurEV_tJhfDGBIuIsWaJHHTmwnQ6kll4nWaqV5r3NlrSmk_z5m14rlmDRf2G-oTMkFlHgDjTbkZeUF8G0TT4FShQzrWSFhA
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - application/json
25
+ Date:
26
+ - Tue, 16 Oct 2018 13:50:16 GMT
27
+ Transfer-Encoding:
28
+ - chunked
29
+ body:
30
+ encoding: UTF-8
31
+ string: '{"kind":"APIResourceList","groupVersion":"v1","resources":[{"name":"bindings","singularName":"","namespaced":true,"kind":"Binding","verbs":["create"]},{"name":"componentstatuses","singularName":"","namespaced":false,"kind":"ComponentStatus","verbs":["get","list"],"shortNames":["cs"]},{"name":"configmaps","singularName":"","namespaced":true,"kind":"ConfigMap","verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"shortNames":["cm"]},{"name":"endpoints","singularName":"","namespaced":true,"kind":"Endpoints","verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"shortNames":["ep"]},{"name":"events","singularName":"","namespaced":true,"kind":"Event","verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"shortNames":["ev"]},{"name":"limitranges","singularName":"","namespaced":true,"kind":"LimitRange","verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"shortNames":["limits"]},{"name":"namespaces","singularName":"","namespaced":false,"kind":"Namespace","verbs":["create","delete","get","list","patch","update","watch"],"shortNames":["ns"]},{"name":"namespaces/finalize","singularName":"","namespaced":false,"kind":"Namespace","verbs":["update"]},{"name":"namespaces/status","singularName":"","namespaced":false,"kind":"Namespace","verbs":["get","patch","update"]},{"name":"nodes","singularName":"","namespaced":false,"kind":"Node","verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"shortNames":["no"]},{"name":"nodes/proxy","singularName":"","namespaced":false,"kind":"Node","verbs":[]},{"name":"nodes/status","singularName":"","namespaced":false,"kind":"Node","verbs":["get","patch","update"]},{"name":"persistentvolumeclaims","singularName":"","namespaced":true,"kind":"PersistentVolumeClaim","verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"shortNames":["pvc"]},{"name":"persistentvolumeclaims/status","singularName":"","namespaced":true,"kind":"PersistentVolumeClaim","verbs":["get","patch","update"]},{"name":"persistentvolumes","singularName":"","namespaced":false,"kind":"PersistentVolume","verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"shortNames":["pv"]},{"name":"persistentvolumes/status","singularName":"","namespaced":false,"kind":"PersistentVolume","verbs":["get","patch","update"]},{"name":"pods","singularName":"","namespaced":true,"kind":"Pod","verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"shortNames":["po"],"categories":["all"]},{"name":"pods/attach","singularName":"","namespaced":true,"kind":"Pod","verbs":[]},{"name":"pods/binding","singularName":"","namespaced":true,"kind":"Binding","verbs":["create"]},{"name":"pods/eviction","singularName":"","namespaced":true,"group":"policy","version":"v1beta1","kind":"Eviction","verbs":["create"]},{"name":"pods/exec","singularName":"","namespaced":true,"kind":"Pod","verbs":[]},{"name":"pods/log","singularName":"","namespaced":true,"kind":"Pod","verbs":["get"]},{"name":"pods/portforward","singularName":"","namespaced":true,"kind":"Pod","verbs":[]},{"name":"pods/proxy","singularName":"","namespaced":true,"kind":"Pod","verbs":[]},{"name":"pods/status","singularName":"","namespaced":true,"kind":"Pod","verbs":["get","patch","update"]},{"name":"podtemplates","singularName":"","namespaced":true,"kind":"PodTemplate","verbs":["create","delete","deletecollection","get","list","patch","update","watch"]},{"name":"replicationcontrollers","singularName":"","namespaced":true,"kind":"ReplicationController","verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"shortNames":["rc"],"categories":["all"]},{"name":"replicationcontrollers/scale","singularName":"","namespaced":true,"group":"autoscaling","version":"v1","kind":"Scale","verbs":["get","patch","update"]},{"name":"replicationcontrollers/status","singularName":"","namespaced":true,"kind":"ReplicationController","verbs":["get","patch","update"]},{"name":"resourcequotas","singularName":"","namespaced":true,"kind":"ResourceQuota","verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"shortNames":["quota"]},{"name":"resourcequotas/status","singularName":"","namespaced":true,"kind":"ResourceQuota","verbs":["get","patch","update"]},{"name":"secrets","singularName":"","namespaced":true,"kind":"Secret","verbs":["create","delete","deletecollection","get","list","patch","update","watch"]},{"name":"serviceaccounts","singularName":"","namespaced":true,"kind":"ServiceAccount","verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"shortNames":["sa"]},{"name":"services","singularName":"","namespaced":true,"kind":"Service","verbs":["create","delete","get","list","patch","update","watch"],"shortNames":["svc"],"categories":["all"]},{"name":"services/proxy","singularName":"","namespaced":true,"kind":"Service","verbs":[]},{"name":"services/status","singularName":"","namespaced":true,"kind":"Service","verbs":["get","patch","update"]}]}
32
+
33
+ '
34
+ http_version:
35
+ recorded_at: Tue, 16 Oct 2018 13:50:16 GMT
36
+ - request:
37
+ method: post
38
+ uri: https://192.168.122.51:8443/api/v1/namespaces/default/services
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"apiVersion":"v1","kind":"Service","metadata":{"name":"vmi-fedora-ssh","namespace":"default"},"spec":{"externalTrafficPolicy":"Cluster","ports":[{"nodePort":30000,"port":30000,"protocol":"TCP","targetPort":22}],"selector":{"kubevirt.io/vm":"vmi-fedora"},"type":"NodePort"}}'
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.4.2p198
49
+ Content-Type:
50
+ - application/json
51
+ Authorization:
52
+ - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJldmlydC1wcml2aWxlZ2VkLXRva2VuLW1xN252Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Imt1YmV2aXJ0LXByaXZpbGVnZWQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJjNGQyODA4MS1jZDNlLTExZTgtOGYzYy1hYzAxYzZkMzhmZWIiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06a3ViZXZpcnQtcHJpdmlsZWdlZCJ9.BUBWJi9a_A_rOrsiil7wEqxxdDOtpYt9M42HHdQr0JQ5Y2ES5xI2yecpdXPypfX4wa-8blj7xJyU3EZCSTUUX2Z-KXoYieYr6sKB-umYiK4MR4eSiBFL8J0QP_2zxZleUOAuAT8JZCHh7JbccUM0ebOtNPBCVDPb_j-zSsuSISBtayGzTzo7RgkyyO_2NfyYBv1b3gxlznGsWuqw6Kw01OE5Xs7EIDAbGn6Z51NUU3fE_UGZg5588z_WurEV_tJhfDGBIuIsWaJHHTmwnQ6kll4nWaqV5r3NlrSmk_z5m14rlmDRf2G-oTMkFlHgDjTbkZeUF8G0TT4FShQzrWSFhA
53
+ Content-Length:
54
+ - '274'
55
+ response:
56
+ status:
57
+ code: 201
58
+ message: Created
59
+ headers:
60
+ Content-Type:
61
+ - application/json
62
+ Date:
63
+ - Tue, 16 Oct 2018 13:50:16 GMT
64
+ Content-Length:
65
+ - '537'
66
+ body:
67
+ encoding: UTF-8
68
+ string: '{"kind":"Service","apiVersion":"v1","metadata":{"name":"vmi-fedora-ssh","namespace":"default","selfLink":"/api/v1/namespaces/default/services/vmi-fedora-ssh","uid":"69d29943-d14a-11e8-8f3c-ac01c6d38feb","resourceVersion":"165889","creationTimestamp":"2018-10-16T13:50:16Z"},"spec":{"ports":[{"protocol":"TCP","port":30000,"targetPort":22,"nodePort":30000}],"selector":{"kubevirt.io/vm":"vmi-fedora"},"clusterIP":"10.108.204.151","type":"NodePort","sessionAffinity":"None","externalTrafficPolicy":"Cluster"},"status":{"loadBalancer":{}}}
69
+
70
+ '
71
+ http_version:
72
+ recorded_at: Tue, 16 Oct 2018 13:50:16 GMT
73
+ - request:
74
+ method: get
75
+ uri: https://192.168.122.51:8443/api/v1/namespaces/default/services/vmi-fedora-ssh
76
+ body:
77
+ encoding: US-ASCII
78
+ string: ''
79
+ headers:
80
+ Accept:
81
+ - "*/*"
82
+ Accept-Encoding:
83
+ - gzip, deflate
84
+ User-Agent:
85
+ - rest-client/2.0.2 (linux-gnu x86_64) ruby/2.4.2p198
86
+ Authorization:
87
+ - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJldmlydC1wcml2aWxlZ2VkLXRva2VuLW1xN252Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Imt1YmV2aXJ0LXByaXZpbGVnZWQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJjNGQyODA4MS1jZDNlLTExZTgtOGYzYy1hYzAxYzZkMzhmZWIiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06a3ViZXZpcnQtcHJpdmlsZWdlZCJ9.BUBWJi9a_A_rOrsiil7wEqxxdDOtpYt9M42HHdQr0JQ5Y2ES5xI2yecpdXPypfX4wa-8blj7xJyU3EZCSTUUX2Z-KXoYieYr6sKB-umYiK4MR4eSiBFL8J0QP_2zxZleUOAuAT8JZCHh7JbccUM0ebOtNPBCVDPb_j-zSsuSISBtayGzTzo7RgkyyO_2NfyYBv1b3gxlznGsWuqw6Kw01OE5Xs7EIDAbGn6Z51NUU3fE_UGZg5588z_WurEV_tJhfDGBIuIsWaJHHTmwnQ6kll4nWaqV5r3NlrSmk_z5m14rlmDRf2G-oTMkFlHgDjTbkZeUF8G0TT4FShQzrWSFhA
88
+ response:
89
+ status:
90
+ code: 200
91
+ message: OK
92
+ headers:
93
+ Content-Type:
94
+ - application/json
95
+ Date:
96
+ - Tue, 16 Oct 2018 13:50:16 GMT
97
+ Content-Length:
98
+ - '537'
99
+ body:
100
+ encoding: UTF-8
101
+ string: '{"kind":"Service","apiVersion":"v1","metadata":{"name":"vmi-fedora-ssh","namespace":"default","selfLink":"/api/v1/namespaces/default/services/vmi-fedora-ssh","uid":"69d29943-d14a-11e8-8f3c-ac01c6d38feb","resourceVersion":"165889","creationTimestamp":"2018-10-16T13:50:16Z"},"spec":{"ports":[{"protocol":"TCP","port":30000,"targetPort":22,"nodePort":30000}],"selector":{"kubevirt.io/vm":"vmi-fedora"},"clusterIP":"10.108.204.151","type":"NodePort","sessionAffinity":"None","externalTrafficPolicy":"Cluster"},"status":{"loadBalancer":{}}}
102
+
103
+ '
104
+ http_version:
105
+ recorded_at: Tue, 16 Oct 2018 13:50:16 GMT
106
+ - request:
107
+ method: get
108
+ uri: https://192.168.122.51:8443/api/v1/namespaces/default/services/vmi-fedora-ssh
109
+ body:
110
+ encoding: US-ASCII
111
+ string: ''
112
+ headers:
113
+ Accept:
114
+ - "*/*"
115
+ Accept-Encoding:
116
+ - gzip, deflate
117
+ User-Agent:
118
+ - rest-client/2.0.2 (linux-gnu x86_64) ruby/2.4.2p198
119
+ Authorization:
120
+ - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJldmlydC1wcml2aWxlZ2VkLXRva2VuLW1xN252Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Imt1YmV2aXJ0LXByaXZpbGVnZWQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJjNGQyODA4MS1jZDNlLTExZTgtOGYzYy1hYzAxYzZkMzhmZWIiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06a3ViZXZpcnQtcHJpdmlsZWdlZCJ9.BUBWJi9a_A_rOrsiil7wEqxxdDOtpYt9M42HHdQr0JQ5Y2ES5xI2yecpdXPypfX4wa-8blj7xJyU3EZCSTUUX2Z-KXoYieYr6sKB-umYiK4MR4eSiBFL8J0QP_2zxZleUOAuAT8JZCHh7JbccUM0ebOtNPBCVDPb_j-zSsuSISBtayGzTzo7RgkyyO_2NfyYBv1b3gxlznGsWuqw6Kw01OE5Xs7EIDAbGn6Z51NUU3fE_UGZg5588z_WurEV_tJhfDGBIuIsWaJHHTmwnQ6kll4nWaqV5r3NlrSmk_z5m14rlmDRf2G-oTMkFlHgDjTbkZeUF8G0TT4FShQzrWSFhA
121
+ response:
122
+ status:
123
+ code: 200
124
+ message: OK
125
+ headers:
126
+ Content-Type:
127
+ - application/json
128
+ Date:
129
+ - Tue, 16 Oct 2018 13:50:16 GMT
130
+ Content-Length:
131
+ - '537'
132
+ body:
133
+ encoding: UTF-8
134
+ string: '{"kind":"Service","apiVersion":"v1","metadata":{"name":"vmi-fedora-ssh","namespace":"default","selfLink":"/api/v1/namespaces/default/services/vmi-fedora-ssh","uid":"69d29943-d14a-11e8-8f3c-ac01c6d38feb","resourceVersion":"165889","creationTimestamp":"2018-10-16T13:50:16Z"},"spec":{"ports":[{"protocol":"TCP","port":30000,"targetPort":22,"nodePort":30000}],"selector":{"kubevirt.io/vm":"vmi-fedora"},"clusterIP":"10.108.204.151","type":"NodePort","sessionAffinity":"None","externalTrafficPolicy":"Cluster"},"status":{"loadBalancer":{}}}
135
+
136
+ '
137
+ http_version:
138
+ recorded_at: Tue, 16 Oct 2018 13:50:16 GMT
139
+ - request:
140
+ method: delete
141
+ uri: https://192.168.122.51:8443/api/v1/namespaces/default/services/vmi-fedora-ssh
142
+ body:
143
+ encoding: US-ASCII
144
+ string: ''
145
+ headers:
146
+ Accept:
147
+ - "*/*"
148
+ Accept-Encoding:
149
+ - gzip, deflate
150
+ User-Agent:
151
+ - rest-client/2.0.2 (linux-gnu x86_64) ruby/2.4.2p198
152
+ Authorization:
153
+ - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJldmlydC1wcml2aWxlZ2VkLXRva2VuLW1xN252Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Imt1YmV2aXJ0LXByaXZpbGVnZWQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJjNGQyODA4MS1jZDNlLTExZTgtOGYzYy1hYzAxYzZkMzhmZWIiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06a3ViZXZpcnQtcHJpdmlsZWdlZCJ9.BUBWJi9a_A_rOrsiil7wEqxxdDOtpYt9M42HHdQr0JQ5Y2ES5xI2yecpdXPypfX4wa-8blj7xJyU3EZCSTUUX2Z-KXoYieYr6sKB-umYiK4MR4eSiBFL8J0QP_2zxZleUOAuAT8JZCHh7JbccUM0ebOtNPBCVDPb_j-zSsuSISBtayGzTzo7RgkyyO_2NfyYBv1b3gxlznGsWuqw6Kw01OE5Xs7EIDAbGn6Z51NUU3fE_UGZg5588z_WurEV_tJhfDGBIuIsWaJHHTmwnQ6kll4nWaqV5r3NlrSmk_z5m14rlmDRf2G-oTMkFlHgDjTbkZeUF8G0TT4FShQzrWSFhA
154
+ response:
155
+ status:
156
+ code: 200
157
+ message: OK
158
+ headers:
159
+ Content-Type:
160
+ - application/json
161
+ Date:
162
+ - Tue, 16 Oct 2018 13:50:16 GMT
163
+ Content-Length:
164
+ - '168'
165
+ body:
166
+ encoding: UTF-8
167
+ string: '{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Success","details":{"name":"vmi-fedora-ssh","kind":"services","uid":"69d29943-d14a-11e8-8f3c-ac01c6d38feb"}}
168
+
169
+ '
170
+ http_version:
171
+ recorded_at: Tue, 16 Oct 2018 13:50:16 GMT
172
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,54 @@
1
+ require 'vcr'
2
+
3
+ class KubevirtVCR
4
+ attr_reader :service,
5
+ :host,
6
+ :port,
7
+ :token
8
+
9
+ def initialize(options)
10
+ @vcr_directory = options[:vcr_directory]
11
+ @service_class = options[:service_class]
12
+
13
+ use_recorded = !ENV.key?('KUBE_HOST') || ENV['USE_VCR'] == 'true'
14
+ if use_recorded
15
+ Fog.interval = 0
16
+ @host = "192.168.122.51"
17
+ @port = "8443"
18
+ else
19
+ @host = ENV['KUBE_HOST']
20
+ @port = ENV['KUBE_PORT']
21
+ end
22
+
23
+ VCR.configure do |config|
24
+ config.allow_http_connections_when_no_cassette = true
25
+ config.hook_into :webmock
26
+
27
+ if use_recorded
28
+ config.cassette_library_dir = ENV['SPEC_PATH'] || @vcr_directory
29
+ config.default_cassette_options = {:record => :none}
30
+ config.default_cassette_options.merge! :match_requests_on => %i[method uri body]
31
+ else
32
+ config.cassette_library_dir = "spec/debug"
33
+ config.default_cassette_options = {:record => :all}
34
+ end
35
+ end
36
+
37
+ VCR.use_cassette('common_setup') do
38
+ @token = "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJldmlydC1wcml2aWxlZ2VkLXRva2VuLW1xN252Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Imt1YmV2aXJ0LXByaXZpbGVnZWQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJjNGQyODA4MS1jZDNlLTExZTgtOGYzYy1hYzAxYzZkMzhmZWIiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06a3ViZXZpcnQtcHJpdmlsZWdlZCJ9.BUBWJi9a_A_rOrsiil7wEqxxdDOtpYt9M42HHdQr0JQ5Y2ES5xI2yecpdXPypfX4wa-8blj7xJyU3EZCSTUUX2Z-KXoYieYr6sKB-umYiK4MR4eSiBFL8J0QP_2zxZleUOAuAT8JZCHh7JbccUM0ebOtNPBCVDPb_j-zSsuSISBtayGzTzo7RgkyyO_2NfyYBv1b3gxlznGsWuqw6Kw01OE5Xs7EIDAbGn6Z51NUU3fE_UGZg5588z_WurEV_tJhfDGBIuIsWaJHHTmwnQ6kll4nWaqV5r3NlrSmk_z5m14rlmDRf2G-oTMkFlHgDjTbkZeUF8G0TT4FShQzrWSFhA"
39
+
40
+ unless use_recorded
41
+ @token = ENV['KUBE_TOKEN'] || options[:token] || @token
42
+ end
43
+
44
+ connection_params = {
45
+ provider: 'kubevirt',
46
+ kubevirt_hostname: @host,
47
+ kubevirt_port: @port,
48
+ kubevirt_token: @token
49
+ }
50
+
51
+ @service = @service_class.new(connection_params)
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,10 @@
1
+ require 'minitest/autorun'
2
+ require 'vcr'
3
+ require 'fog/core'
4
+ require 'fog/kubevirt'
5
+
6
+ VCR.configure do |c|
7
+ c.cassette_library_dir = 'spec/fixtures/kubevirt'
8
+ c.hook_into :webmock
9
+ c.debug_logger = nil # use $stderr to debug
10
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-kubevirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Kliczewski
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-07-18 00:00:00.000000000 Z
14
+ date: 2018-12-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -27,6 +27,20 @@ dependencies:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
29
  version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: minitest
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
30
44
  - !ruby/object:Gem::Dependency
31
45
  name: rake
32
46
  requirement: !ruby/object:Gem::Requirement
@@ -69,6 +83,34 @@ dependencies:
69
83
  - - ">="
70
84
  - !ruby/object:Gem::Version
71
85
  version: '0'
86
+ - !ruby/object:Gem::Dependency
87
+ name: vcr
88
+ requirement: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ type: :development
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ - !ruby/object:Gem::Dependency
101
+ name: webmock
102
+ requirement: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ type: :development
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
72
114
  - !ruby/object:Gem::Dependency
73
115
  name: fog-core
74
116
  requirement: !ruby/object:Gem::Requirement
@@ -89,14 +131,14 @@ dependencies:
89
131
  requirements:
90
132
  - - "~>"
91
133
  - !ruby/object:Gem::Version
92
- version: 2.5.2
134
+ version: 4.0.0
93
135
  type: :runtime
94
136
  prerelease: false
95
137
  version_requirements: !ruby/object:Gem::Requirement
96
138
  requirements:
97
139
  - - "~>"
98
140
  - !ruby/object:Gem::Version
99
- version: 2.5.2
141
+ version: 4.0.0
100
142
  description: This library can be used as a module for `fog`.
101
143
  email:
102
144
  - piotr.kliczewski@gmail.com
@@ -113,30 +155,46 @@ files:
113
155
  - lib/fog/compute/kubevirt.rb
114
156
  - lib/fog/compute/kubevirt/models/node.rb
115
157
  - lib/fog/compute/kubevirt/models/nodes.rb
158
+ - lib/fog/compute/kubevirt/models/server.rb
159
+ - lib/fog/compute/kubevirt/models/servers.rb
160
+ - lib/fog/compute/kubevirt/models/service.rb
161
+ - lib/fog/compute/kubevirt/models/services.rb
116
162
  - lib/fog/compute/kubevirt/models/template.rb
117
163
  - lib/fog/compute/kubevirt/models/templates.rb
118
164
  - lib/fog/compute/kubevirt/models/vm.rb
165
+ - lib/fog/compute/kubevirt/models/vm_base.rb
166
+ - lib/fog/compute/kubevirt/models/vm_data.rb
119
167
  - lib/fog/compute/kubevirt/models/vminstance.rb
120
168
  - lib/fog/compute/kubevirt/models/vminstances.rb
121
169
  - lib/fog/compute/kubevirt/models/vms.rb
122
170
  - lib/fog/compute/kubevirt/models/volume.rb
123
171
  - lib/fog/compute/kubevirt/models/volumes.rb
124
172
  - lib/fog/compute/kubevirt/requests/create_pvc.rb
173
+ - lib/fog/compute/kubevirt/requests/create_service.rb
125
174
  - lib/fog/compute/kubevirt/requests/create_vm.rb
126
175
  - lib/fog/compute/kubevirt/requests/create_vminstance.rb
176
+ - lib/fog/compute/kubevirt/requests/delete_service.rb
127
177
  - lib/fog/compute/kubevirt/requests/delete_vm.rb
128
178
  - lib/fog/compute/kubevirt/requests/delete_vminstance.rb
129
179
  - lib/fog/compute/kubevirt/requests/get_node.rb
180
+ - lib/fog/compute/kubevirt/requests/get_server.rb
181
+ - lib/fog/compute/kubevirt/requests/get_service.rb
130
182
  - lib/fog/compute/kubevirt/requests/get_template.rb
131
183
  - lib/fog/compute/kubevirt/requests/get_vm.rb
132
184
  - lib/fog/compute/kubevirt/requests/get_vminstance.rb
133
185
  - lib/fog/compute/kubevirt/requests/list_nodes.rb
186
+ - lib/fog/compute/kubevirt/requests/list_servers.rb
187
+ - lib/fog/compute/kubevirt/requests/list_services.rb
134
188
  - lib/fog/compute/kubevirt/requests/list_templates.rb
135
189
  - lib/fog/compute/kubevirt/requests/list_vminstances.rb
136
190
  - lib/fog/compute/kubevirt/requests/list_vms.rb
137
191
  - lib/fog/compute/kubevirt/requests/update_vm.rb
138
192
  - lib/fog/kubevirt.rb
139
193
  - lib/fog/kubevirt/version.rb
194
+ - spec/compute_v1alpha2_spec.rb
195
+ - spec/fixtures/kubevirt/service/v1alpha2/services_crud.yml
196
+ - spec/shared_context.rb
197
+ - spec/spec_helper.rb
140
198
  homepage: https://github.com/pkliczewski/fog-kubevirt
141
199
  licenses:
142
200
  - Apache-2.0
@@ -161,4 +219,8 @@ rubygems_version: 2.6.14
161
219
  signing_key:
162
220
  specification_version: 4
163
221
  summary: Module for the 'fog' gem to support Kubevirt.
164
- test_files: []
222
+ test_files:
223
+ - spec/compute_v1alpha2_spec.rb
224
+ - spec/fixtures/kubevirt/service/v1alpha2/services_crud.yml
225
+ - spec/shared_context.rb
226
+ - spec/spec_helper.rb