kuby-core 0.11.14 → 0.11.15
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 +2 -1
- data/bin/kuby +2 -0
- data/kuby-core.gemspec +1 -1
- data/lib/kuby.rb +1 -0
- data/lib/kuby/basic_logger.rb +1 -1
- data/lib/kuby/cli_base.rb +9 -4
- data/lib/kuby/docker/bundler_phase.rb +0 -4
- data/lib/kuby/docker/yarn_phase.rb +4 -1
- data/lib/kuby/kubernetes.rb +1 -0
- data/lib/kuby/kubernetes/bare_metal_provider.rb +41 -0
- data/lib/kuby/kubernetes/deployer.rb +1 -0
- data/lib/kuby/plugins/rails_app/plugin.rb +24 -0
- data/lib/kuby/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '03278595cc2f5eb23fcfb47a15fd8fea9aaf06546e3c9d92a71080953c3d10db'
|
4
|
+
data.tar.gz: 893a184f166b3bb453f96ef3529fbf65f8fef171f54a7268661645aa30834e99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d0868b638c06e13db7b4353af14c6fa1d82bc143239cac4322ba3be4f723eca1a3a70c8e271ec5091afea24d088acd2b744e6b7af3347ceeddfff63eabbb285
|
7
|
+
data.tar.gz: f1a859ddf32f023f9c593345a50f9d11e998287ff05030117cf599920ed2c5b53ed8b54804080f7271be7b47ef9d7cfee8cfee168bf972226ec3e889e35dde60
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/bin/kuby
CHANGED
data/kuby-core.gemspec
CHANGED
data/lib/kuby.rb
CHANGED
@@ -153,6 +153,7 @@ end
|
|
153
153
|
|
154
154
|
# providers
|
155
155
|
Kuby.register_provider(:docker_desktop, Kuby::Kubernetes::DockerDesktopProvider)
|
156
|
+
Kuby.register_provider(:bare_metal, Kuby::Kubernetes::BareMetalProvider)
|
156
157
|
|
157
158
|
# plugins
|
158
159
|
Kuby.register_plugin(:rails_app, Kuby::Plugins::RailsApp::Plugin)
|
data/lib/kuby/basic_logger.rb
CHANGED
data/lib/kuby/cli_base.rb
CHANGED
@@ -7,21 +7,26 @@ module Kuby
|
|
7
7
|
class CLIBase
|
8
8
|
extend T::Sig
|
9
9
|
|
10
|
+
BeforeCallback = T.type_alias { T.proc.params(cmd: T::Array[String]).void }
|
11
|
+
AfterCallback = T.type_alias do
|
12
|
+
T.proc.params(cmd: T::Array[String], last_status: T.nilable(Process::Status)).void
|
13
|
+
end
|
14
|
+
|
10
15
|
sig { returns(T.nilable(Process::Status)) }
|
11
16
|
def last_status
|
12
17
|
Thread.current[status_key]
|
13
18
|
end
|
14
19
|
|
15
|
-
sig { params(block:
|
20
|
+
sig { params(block: BeforeCallback).void }
|
16
21
|
def before_execute(&block)
|
17
|
-
@before_execute = T.let(@before_execute, T.nilable(T::Array[
|
22
|
+
@before_execute = T.let(@before_execute, T.nilable(T::Array[BeforeCallback]))
|
18
23
|
@before_execute ||= []
|
19
24
|
@before_execute << block
|
20
25
|
end
|
21
26
|
|
22
|
-
sig { params(block:
|
27
|
+
sig { params(block: AfterCallback).void }
|
23
28
|
def after_execute(&block)
|
24
|
-
@after_execute = T.let(@after_execute, T.nilable(T::Array[
|
29
|
+
@after_execute = T.let(@after_execute, T.nilable(T::Array[AfterCallback]))
|
25
30
|
@after_execute ||= []
|
26
31
|
@after_execute << block
|
27
32
|
end
|
@@ -51,10 +51,6 @@ module Kuby
|
|
51
51
|
dockerfile.copy(gf, '.')
|
52
52
|
dockerfile.copy(lf, '.')
|
53
53
|
|
54
|
-
# set bundle path so docker will cache the bundle
|
55
|
-
dockerfile.run('mkdir', './bundle')
|
56
|
-
dockerfile.env('BUNDLE_PATH=./bundle')
|
57
|
-
|
58
54
|
unless wo.empty?
|
59
55
|
dockerfile.env("BUNDLE_WITHOUT='#{wo.join(' ')}'")
|
60
56
|
end
|
@@ -8,7 +8,10 @@ module Kuby
|
|
8
8
|
sig { params(dockerfile: Dockerfile).void }
|
9
9
|
def apply_to(dockerfile)
|
10
10
|
dockerfile.copy('package.json', '.')
|
11
|
-
|
11
|
+
# use character classes as a hack to only copy the files if they exist
|
12
|
+
dockerfile.copy('yarn.loc[k]', '.')
|
13
|
+
dockerfile.copy('.npmr[c]', '.')
|
14
|
+
dockerfile.copy('.yarnr[c]', '.')
|
12
15
|
dockerfile.run('yarn', 'install')
|
13
16
|
end
|
14
17
|
end
|
data/lib/kuby/kubernetes.rb
CHANGED
@@ -3,6 +3,7 @@ require 'kuby/kubernetes/errors'
|
|
3
3
|
|
4
4
|
module Kuby
|
5
5
|
module Kubernetes
|
6
|
+
autoload :BareMetalProvider, 'kuby/kubernetes/bare_metal_provider'
|
6
7
|
autoload :Deployer, 'kuby/kubernetes/deployer'
|
7
8
|
autoload :DeployTask, 'kuby/kubernetes/deploy_task'
|
8
9
|
autoload :DockerConfig, 'kuby/kubernetes/docker_config'
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# typed: false
|
2
|
+
require 'kube-dsl'
|
3
|
+
|
4
|
+
module Kuby
|
5
|
+
module Kubernetes
|
6
|
+
class BareMetalProvider < Provider
|
7
|
+
STORAGE_CLASS_NAME = 'hostpath'.freeze
|
8
|
+
|
9
|
+
class Config
|
10
|
+
extend ::KubeDSL::ValueFields
|
11
|
+
|
12
|
+
value_fields :kubeconfig
|
13
|
+
end
|
14
|
+
|
15
|
+
attr_reader :config
|
16
|
+
|
17
|
+
def configure(&block)
|
18
|
+
config.instance_eval(&block) if block
|
19
|
+
end
|
20
|
+
|
21
|
+
def kubeconfig_path
|
22
|
+
config.kubeconfig
|
23
|
+
end
|
24
|
+
|
25
|
+
def storage_class_name
|
26
|
+
STORAGE_CLASS_NAME
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def after_initialize
|
32
|
+
@config = Config.new
|
33
|
+
|
34
|
+
configure do
|
35
|
+
# default kubeconfig path
|
36
|
+
kubeconfig File.join(ENV['HOME'], '.kube', 'config')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -380,11 +380,35 @@ module Kuby
|
|
380
380
|
init_container(:create_db) do
|
381
381
|
name "#{kube_spec.selector_app}-create-db"
|
382
382
|
command %w(bundle exec rake kuby:rails_app:db:create_unless_exists)
|
383
|
+
|
384
|
+
env_from do
|
385
|
+
config_map_ref do
|
386
|
+
name kube_spec.config_map.metadata.name
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
env_from do
|
391
|
+
secret_ref do
|
392
|
+
name kube_spec.app_secrets.metadata.name
|
393
|
+
end
|
394
|
+
end
|
383
395
|
end
|
384
396
|
|
385
397
|
init_container(:migrate_db) do
|
386
398
|
name "#{kube_spec.selector_app}-migrate-db"
|
387
399
|
command %w(bundle exec rake db:migrate)
|
400
|
+
|
401
|
+
env_from do
|
402
|
+
config_map_ref do
|
403
|
+
name kube_spec.config_map.metadata.name
|
404
|
+
end
|
405
|
+
end
|
406
|
+
|
407
|
+
env_from do
|
408
|
+
secret_ref do
|
409
|
+
name kube_spec.app_secrets.metadata.name
|
410
|
+
end
|
411
|
+
end
|
388
412
|
end
|
389
413
|
|
390
414
|
image_pull_secret do
|
data/lib/kuby/version.rb
CHANGED
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.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -255,6 +255,7 @@ files:
|
|
255
255
|
- lib/kuby/docker/yarn_phase.rb
|
256
256
|
- lib/kuby/environment.rb
|
257
257
|
- lib/kuby/kubernetes.rb
|
258
|
+
- lib/kuby/kubernetes/bare_metal_provider.rb
|
258
259
|
- lib/kuby/kubernetes/deploy_task.rb
|
259
260
|
- lib/kuby/kubernetes/deployer.rb
|
260
261
|
- lib/kuby/kubernetes/docker_config.rb
|