fog-kubevirt 1.3.1 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fog/kubevirt/compute/compute.rb +23 -6
- data/lib/fog/kubevirt/compute/models/vm_parser.rb +1 -1
- data/lib/fog/kubevirt/compute/models/vminstances.rb +4 -0
- data/lib/fog/kubevirt/compute/requests/get_template.rb +1 -1
- data/lib/fog/kubevirt/compute/requests/get_vnc_console_details.rb +29 -0
- data/lib/fog/kubevirt/compute/requests/list_templates.rb +1 -1
- data/lib/fog/kubevirt/version.rb +1 -1
- metadata +12 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3179fe8d9931ca7ea27fe0f345109c213c60d030045a4678d2951ec0fad61dd
|
4
|
+
data.tar.gz: ee83703dadbf2509eef8905117a935f1c7cbb14b3aa7f17b2334821502b3592d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a6fc1a166cdc365409d1ad16aa665d8672037174aa54f66d39698defb4a03ebe8376da5553e64c55dac13129b097e1399af9825a333125601e46a4e78b4eabb
|
7
|
+
data.tar.gz: 408db587d8256e0cfa20f103bab0be5f62f5b56b8acdc2829e1a23e17f1bfaa5dd83f3eb9978975aaf398c2b6cd952675d506b8b1227185a2a60c401582c36a7
|
@@ -9,7 +9,7 @@ module Fog
|
|
9
9
|
module Kubevirt
|
10
10
|
class Compute < Fog::Service
|
11
11
|
recognizes :kubevirt_token, :kubevirt_hostname, :kubevirt_port, :kubevirt_namespace, \
|
12
|
-
:kubevirt_log, :kubevirt_verify_ssl, :kubevirt_ca_cert
|
12
|
+
:kubevirt_log, :kubevirt_verify_ssl, :kubevirt_ca_cert , :kubevirt_version
|
13
13
|
|
14
14
|
model_path 'fog/kubevirt/compute/models'
|
15
15
|
model :vminstance
|
@@ -60,6 +60,7 @@ module Fog
|
|
60
60
|
request :get_service
|
61
61
|
request :get_storageclass
|
62
62
|
request :get_template
|
63
|
+
request :get_vnc_console_details
|
63
64
|
request :list_vminstances
|
64
65
|
request :list_nodes
|
65
66
|
request :list_networkattachmentdefs
|
@@ -147,12 +148,18 @@ module Fog
|
|
147
148
|
#
|
148
149
|
STORAGE_GROUP = 'storage.k8s.io'.freeze
|
149
150
|
|
151
|
+
#
|
152
|
+
# The API group of the Openshift Templates extension:
|
153
|
+
#
|
154
|
+
TEMPLATE_GROUP = 'template.openshift.io'.freeze
|
155
|
+
|
150
156
|
def initialize(options={})
|
151
157
|
require 'kubeclient'
|
152
158
|
|
153
159
|
@kubevirt_token = options[:kubevirt_token]
|
154
160
|
@host = options[:kubevirt_hostname]
|
155
161
|
@port = options[:kubevirt_port]
|
162
|
+
@kubevirt_version = options[:kubevirt_version]
|
156
163
|
|
157
164
|
@log = options[:kubevirt_log]
|
158
165
|
@log ||= ::Logger.new(STDOUT)
|
@@ -283,7 +290,7 @@ module Fog
|
|
283
290
|
populate_notice_attributes(template, notice)
|
284
291
|
template
|
285
292
|
end
|
286
|
-
watch =
|
293
|
+
watch = openshift_template_client.watch_templates(opts)
|
287
294
|
|
288
295
|
WatchWrapper.new(watch, mapper)
|
289
296
|
end
|
@@ -420,12 +427,17 @@ module Fog
|
|
420
427
|
# version detected based on
|
421
428
|
# https://github.com/kubernetes-incubator/apiserver-builder/blob/master/docs/concepts/aggregation.md#viewing-discovery-information
|
422
429
|
preferredVersion = response["preferredVersion"]
|
423
|
-
|
424
|
-
|
430
|
+
if url.include? KUBEVIRT_GROUP
|
431
|
+
version = @kubevirt_version || preferredVersion["version"]
|
432
|
+
else
|
433
|
+
version = preferredVersion["version"] if preferredVersion
|
434
|
+
version = version || response["versions"][0]
|
435
|
+
end
|
436
|
+
version
|
425
437
|
end
|
426
438
|
|
427
|
-
def
|
428
|
-
create_client('/
|
439
|
+
def openshift_template_client
|
440
|
+
create_client('/apis/' + TEMPLATE_GROUP)
|
429
441
|
end
|
430
442
|
|
431
443
|
def kube_client
|
@@ -448,6 +460,10 @@ module Fog
|
|
448
460
|
@log
|
449
461
|
end
|
450
462
|
|
463
|
+
def cert_expired?(cert)
|
464
|
+
Time.now > cert.not_after
|
465
|
+
end
|
466
|
+
|
451
467
|
#
|
452
468
|
# Prepare the TLS and authentication options that will be used for the
|
453
469
|
# standard Kubernetes API and also for the KubeVirt extension
|
@@ -465,6 +481,7 @@ module Fog
|
|
465
481
|
|
466
482
|
cert_store = OpenSSL::X509::Store.new
|
467
483
|
certs.each do |cert|
|
484
|
+
raise ::Fog::Kubevirt::Errors::ValidationError, "Certificate has been expired" if cert_expired?(cert)
|
468
485
|
cert_store.add_cert(cert)
|
469
486
|
end
|
470
487
|
|
@@ -139,7 +139,7 @@ module Fog
|
|
139
139
|
|
140
140
|
volume.config = v[volume.type.to_sym]
|
141
141
|
disk = disks.detect { |d| d.name == volume.name }
|
142
|
-
volume.boot_order = disk.boot_order
|
142
|
+
volume.boot_order = disk.boot_order if disk.respond_to?(:boot_order)
|
143
143
|
volume.bus = disk.bus if disk.respond_to?(:bus)
|
144
144
|
|
145
145
|
volumes << volume
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Fog
|
2
|
+
module Kubevirt
|
3
|
+
class Compute
|
4
|
+
class Real
|
5
|
+
def get_vnc_console_details(name, namespace)
|
6
|
+
|
7
|
+
url = URI::Generic.build(
|
8
|
+
:scheme => 'https',
|
9
|
+
:host => @host,
|
10
|
+
:port => @port,
|
11
|
+
:path => "/apis/kubevirt.io"
|
12
|
+
)
|
13
|
+
version = detect_version(url.to_s, @opts[:ssl_options])
|
14
|
+
{
|
15
|
+
:host => @host,
|
16
|
+
:port => @port,
|
17
|
+
:path => "/apis/subresources.kubevirt.io/#{version}/namespaces/#{namespace}/virtualmachineinstances/#{name}/vnc",
|
18
|
+
:token => @opts[:auth_options][:bearer_token]
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Mock
|
24
|
+
def get_vnc_console_details(name, namespace)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -5,7 +5,7 @@ module Fog
|
|
5
5
|
class Compute
|
6
6
|
class Real
|
7
7
|
def list_templates(_filters = {})
|
8
|
-
temps =
|
8
|
+
temps = openshift_template_client.get_templates(namespace: @namespace)
|
9
9
|
entities = temps.map do |kubevirt_obj|
|
10
10
|
Template.parse object_to_hash(kubevirt_obj)
|
11
11
|
end
|
data/lib/fog/kubevirt/version.rb
CHANGED
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: 1.3.
|
4
|
+
version: 1.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Kliczewski
|
@@ -11,11 +11,12 @@ authors:
|
|
11
11
|
- Adam Grare
|
12
12
|
- Boris Odnopozov
|
13
13
|
- Shira Maximov
|
14
|
+
- yifatmakias
|
14
15
|
- Wesley Beary
|
15
|
-
autorequire:
|
16
|
+
autorequire:
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
|
-
date:
|
19
|
+
date: 2022-02-02 00:00:00.000000000 Z
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: minitest
|
@@ -121,23 +122,24 @@ dependencies:
|
|
121
122
|
requirements:
|
122
123
|
- - "~>"
|
123
124
|
- !ruby/object:Gem::Version
|
124
|
-
version: 4.3
|
125
|
+
version: '4.3'
|
125
126
|
type: :runtime
|
126
127
|
prerelease: false
|
127
128
|
version_requirements: !ruby/object:Gem::Requirement
|
128
129
|
requirements:
|
129
130
|
- - "~>"
|
130
131
|
- !ruby/object:Gem::Version
|
131
|
-
version: 4.3
|
132
|
+
version: '4.3'
|
132
133
|
description: This library can be used as a module for `fog`.
|
133
134
|
email:
|
134
135
|
- piotr.kliczewski@gmail.com
|
135
136
|
- masayag@redhat.com
|
136
137
|
- plribeiro3000@gmail.com
|
137
138
|
- gilles@redhat.com
|
138
|
-
-
|
139
|
+
- adam@grare.com
|
139
140
|
- bodnopoz@redhat.com
|
140
141
|
- shiramaximov@gmail.com
|
142
|
+
- ymakias@redhat.com
|
141
143
|
- geemus@gmail.com
|
142
144
|
executables: []
|
143
145
|
extensions: []
|
@@ -199,6 +201,7 @@ files:
|
|
199
201
|
- lib/fog/kubevirt/compute/requests/get_template.rb
|
200
202
|
- lib/fog/kubevirt/compute/requests/get_vm.rb
|
201
203
|
- lib/fog/kubevirt/compute/requests/get_vminstance.rb
|
204
|
+
- lib/fog/kubevirt/compute/requests/get_vnc_console_details.rb
|
202
205
|
- lib/fog/kubevirt/compute/requests/list_networkattachmentdefs.rb
|
203
206
|
- lib/fog/kubevirt/compute/requests/list_nodes.rb
|
204
207
|
- lib/fog/kubevirt/compute/requests/list_persistentvolumes.rb
|
@@ -243,7 +246,7 @@ homepage: https://github.com/fog/fog-kubevirt
|
|
243
246
|
licenses:
|
244
247
|
- Apache-2.0
|
245
248
|
metadata: {}
|
246
|
-
post_install_message:
|
249
|
+
post_install_message:
|
247
250
|
rdoc_options: []
|
248
251
|
require_paths:
|
249
252
|
- lib
|
@@ -258,8 +261,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
261
|
- !ruby/object:Gem::Version
|
259
262
|
version: '0'
|
260
263
|
requirements: []
|
261
|
-
rubygems_version: 3.
|
262
|
-
signing_key:
|
264
|
+
rubygems_version: 3.1.6
|
265
|
+
signing_key:
|
263
266
|
specification_version: 4
|
264
267
|
summary: Module for the 'fog' gem to support Kubevirt.
|
265
268
|
test_files:
|