Class: Kuby::Kubernetes::Deployer

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/kuby/kubernetes/deployer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment) ⇒ Deployer

Returns a new instance of Deployer.



16
17
18
# File 'lib/kuby/kubernetes/deployer.rb', line 16

def initialize(environment)
  @environment = environment
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



13
14
15
# File 'lib/kuby/kubernetes/deployer.rb', line 13

def environment
  @environment
end

#logdevObject

Returns the value of attribute logdev.



14
15
16
# File 'lib/kuby/kubernetes/deployer.rb', line 14

def logdev
  @logdev
end

Instance Method Details

#deployObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/kuby/kubernetes/deployer.rb', line 20

def deploy
  restart_rails_deployment_if_necessary do
    namespaced, global = all_resources.partition 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(global)
    deploy_namespaced_resources(namespaced)
  end
end

#last_statusObject



48
49
50
# File 'lib/kuby/kubernetes/deployer.rb', line 48

def last_status
  nil
end

#with_pipes(out = STDOUT, err = STDERR) ⇒ Object

adhere to the “CLI” interface



36
37
38
39
40
41
42
# File 'lib/kuby/kubernetes/deployer.rb', line 36

def with_pipes(out = STDOUT, err = STDERR)
  previous_logdev = logdev
  @logdev = err
  yield
ensure
  @logdev = previous_logdev
end