fog-kubevirt 0.3.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/lib/fog/bin/kubevirt.rb +2 -2
- data/lib/fog/kubevirt.rb +1 -4
- data/lib/fog/{compute/kubevirt.rb → kubevirt/compute/compute.rb} +35 -184
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/models/node.rb +3 -3
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/models/nodes.rb +4 -4
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/models/template.rb +2 -2
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/models/templates.rb +4 -4
- data/lib/fog/kubevirt/compute/models/vm.rb +71 -0
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/models/vminstance.rb +4 -13
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/models/vminstances.rb +4 -4
- data/lib/fog/kubevirt/compute/models/vms.rb +137 -0
- data/lib/fog/kubevirt/compute/models/volume.rb +9 -0
- data/lib/fog/kubevirt/compute/models/volumes.rb +12 -0
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/create_pvc.rb +2 -2
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/create_vm.rb +2 -3
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/create_vminstance.rb +2 -2
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/delete_vm.rb +3 -3
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/delete_vminstance.rb +5 -5
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/get_node.rb +2 -2
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/get_template.rb +2 -2
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/get_vm.rb +3 -3
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/get_vminstance.rb +6 -6
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/list_nodes.rb +2 -2
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/list_templates.rb +2 -2
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/list_vminstances.rb +2 -2
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/list_vms.rb +6 -6
- data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/update_vm.rb +2 -2
- data/lib/fog/kubevirt/version.rb +1 -1
- metadata +39 -133
- data/lib/fog/compute/kubevirt/models/networkattachmentdef.rb +0 -25
- data/lib/fog/compute/kubevirt/models/networkattachmentdefs.rb +0 -59
- data/lib/fog/compute/kubevirt/models/persistentvolume.rb +0 -82
- data/lib/fog/compute/kubevirt/models/persistentvolumes.rb +0 -73
- data/lib/fog/compute/kubevirt/models/pvc.rb +0 -59
- data/lib/fog/compute/kubevirt/models/pvcs.rb +0 -76
- data/lib/fog/compute/kubevirt/models/server.rb +0 -44
- data/lib/fog/compute/kubevirt/models/servers.rb +0 -32
- data/lib/fog/compute/kubevirt/models/service.rb +0 -36
- data/lib/fog/compute/kubevirt/models/services.rb +0 -83
- data/lib/fog/compute/kubevirt/models/storageclass.rb +0 -33
- data/lib/fog/compute/kubevirt/models/storageclasses.rb +0 -61
- data/lib/fog/compute/kubevirt/models/vm.rb +0 -17
- data/lib/fog/compute/kubevirt/models/vm_base.rb +0 -86
- data/lib/fog/compute/kubevirt/models/vm_data.rb +0 -162
- data/lib/fog/compute/kubevirt/models/vms.rb +0 -206
- data/lib/fog/compute/kubevirt/models/volume.rb +0 -57
- data/lib/fog/compute/kubevirt/models/volumes.rb +0 -18
- data/lib/fog/compute/kubevirt/requests/create_networkattachmentdef.rb +0 -37
- data/lib/fog/compute/kubevirt/requests/create_persistentvolume.rb +0 -19
- data/lib/fog/compute/kubevirt/requests/create_service.rb +0 -18
- data/lib/fog/compute/kubevirt/requests/create_storageclass.rb +0 -18
- data/lib/fog/compute/kubevirt/requests/delete_networkattachmentdef.rb +0 -16
- data/lib/fog/compute/kubevirt/requests/delete_persistentvolume.rb +0 -16
- data/lib/fog/compute/kubevirt/requests/delete_pvc.rb +0 -16
- data/lib/fog/compute/kubevirt/requests/delete_service.rb +0 -16
- data/lib/fog/compute/kubevirt/requests/delete_storageclass.rb +0 -16
- data/lib/fog/compute/kubevirt/requests/get_networkattachmentdef.rb +0 -19
- data/lib/fog/compute/kubevirt/requests/get_persistentvolume.rb +0 -16
- data/lib/fog/compute/kubevirt/requests/get_pvc.rb +0 -16
- data/lib/fog/compute/kubevirt/requests/get_server.rb +0 -32
- data/lib/fog/compute/kubevirt/requests/get_service.rb +0 -16
- data/lib/fog/compute/kubevirt/requests/get_storageclass.rb +0 -16
- data/lib/fog/compute/kubevirt/requests/list_networkattachmentdefs.rb +0 -21
- data/lib/fog/compute/kubevirt/requests/list_persistentvolumes.rb +0 -22
- data/lib/fog/compute/kubevirt/requests/list_pvcs.rb +0 -22
- data/lib/fog/compute/kubevirt/requests/list_servers.rb +0 -25
- data/lib/fog/compute/kubevirt/requests/list_services.rb +0 -22
- data/lib/fog/compute/kubevirt/requests/list_storageclasses.rb +0 -22
- data/lib/fog/compute/kubevirt/requests/list_volumes.rb +0 -30
- data/spec/compute_v1alpha2_spec.rb +0 -30
- data/spec/create_vm_spec.rb +0 -101
- data/spec/fixtures/kubevirt/networkattachmentdefinition/networkattachmentdefinitions_crud.yml +0 -320
- data/spec/fixtures/kubevirt/persistentvolume/persistent_volumes_crud.yml +0 -316
- data/spec/fixtures/kubevirt/pvc/pvcs_crud.yml +0 -362
- data/spec/fixtures/kubevirt/service/services_crud.yml +0 -316
- data/spec/fixtures/kubevirt/storageclass/storageclasses_crud.yml +0 -400
- data/spec/fixtures/kubevirt/vm/vm_create_multi.yml +0 -459
- data/spec/fixtures/kubevirt/vm/vm_create_single.yml +0 -362
- data/spec/network_attachment_definition_v1alpha2_spec.rb +0 -28
- data/spec/persistent_volumes_v1alpha2_spec.rb +0 -45
- data/spec/pvcs_v1alpha2_spec.rb +0 -59
- data/spec/shared_context.rb +0 -54
- data/spec/spec_helper.rb +0 -10
- data/spec/storage_classes_v1_spec.rb +0 -46
data/spec/shared_context.rb
DELETED
@@ -1,54 +0,0 @@
|
|
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 = "10.8.254.82"
|
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.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6Im15LWFjY291bnQtdG9rZW4ta3FsZDYiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoibXktYWNjb3VudCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjJlYjVjZjU1LTFlNDUtMTFlOS1iYmZmLWZhMTYzZTM4OTEyYSIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpkZWZhdWx0Om15LWFjY291bnQifQ.aAigSXFZapxJdFy3FwgSNc77jZYFiSTlG7D_AnHzBT1ZP69xLmrqI_oXt73NDLpecNWezjIvsCU6sLf45tfPY2RQX_aEAOXKWjFs2SxWI7GeQ-sWRt0yd1sOB9R48ipTdpNpNs5pypnTRg6dYLvtePmBWyOSN2412F9XKeM79tuO9a_ynPDjkCwsWJXGj-gX9DwpHdGK-cup0YosJ-9OpvXoWOiUNeBi1KrvJxgQwgLytJk3PHFnJHv4mCNALvvo1cu89_ENwUQrvok267ACeq53YsivYn7B0QWuZoX3ca4Bx14kEdXbd-9BvIEBZzVovH2ZvPTYMmyXgnpO7c1eOw"
|
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
|
data/spec/spec_helper.rb
DELETED
@@ -1,46 +0,0 @@
|
|
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/storageclass',
|
10
|
-
service_class: Fog::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
|