kuby-kind 0.2.0 → 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 +7 -0
- data/Gemfile +1 -0
- data/Rakefile +1 -0
- data/lib/kuby/kind/provider.rb +41 -4
- 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
@@ -1,3 +1,10 @@
|
|
1
|
+
## 0.2.2
|
2
|
+
* Add missing 'require'.
|
3
|
+
|
4
|
+
## 0.2.1
|
5
|
+
* Only create cluster and load images on deploy.
|
6
|
+
- Uses the `deploy` hook instead of `before_deploy`, which is called during `kuby resources` used to simulate a deploy so tag info is populated correctly.
|
7
|
+
|
1
8
|
## 0.2.0
|
2
9
|
* Allow configuring Kubernetes version.
|
3
10
|
* Fix storage class name
|
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
|
@@ -29,9 +30,11 @@ module Kuby
|
|
29
30
|
ensure_cluster!
|
30
31
|
end
|
31
32
|
|
32
|
-
def
|
33
|
+
def deploy
|
33
34
|
ensure_cluster!
|
34
35
|
load_images
|
36
|
+
|
37
|
+
super
|
35
38
|
end
|
36
39
|
|
37
40
|
def after_configuration
|
@@ -60,14 +63,44 @@ module Kuby
|
|
60
63
|
end
|
61
64
|
|
62
65
|
def load_images
|
66
|
+
require 'pry-byebug'
|
63
67
|
Kuby.logger.info("Loading Docker images into Kind cluster...")
|
64
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
|
+
|
65
82
|
environment.kubernetes.docker_images.each do |image|
|
66
83
|
image = image.current_version
|
67
84
|
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
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
|
+
|
71
104
|
cmd = [
|
72
105
|
KindRb.executable,
|
73
106
|
'load', 'docker-image', "#{image.image_url}:#{image.main_tag}",
|
@@ -211,6 +244,10 @@ module Kuby
|
|
211
244
|
Dir.tmpdir, 'kuby-kind'
|
212
245
|
)
|
213
246
|
end
|
247
|
+
|
248
|
+
def docker_cli
|
249
|
+
@docker_cli ||= Docker::CLI.new
|
250
|
+
end
|
214
251
|
end
|
215
252
|
end
|
216
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.
|