Class: Kuby::Kubernetes::Deployer
- Inherits:
-
Object
- Object
- Kuby::Kubernetes::Deployer
- Defined in:
- lib/kuby/kubernetes/deployer.rb
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
- #logdev ⇒ Object
Instance Method Summary collapse
- #deploy ⇒ Object
-
#initialize(environment) ⇒ Deployer
constructor
A new instance of Deployer.
- #last_status ⇒ Object
-
#with_pipes(out = STDOUT, err = STDERR) ⇒ Object
adhere to the “CLI” interface.
Constructor Details
#initialize(environment) ⇒ Deployer
Returns a new instance of Deployer.
14 15 16 |
# File 'lib/kuby/kubernetes/deployer.rb', line 14 def initialize(environment) @environment = environment end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
11 12 13 |
# File 'lib/kuby/kubernetes/deployer.rb', line 11 def environment @environment end |
#logdev ⇒ Object
55 56 57 |
# File 'lib/kuby/kubernetes/deployer.rb', line 55 def logdev @logdev || STDERR end |
Instance Method Details
#deploy ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/kuby/kubernetes/deployer.rb', line 18 def deploy restart_rails_deployment_if_necessary do resource_groups = all_resources.group_by do |resource| # Unfortunately we can't use respond_to here because all KubeDSL # objects use ObjectMeta, which has a namespace field. Not sure # why, since it makes no sense for a namespace to have a namespace. # Instead we just check for nil here. resource..namespace end deploy_global_resources(resource_groups[nil]) resource_groups.each_pair do |ns, resources| next if !ns begin deploy_namespaced_resources(resources, ns) rescue => e puts e. if bt = e.backtrace puts bt.join("\n") end end end end end |
#last_status ⇒ Object
59 60 61 |
# File 'lib/kuby/kubernetes/deployer.rb', line 59 def last_status nil end |
#with_pipes(out = STDOUT, err = STDERR) ⇒ Object
adhere to the “CLI” interface
47 48 49 50 51 52 53 |
# File 'lib/kuby/kubernetes/deployer.rb', line 47 def with_pipes(out = STDOUT, err = STDERR) previous_logdev = logdev @logdev = err yield ensure @logdev = previous_logdev end |