kuby-core 0.11.4 → 0.11.10

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: da77ac21c97c9cc63e764e19e1ba3b303a4ce467a56f9edb64c533f5b4c1bb0e
4
- data.tar.gz: 9a17c7288fe79b677c330cea509d535eb85ba82137073b5b18d1537a9a98a60f
3
+ metadata.gz: '0828619de266c13d61f0eafc6ce902d1500e07af158337439eba6f45415594c3'
4
+ data.tar.gz: e296dc5858fe83e8eb9626d674a8c79a0e033559b168ee414d6afbf2f37f5b9e
5
5
  SHA512:
6
- metadata.gz: 8af1b5d46dfcbf174b54e1c644935112d397271c3171d3aa8daf725884016bfae957ab36275736a0ba7a2f9e7d3255c3bb8a040c52e74f60f1aa48ad29ae17f2
7
- data.tar.gz: dcdd686f46dd94d5f8fd368c7f8631f4cfeb73c87328a7b0c52edbccc3e5b24bbb3090a193c383250b7177d991f24b374dbc99c1cfc100cfae4a9df918aa6f6b
6
+ metadata.gz: d215cfb16bdd4e784500c1c22364bdd086cf059c38a9696626ffc774158e803b9f72337de4eda09719b26d505c83e1bba533e8e49acc1dddd1304b27f3558d2b
7
+ data.tar.gz: 6002bd6ee7a7cdd4d2568658fb8bdf8a9d8f42a19fa51ec846ceef5f35b458e9550d80e38aad168e2ce35e15bc91256570df160f1fec6d9cf763de362528ac04
@@ -1,3 +1,24 @@
1
+ ## 0.11.10
2
+ * Fix spelling in error message.
3
+
4
+ ## 0.11.9
5
+ * Use correct Docker Hub registry URL (index.docker.io).
6
+
7
+ ## 0.11.8
8
+ * Alias Rails `config_map` to `env`.
9
+
10
+ ## 0.11.7
11
+ * Properly namespace constant lookup for `Kubernetes::MissingPluginError`.
12
+ * Add missing `#storage` method for Postgres plugin.
13
+
14
+ ## 0.11.6
15
+ * Fix Rails generator.
16
+ - Causing `undefined method 'module_parent_name'`. Apparently `module_parent_name` wasn't introduced until Rails 6.
17
+
18
+ ## 0.11.5
19
+ * Raise friendlier error when attempting to add Docker credentials in the development environment.
20
+ * Raise friendlier error when attempting to set a username and password for SQLite databases.
21
+
1
22
  ## 0.11.4
2
23
  * Fix bug causing crash when running CLI commands.
3
24
  - Turns out was caused by adding a Sorbet type annotation inside an anonymous singleton class and forgetting to extend `T::Sig`. Thanks @lazyatom!
@@ -59,8 +59,10 @@ module Kuby
59
59
  tls_enabled false
60
60
 
61
61
  database do
62
- user(DEFAULT_DB_USER) if respond_to?(:user)
63
- password(DEFAULT_DB_PASSWORD) if respond_to?(:password)
62
+ if requires_credentials?
63
+ user(DEFAULT_DB_USER)
64
+ password(DEFAULT_DB_PASSWORD)
65
+ end
64
66
  end
65
67
  end
66
68
 
@@ -115,6 +115,13 @@ module Kuby
115
115
  layer_stack.includes?(name)
116
116
  end
117
117
 
118
+ sig {
119
+ params(block: T.nilable(T.proc.void)).returns(Credentials)
120
+ }
121
+ def credentials(&block)
122
+ raise 'Docker credentials are not supported in the development environment'
123
+ end
124
+
118
125
  sig { returns(Dockerfile) }
119
126
  def to_dockerfile
120
127
  Dockerfile.new.tap do |df|
@@ -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://www.docker.com'.freeze, String)
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
 
@@ -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
@@ -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
 
@@ -14,6 +14,14 @@ class KubyGenerator < Rails::Generators::Base
14
14
  end
15
15
 
16
16
  def create_config_file
17
+ app_class = Rails.application.class
18
+
19
+ app_name = if app_class.respond_to?(:module_parent_name)
20
+ app_class.module_parent_name
21
+ else
22
+ app_class.parent_name
23
+ end
24
+
17
25
  create_file(
18
26
  'kuby.rb',
19
27
  <<~END
@@ -21,7 +29,7 @@ class KubyGenerator < Rails::Generators::Base
21
29
  require 'active_support/encrypted_configuration'
22
30
 
23
31
  # Define a production Kuby deploy environment
24
- Kuby.define('#{Rails.application.class.module_parent_name}') do
32
+ Kuby.define('#{app_name}') do
25
33
  environment(:production) do
26
34
  # Because the Rails environment isn't always loaded when
27
35
  # your Kuby config is loaded, provide access to Rails
@@ -1,4 +1,5 @@
1
1
  # typed: false
2
+
2
3
  require 'kube-dsl'
3
4
  require 'kuby/kube-db'
4
5
 
@@ -15,6 +16,10 @@ module Kuby
15
16
  @configs = configs
16
17
  end
17
18
 
19
+ def requires_credentials?
20
+ true
21
+ end
22
+
18
23
  def name
19
24
  :mysql
20
25
  end
@@ -202,6 +202,8 @@ module Kuby
202
202
  @config_map
203
203
  end
204
204
 
205
+ alias_method :env, :config_map
206
+
205
207
  def app_secrets(&block)
206
208
  spec = self
207
209
 
@@ -1,4 +1,5 @@
1
1
  # typed: false
2
+
2
3
  require 'kube-dsl'
3
4
  require 'kuby/kube-db'
4
5
 
@@ -18,6 +19,10 @@ module Kuby
18
19
  password(config['password'])
19
20
  end
20
21
 
22
+ def requires_credentials?
23
+ true
24
+ end
25
+
21
26
  def name
22
27
  :postgres
23
28
  end
@@ -58,6 +63,20 @@ module Kuby
58
63
  end
59
64
  end
60
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
61
80
 
62
81
  def secret(&block)
63
82
  context = self
@@ -1,4 +1,5 @@
1
1
  # typed: true
2
+
2
3
  module Kuby
3
4
  module Plugins
4
5
  module RailsApp
@@ -14,6 +15,18 @@ module Kuby
14
15
  environment.docker.package_phase.add(:sqlite_client)
15
16
  end
16
17
 
18
+ def requires_credentials?
19
+ false
20
+ end
21
+
22
+ def user(_user)
23
+ raise 'SQLite databases do not require a username or password'
24
+ end
25
+
26
+ def password(_password)
27
+ raise 'SQLite databases do not require a username or password'
28
+ end
29
+
17
30
  def name
18
31
  :sqlite
19
32
  end
@@ -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 rake kuby:build to build the"\
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)
@@ -1,5 +1,5 @@
1
- # typed: strict
1
+ # typed: true
2
2
 
3
3
  module Kuby
4
- VERSION = '0.11.4'
4
+ VERSION = '0.11.10'.freeze
5
5
  end
@@ -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('www.docker.com') }
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
4
+ version: 0.11.10
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-10-12 00:00:00.000000000 Z
11
+ date: 2020-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize