kuby-core 0.11.6 → 0.11.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/lib/kuby/docker/metadata.rb +4 -3
- data/lib/kuby/kubernetes/deployer.rb +4 -1
- data/lib/kuby/plugin_registry.rb +1 -1
- data/lib/kuby/plugins/rails_app/plugin.rb +2 -0
- data/lib/kuby/plugins/rails_app/postgres.rb +14 -0
- data/lib/kuby/tasks.rb +2 -2
- data/lib/kuby/version.rb +1 -1
- data/spec/docker/metadata_spec.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78bc9ff66849f7b55046753a84be77fd64af68d28c1746245a463f5f240d0e9e
|
4
|
+
data.tar.gz: '079e0ccccc1ae12a18a2cb459e7a6b1f2b3ef05149d5bf347fed5ba1e6abbb2b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f27a9bd4698e6cdcb4c0308c91a78e5c86ac6eccd6dcd8f9ff1b28a73e8c1aa50f79512dc9ad3b5fdb43c024ba5054c1df1844bd74473c5bd9dd3c3cf034c7c4
|
7
|
+
data.tar.gz: fca6952c0bfe4cb5d2e6e9b0f4f50d46483bb43ad32d601dbdfcc14eeccb4070706043e786d18ade2730b9521443f55fb317620334f212fb88cfb92ab8672cb1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
## 0.11.11
|
2
|
+
* Add support for a Docker registry running on localhost.
|
3
|
+
- Correctly parse and handle URLs with specific ports.
|
4
|
+
- Only perform a Docker login if a username is provided.
|
5
|
+
|
6
|
+
## 0.11.10
|
7
|
+
* Fix spelling in error message.
|
8
|
+
|
9
|
+
## 0.11.9
|
10
|
+
* Use correct Docker Hub registry URL (index.docker.io).
|
11
|
+
|
12
|
+
## 0.11.8
|
13
|
+
* Alias Rails `config_map` to `env`.
|
14
|
+
|
15
|
+
## 0.11.7
|
16
|
+
* Properly namespace constant lookup for `Kubernetes::MissingPluginError`.
|
17
|
+
* Add missing `#storage` method for Postgres plugin.
|
18
|
+
|
1
19
|
## 0.11.6
|
2
20
|
* Fix Rails generator.
|
3
21
|
- Causing `undefined method 'module_parent_name'`. Apparently `module_parent_name` wasn't introduced until Rails 6.
|
data/lib/kuby/docker/metadata.rb
CHANGED
@@ -8,7 +8,7 @@ module Kuby
|
|
8
8
|
extend T::Sig
|
9
9
|
|
10
10
|
DEFAULT_DISTRO = :debian
|
11
|
-
DEFAULT_REGISTRY_HOST = T.let('https://
|
11
|
+
DEFAULT_REGISTRY_HOST = T.let('https://index.docker.io'.freeze, String)
|
12
12
|
DEFAULT_REGISTRY_SCHEME = T.let('https', String)
|
13
13
|
LATEST_TAG = T.let('latest'.freeze, String)
|
14
14
|
|
@@ -40,7 +40,8 @@ module Kuby
|
|
40
40
|
|
41
41
|
sig { returns(String) }
|
42
42
|
def image_host
|
43
|
-
|
43
|
+
uri = full_image_uri
|
44
|
+
@image_host ||= "#{uri.scheme}://#{uri.host}:#{uri.port}"
|
44
45
|
end
|
45
46
|
|
46
47
|
sig { returns(String) }
|
@@ -74,7 +75,7 @@ module Kuby
|
|
74
75
|
def full_image_uri
|
75
76
|
@full_image_uri ||= if image_url.include?('://')
|
76
77
|
URI.parse(image_url)
|
77
|
-
elsif image_url =~ /\A[
|
78
|
+
elsif image_url =~ /\A[^.:]+[\.:][^\/]+\//
|
78
79
|
URI.parse("#{DEFAULT_REGISTRY_SCHEME}://#{image_url}")
|
79
80
|
else
|
80
81
|
URI.parse("#{DEFAULT_REGISTRY_HOST}/#{image_url.sub(/\A[\/]+/, '')}")
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# typed: true
|
2
|
+
|
2
3
|
require 'fileutils'
|
3
4
|
require 'securerandom'
|
4
5
|
require 'yaml'
|
@@ -6,6 +7,8 @@ require 'yaml'
|
|
6
7
|
module Kuby
|
7
8
|
module Kubernetes
|
8
9
|
class Deployer
|
10
|
+
extend T::Sig
|
11
|
+
|
9
12
|
attr_reader :environment
|
10
13
|
attr_accessor :logdev
|
11
14
|
|
@@ -93,7 +96,7 @@ module Kuby
|
|
93
96
|
task.run!(verify_result: true, prune: false)
|
94
97
|
ensure
|
95
98
|
ENV['KUBECONFIG'] = old_kubeconfig
|
96
|
-
FileUtils.rm_rf(tmpdir)
|
99
|
+
FileUtils.rm_rf(T.must(tmpdir))
|
97
100
|
end
|
98
101
|
|
99
102
|
def restart_rails_deployment_if_necessary
|
data/lib/kuby/plugin_registry.rb
CHANGED
@@ -12,7 +12,7 @@ module Kuby
|
|
12
12
|
plugins_by_env = plugins[plugin_name]
|
13
13
|
|
14
14
|
unless plugins_by_env
|
15
|
-
raise MissingPluginError, "no plugin registered with name #{plugin_name}, "\
|
15
|
+
raise Kubernetes::MissingPluginError, "no plugin registered with name #{plugin_name}, "\
|
16
16
|
'do you need to add a gem to your Gemfile?'
|
17
17
|
end
|
18
18
|
|
@@ -63,6 +63,20 @@ module Kuby
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
66
|
+
|
67
|
+
def storage(amount)
|
68
|
+
database do
|
69
|
+
spec do
|
70
|
+
storage do
|
71
|
+
resources do
|
72
|
+
requests do
|
73
|
+
set :storage, amount
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
66
80
|
|
67
81
|
def secret(&block)
|
68
82
|
context = self
|
data/lib/kuby/tasks.rb
CHANGED
@@ -43,7 +43,7 @@ module Kuby
|
|
43
43
|
|
44
44
|
hostname = docker.metadata.image_hostname
|
45
45
|
|
46
|
-
|
46
|
+
if docker.credentials.username && !docker.cli.auths.include?(hostname)
|
47
47
|
Kuby.logger.info("Attempting to log in to registry at #{hostname}")
|
48
48
|
|
49
49
|
begin
|
@@ -66,7 +66,7 @@ module Kuby
|
|
66
66
|
docker.cli.push(image_url, tag)
|
67
67
|
end
|
68
68
|
rescue Kuby::Docker::MissingTagError => e
|
69
|
-
msg = "#{e.message} Run
|
69
|
+
msg = "#{e.message} Run kuby build to build the "\
|
70
70
|
'Docker image before running this task.'
|
71
71
|
|
72
72
|
Kuby.logger.fatal(msg)
|
data/lib/kuby/version.rb
CHANGED
@@ -19,18 +19,18 @@ describe Kuby::Docker::Metadata do
|
|
19
19
|
describe '#image_host' do
|
20
20
|
subject { metadata.image_host }
|
21
21
|
|
22
|
-
it { is_expected.to eq(described_class::DEFAULT_REGISTRY_HOST) }
|
22
|
+
it { is_expected.to eq("#{described_class::DEFAULT_REGISTRY_HOST}:443") }
|
23
23
|
|
24
24
|
context 'when the image URL contains an explicit host' do
|
25
25
|
let(:docker_image_url) { 'registry.foo.com/foo/testapp' }
|
26
26
|
|
27
|
-
it { is_expected.to eq('https://registry.foo.com') }
|
27
|
+
it { is_expected.to eq('https://registry.foo.com:443') }
|
28
28
|
end
|
29
29
|
|
30
30
|
context 'when the image URL contains an explicit host with scheme' do
|
31
31
|
let(:docker_image_url) { 'http://registry.foo.com/foo/testapp' }
|
32
32
|
|
33
|
-
it { is_expected.to eq('http://registry.foo.com') }
|
33
|
+
it { is_expected.to eq('http://registry.foo.com:80') }
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -49,7 +49,7 @@ describe Kuby::Docker::Metadata do
|
|
49
49
|
describe '#image_hostname' do
|
50
50
|
subject { metadata.image_hostname }
|
51
51
|
|
52
|
-
it { is_expected.to eq('
|
52
|
+
it { is_expected.to eq('index.docker.io') }
|
53
53
|
|
54
54
|
context 'when the image URL contains an explicit host' do
|
55
55
|
let(:docker_image_url) { 'registry.foo.com/foo/testapp' }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuby-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|