kuby-kind 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile +1 -0
- data/Rakefile +1 -0
- data/lib/kuby/kind/provider.rb +38 -3
- data/lib/kuby/kind/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32168f7821c5fdc2b593f00e355d4033b2eb9f957b3f306e26f743484d9ee74c
|
4
|
+
data.tar.gz: 4b75e6a5f900bd24760d90350e594557bfcb4830b6d963766c82e94a822ad640
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 162a12291e5c63fbcc66e63d344c566be36f0d1894b4bf7e84e07bb49166354296f338fc4f23a4d7c3227380e63c7a7f9bd72ac86ffdbfd624fb439d0a4147c2
|
7
|
+
data.tar.gz: e892e6f0732ef8bbd0205fdcd45d74a02031166c42bbd3e2e584583125eaa7a3075ca0fd77edab376d578bfb186f68813e59acd7e8deebfc8f48b5c6ea8dbc0f
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/lib/kuby/kind/provider.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'kuby'
|
2
2
|
require 'kind-rb'
|
3
3
|
require 'open3'
|
4
|
+
require 'tmpdir'
|
4
5
|
|
5
6
|
module Kuby
|
6
7
|
module Kind
|
@@ -62,14 +63,44 @@ module Kuby
|
|
62
63
|
end
|
63
64
|
|
64
65
|
def load_images
|
66
|
+
require 'pry-byebug'
|
65
67
|
Kuby.logger.info("Loading Docker images into Kind cluster...")
|
66
68
|
|
69
|
+
node_name = "#{cluster_name}-control-plane"
|
70
|
+
loaded_images = YAML.load(
|
71
|
+
docker_cli.exec_capture(
|
72
|
+
container: node_name,
|
73
|
+
command: '/usr/local/bin/crictl images --digests -o yaml'
|
74
|
+
)
|
75
|
+
)
|
76
|
+
|
77
|
+
loaded_digests = loaded_images['images'].map do |image|
|
78
|
+
algo, digest = image['id'].split(':')
|
79
|
+
{ algo: algo, digest: digest }
|
80
|
+
end
|
81
|
+
|
67
82
|
environment.kubernetes.docker_images.each do |image|
|
68
83
|
image = image.current_version
|
69
84
|
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
85
|
+
# Avoid loading images into the cluster if they're already there. Kind tries to detect this
|
86
|
+
# on its own and will even emit log messages to that effect, but appears to load them
|
87
|
+
# anyway. Since loading images can be quite time-consuming, we do our own check below.
|
88
|
+
images = docker_cli.images(image.image_url, digests: true)
|
89
|
+
image_info = images.find { |img| img[:tag] == image.main_tag }
|
90
|
+
|
91
|
+
if image_info
|
92
|
+
algo, _ = image_info[:digest].split(':')
|
93
|
+
|
94
|
+
loaded_digest = loaded_digests.find do |loaded_digest|
|
95
|
+
algo == loaded_digest[:algo] && loaded_digest[:digest].start_with?(image_info[:id])
|
96
|
+
end
|
97
|
+
|
98
|
+
if loaded_digest
|
99
|
+
Kuby.logger.info("Skipping #{image.image_url}@#{loaded_digest[:algo]}:#{loaded_digest[:digest]} because it's already loaded.")
|
100
|
+
next
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
73
104
|
cmd = [
|
74
105
|
KindRb.executable,
|
75
106
|
'load', 'docker-image', "#{image.image_url}:#{image.main_tag}",
|
@@ -213,6 +244,10 @@ module Kuby
|
|
213
244
|
Dir.tmpdir, 'kuby-kind'
|
214
245
|
)
|
215
246
|
end
|
247
|
+
|
248
|
+
def docker_cli
|
249
|
+
@docker_cli ||= Docker::CLI.new
|
250
|
+
end
|
216
251
|
end
|
217
252
|
end
|
218
253
|
end
|
data/lib/kuby/kind/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuby-kind
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kuby-core
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
|
-
rubygems_version: 3.
|
82
|
+
rubygems_version: 3.4.5
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Kind provider for Kuby.
|