fog-kubevirt 1.3.2 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13af0b3678fefb7ef6709a18c0c6e0ee899eea9d84b80c5e0fb580909251cdb5
4
- data.tar.gz: 9b94a11d2b6f16d237fbcdd9699317f14fb396b332a18421c12ae1b31f4f0067
3
+ metadata.gz: 7dafed958753ab0d7cdd1490fb6676eb74b0c19052f23af6b45390e79ea0860a
4
+ data.tar.gz: 32d48713cd5c8a191a5bd3dec125e6f2b658f83d4549fc047ac95a374bd4ca0a
5
5
  SHA512:
6
- metadata.gz: 6923ee0319db3ead3a93b92955081b3fe050a40d77e1e049348eba9fed2a78d53e046ccd8ab39daea3716a3bb1d4616f5e28b18c0ba184715644c63c5c1676ad
7
- data.tar.gz: 33024e576e2c80ce45f22f3d5eb46f3ee1c599bcd8efd77354a61c97dc63818fc0c249da6a2a50dbf23083f0dd659299cb69bb44b2ef2df2ee9192c828144895
6
+ metadata.gz: 65aa9a7aec64f8cc5eb3474b9daa25582b0583e639b58f0879dc8d85309a38e4ce6b1ee373bdde1a88571c4868ec3ef804f5020e5c4e8bc372ba4fa12823843c
7
+ data.tar.gz: 2efc96fd3b0c058c0755fc0200f4176fa5962ea6dd66760c4d4d68fa29f702079e27c59fb3cab47c47b4a26edcdfed617596d33ff7f3500ffe63229c25288b61
@@ -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
@@ -148,12 +148,18 @@ module Fog
148
148
  #
149
149
  STORAGE_GROUP = 'storage.k8s.io'.freeze
150
150
 
151
+ #
152
+ # The API group of the Openshift Templates extension:
153
+ #
154
+ TEMPLATE_GROUP = 'template.openshift.io'.freeze
155
+
151
156
  def initialize(options={})
152
157
  require 'kubeclient'
153
158
 
154
159
  @kubevirt_token = options[:kubevirt_token]
155
160
  @host = options[:kubevirt_hostname]
156
161
  @port = options[:kubevirt_port]
162
+ @kubevirt_version = options[:kubevirt_version]
157
163
 
158
164
  @log = options[:kubevirt_log]
159
165
  @log ||= ::Logger.new(STDOUT)
@@ -284,7 +290,7 @@ module Fog
284
290
  populate_notice_attributes(template, notice)
285
291
  template
286
292
  end
287
- watch = openshift_client.watch_templates(opts)
293
+ watch = openshift_template_client.watch_templates(opts)
288
294
 
289
295
  WatchWrapper.new(watch, mapper)
290
296
  end
@@ -421,12 +427,17 @@ module Fog
421
427
  # version detected based on
422
428
  # https://github.com/kubernetes-incubator/apiserver-builder/blob/master/docs/concepts/aggregation.md#viewing-discovery-information
423
429
  preferredVersion = response["preferredVersion"]
424
- return preferredVersion["version"] if preferredVersion
425
- response["versions"][0]
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
426
437
  end
427
438
 
428
- def openshift_client
429
- create_client('/oapi')
439
+ def openshift_template_client
440
+ create_client('/apis/' + TEMPLATE_GROUP)
430
441
  end
431
442
 
432
443
  def kube_client
@@ -449,6 +460,10 @@ module Fog
449
460
  @log
450
461
  end
451
462
 
463
+ def cert_expired?(cert)
464
+ Time.now > cert.not_after
465
+ end
466
+
452
467
  #
453
468
  # Prepare the TLS and authentication options that will be used for the
454
469
  # standard Kubernetes API and also for the KubeVirt extension
@@ -466,6 +481,7 @@ module Fog
466
481
 
467
482
  cert_store = OpenSSL::X509::Store.new
468
483
  certs.each do |cert|
484
+ raise ::Fog::Kubevirt::Errors::ValidationError, "Certificate has been expired" if cert_expired?(cert)
469
485
  cert_store.add_cert(cert)
