Class: Dapp::Deployment::Deployment

Inherits:
Object
  • Object
show all
Includes:
Mod::Jobs, Mod::Namespace, Mod::SystemEnvironments
Defined in:
lib/dapp/deployment/deployment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Mod::Jobs

#to_kube_default_job_pods

Methods included from Mod::Namespace

#environment, #environments, #namespace_config, #namespace_config_directive, #scale, #secret_environment

Constructor Details

#initialize(dapp:) ⇒ Deployment

Returns a new instance of Deployment.



10
11
12
# File 'lib/dapp/deployment/deployment.rb', line 10

def initialize(dapp:)
  @dapp = dapp
end

Instance Attribute Details

#dappObject (readonly)

Returns the value of attribute dapp.



8
9
10
# File 'lib/dapp/deployment/deployment.rb', line 8

def dapp
  @dapp
end

Instance Method Details

#appsObject



22
23
24
# File 'lib/dapp/deployment/deployment.rb', line 22

def apps
  @apps ||= dapp.apps_configs.map { |app_config| App.new(app_config: app_config, deployment: self) }
end

#kubeObject



18
19
20
# File 'lib/dapp/deployment/deployment.rb', line 18

def kube
  @kube ||= KubeDeployment.new(self)
end

#kubernetesObject



30
31
32
# File 'lib/dapp/deployment/deployment.rb', line 30

def kubernetes
  @kubernetes ||= Kubernetes.new(namespace: namespace)
end

#name(*args) ⇒ Object



14
15
16
# File 'lib/dapp/deployment/deployment.rb', line 14

def name(*args)
  [dapp.name, *args].flatten.compact.join('-').gsub('_', '-')
end

#namespaceObject



26
27
28
# File 'lib/dapp/deployment/deployment.rb', line 26

def namespace
  dapp.options[:namespace] || ENV['DAPP_NAMESPACE']
end