Class: Orchparty::Services::Chart

Inherits:
Context
  • Object
show all
Defined in:
lib/orchparty/kubernetes_application.rb

Defined Under Namespace

Classes: CleanBinding

Instance Attribute Summary

Attributes inherited from Context

#app_config, #cluster_name, #dir_path, #namespace, #options, #service

Instance Method Summary collapse

Methods inherited from Context

#initialize, #template

Methods included from Minfra::Cli::Logging

#debug, #deprecated, #error, #exit_error, #info, #warn

Constructor Details

This class inherits a constructor from Orchparty::Services::Context

Instance Method Details

#installObject



209
210
211
212
213
214
215
# File 'lib/orchparty/kubernetes_application.rb', line 209

def install
  debug("Install: #{service.name}")
  build_chart do |chart_path|
    res = Minfra::Cli::HelmRunner.new("install --create-namespace --namespace #{namespace} --kube-context #{cluster_name} #{service.name} #{chart_path}").run
    @out_io.puts res.stdout
  end
end


189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/orchparty/kubernetes_application.rb', line 189

def print_install
  build_chart do |chart_path|
    cmd = "helm template --namespace #{namespace} --kube-context #{cluster_name} --output-dir #{chart_path.join(
      '..', 'helm_expanded'
    )}   #{service.name} #{chart_path}"
    @out_io.puts `$cmd`
    if system("#{cmd} > /dev/null")

      debug('Helm: template check: OK')
    else
      system("#{cmd} --debug")
      error('Helm: template check: FAIL')
    end
  end
end


205
206
207
# File 'lib/orchparty/kubernetes_application.rb', line 205

def print_upgrade
  print_install
end

#upgradeObject



217
218
219
220
221
222
223
# File 'lib/orchparty/kubernetes_application.rb', line 217

def upgrade
  debug("Upgrade: #{service.name}: #{service._services.join(', ')}")
  build_chart do |chart_path|
    res = Minfra::Cli::HelmRunner.new("upgrade --namespace #{namespace} --kube-context #{cluster_name} #{service.name} #{chart_path}").run
    @out_io.puts res.stdout
  end
end