470
486
  end
471
487
 
@@ -12,12 +12,16 @@ module Fog
12
12
  def all(filters = {})
13
13
  begin
14
14
  srvs = service.list_services(filters)
15
+
16
+ @kind = srvs.kind
17
+ @resource_version = srvs.resource_version
15
18
  rescue ::Fog::Kubevirt::Errors::ClientError
16
19
  # we assume that we get 404
17
20
  srvs = []
21
+
22
+ @kind = 'Service'
18
23
  end
19
- @kind = srvs.kind
20
- @resource_version = srvs.resource_version
24
+
21
25
  load srvs
22
26
  end
23
27
 
@@ -12,12 +12,16 @@ module Fog
12
12
  def all(filters = {})
13
13
  begin
14
14
  temps = service.list_templates(filters)
15
+
16
+ @kind = temps.kind
17
+ @resource_version = temps.resource_version
15
18
  rescue ::Fog::Kubevirt::Errors::ClientError
16
19
  # we assume that we get 404
17
20
  temps = []
21
+
22
+ @kind = 'Template'
18
23
  end
19
- @kind = temps.kind
20
- @resource_version = temps.resource_version
24
+
21
25
  load temps
22
26
  end
23
27
 
@@ -12,12 +12,16 @@ module Fog
12
12
  def all(filters = {})
13
13
  begin
14
14
  vms = service.list_vminstances(filters)
15
+
16
+ @kind = vms.kind
17
+ @resource_version = vms.resource_version
15
18
  rescue ::Fog::Kubevirt::Errors::ClientError
16
19
  # we assume that we get 404
17
20
  vms = []
21
+
22
+ @kind = 'VirtualMachineInstance'
18
23
  end
19
- @kind = vms.kind
20
- @resource_version = vms.resource_version
24
+
21
25
  load vms
22
26
  end
23
27
 
@@ -14,12 +14,16 @@ module Fog
14
14
  def all(filters = {})
15
15
  begin
16
16
  vms = service.list_vms(filters)
17
+
18
+ @kind = vms.kind
19
+ @resource_version = vms.resource_version
17
20
  rescue ::Fog::Kubevirt::Errors::ClientError
18
21
  # we assume that we get 404
19
22
  vms = []
23
+
24
+ @kind = 'VirtualMachine'
20
25
  end
21
- @kind = vms.kind
22
- @resource_version = vms.resource_version
26
+
23
27
  load vms
24
28
  end
25
29
 
@@ -3,7 +3,7 @@ module Fog
3
3
  class Compute
4
4
  class Real
5
5
  def get_template(name)
6
- Template.parse object_to_hash( openshift_client.get_template(name, @namespace) )
6
+ Template.parse object_to_hash( openshift_template_client.get_template(name, @namespace) )
7
7
  end
8
8
  end
9
9
 
@@ -5,7 +5,7 @@ module Fog
5
5
  class Compute
6
6
  class Real
7
7
  def list_templates(_filters = {})
8
- temps = openshift_client.get_templates(namespace: @namespace)
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
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Kubevirt
3
- VERSION = '1.3.2'
3
+ VERSION = '1.3.6'
4
4
  end
5
5
  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: 1.3.2
4
+ version: 1.3.6
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: 2019-08-26 00:00:00.000000000 Z
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.0
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.0
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
- - agrare@redhat.com
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: []
@@ -244,7 +246,7 @@ homepage: https://github.com/fog/fog-kubevirt
244
246
  licenses:
245
247
  - Apache-2.0
246
248
  metadata: {}
247
- post_install_message:
249
+ post_install_message:
248
250
  rdoc_options: []
249
251
  require_paths:
250
252
  - lib
@@ -259,8 +261,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
261
  - !ruby/object:Gem::Version
260
262
  version: '0'
261
263
  requirements: []
262
- rubygems_version: 3.0.3
263
- signing_key:
264
+ rubygems_version: 3.1.6
265
+ signing_key:
264
266
  specification_version: 4
265
267
  summary: Module for the 'fog' gem to support Kubevirt.
266
268
  test_files: