Class: Dapp::Kube::Helm::Release
- Inherits:
-
Object
- Object
- Dapp::Kube::Helm::Release
- Includes:
- Helper::YAML
- Defined in:
- lib/dapp/kube/helm/release.rb
Instance Attribute Summary collapse
-
#chart_path ⇒ Object
readonly
Returns the value of attribute chart_path.
-
#dapp ⇒ Object
readonly
Returns the value of attribute dapp.
-
#deploy_timeout ⇒ Object
readonly
Returns the value of attribute deploy_timeout.
-
#image_version ⇒ Object
readonly
Returns the value of attribute image_version.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#set ⇒ Object
readonly
Returns the value of attribute set.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #deploy! ⇒ Object
- #deployments ⇒ Object
- #hooks ⇒ Object
-
#initialize(dapp, name:, repo:, image_version:, namespace:, chart_path:, set: [], values: [], deploy_timeout: nil) ⇒ Release
constructor
A new instance of Release.
- #jobs ⇒ Object
Methods included from Helper::YAML
Constructor Details
#initialize(dapp, name:, repo:, image_version:, namespace:, chart_path:, set: [], values: [], deploy_timeout: nil) ⇒ Release
Returns a new instance of Release.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dapp/kube/helm/release.rb', line 17 def initialize(dapp, name:, repo:, image_version:, namespace:, chart_path:, set: [], values: [], deploy_timeout: nil) @dapp = dapp @name = name @repo = repo @image_version = image_version @namespace = namespace @chart_path = chart_path @set = set @values = values @deploy_timeout = deploy_timeout end |
Instance Attribute Details
#chart_path ⇒ Object (readonly)
Returns the value of attribute chart_path.
12 13 14 |
# File 'lib/dapp/kube/helm/release.rb', line 12 def chart_path @chart_path end |
#dapp ⇒ Object (readonly)
Returns the value of attribute dapp.
6 7 8 |
# File 'lib/dapp/kube/helm/release.rb', line 6 def dapp @dapp end |
#deploy_timeout ⇒ Object (readonly)
Returns the value of attribute deploy_timeout.
15 16 17 |
# File 'lib/dapp/kube/helm/release.rb', line 15 def deploy_timeout @deploy_timeout end |
#image_version ⇒ Object (readonly)
Returns the value of attribute image_version.
10 11 12 |
# File 'lib/dapp/kube/helm/release.rb', line 10 def image_version @image_version end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/dapp/kube/helm/release.rb', line 8 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
11 12 13 |
# File 'lib/dapp/kube/helm/release.rb', line 11 def namespace @namespace end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
9 10 11 |
# File 'lib/dapp/kube/helm/release.rb', line 9 def repo @repo end |
#set ⇒ Object (readonly)
Returns the value of attribute set.
13 14 15 |
# File 'lib/dapp/kube/helm/release.rb', line 13 def set @set end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
14 15 16 |
# File 'lib/dapp/kube/helm/release.rb', line 14 def values @values end |
Instance Method Details
#deploy! ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/dapp/kube/helm/release.rb', line 50 def deploy! args = [ name, chart_path, additional_values, , ].flatten dapp.kubernetes.create_namespace!(namespace) unless dapp.kubernetes.namespace?(namespace) dapp.shellout! "helm upgrade #{args.join(' ')}", verbose: true end |
#deployments ⇒ Object
44 45 46 47 48 |
# File 'lib/dapp/kube/helm/release.rb', line 44 def deployments (resources_specs['Deployment'] || {}).map do |name, spec| [name, Kubernetes::Client::Resource::Deployment.new(spec)] end.to_h end |
#hooks ⇒ Object
38 39 40 41 42 |
# File 'lib/dapp/kube/helm/release.rb', line 38 def hooks jobs.select do |_, spec| spec.annotations.key? "helm.sh/hook" end end |
#jobs ⇒ Object
32 33 34 35 36 |
# File 'lib/dapp/kube/helm/release.rb', line 32 def jobs (resources_specs['Job'] || {}).map do |name, spec| [name, Kubernetes::Client::Resource::Job.new(spec)] end.to_h end |