Class: Rhelm::Subcommand::Upgrade

Inherits:
Base
  • Object
show all
Defined in:
lib/rhelm/subcommand/upgrade.rb

Overview

Helm upgrade subcommand: ‘helm upgrade [RELEASE] [CHART] [flags]`. docs: helm.sh/docs/helm/helm_upgrade/

Instance Attribute Summary collapse

Attributes inherited from Base

#client, #debug, #kube_apiserver, #kube_as_group, #kube_as_user, #kube_context, #kube_token, #kubeconfig, #namespace, #registry_config, #repository_cache, #repository_config

Instance Method Summary collapse

Methods inherited from Base

#args, #full_cli_call, #report_failure, #run

Constructor Details

#initialize(release, chart, options = {}) ⇒ Upgrade

Returns a new instance of Upgrade.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/rhelm/subcommand/upgrade.rb', line 47

def initialize(release, chart, options = {})
  super(options)

  @release = release
  @chart = chart
  @atomic = !!options[:atomic]
  @ca_file = options[:ca_file]
  @cert_file = options[:cert_file]
  @cleanup_on_fail = !!options[:cleanup_on_fail]
  @create_namespace = !!options[:create_namespace]
  @description = options[:description]
  @devel = !!options[:devel]
  @disable_openapi_validation = !!options[:disable_openapi_validation]
  @dry_run = !!options[:dry_run]
  @force = !!options[:force]
  @help = !!options[:help]
  @history_max = options[:history_max]
  @insecure_skip_tls_verify = !!options[:insecure_skip_tls_verify]
  @install = !!options[:install]
  @key_file = options[:key_file]
  @keyring = options[:keyring]
  @no_hooks = !!options[:no_hooks]
  @output = options[:output]
  @pass_credentials = options[:pass_credentials]
  @password = options[:password]
  @post_renderer = options[:post_renderer]
  @render_subchart_notes = !!options[:render_subchart_notes]
  @repo = options[:repo]
  @reset_values = !!options[:reset_values]
  @reuse_values = !!options[:reuse_values]
  @set = options[:set]
  @set_file = options[:set_file]
  @set_string = options[:set_string]
  @skip_crds = !!options[:skip_crds]
  @timeout = options[:timeout]
  @username = options[:username]
  @values = options[:values]
  @verify = !!options[:verify]
  @version = options[:version]
  @wait = !!options[:wait]
  @wait_for_jobs = !!options[:wait_for_jobs]
end

Instance Attribute Details

#atomicObject (readonly)

Returns the value of attribute atomic.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def atomic
  @atomic
end

#ca_fileObject (readonly)

Returns the value of attribute ca_file.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def ca_file
  @ca_file
end

#cert_fileObject (readonly)

Returns the value of attribute cert_file.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def cert_file
  @cert_file
end

#chartObject (readonly)

Returns the value of attribute chart.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def chart
  @chart
end

#cleanup_on_failObject (readonly)

Returns the value of attribute cleanup_on_fail.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def cleanup_on_fail
  @cleanup_on_fail
end

#create_namespaceObject (readonly)

Returns the value of attribute create_namespace.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def create_namespace
  @create_namespace
end

#descriptionObject (readonly)

Returns the value of attribute description.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def description
  @description
end

#develObject (readonly)

Returns the value of attribute devel.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def devel
  @devel
end

#disable_openapi_validationObject (readonly)

Returns the value of attribute disable_openapi_validation.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def disable_openapi_validation
  @disable_openapi_validation
end

#dry_runObject (readonly)

Returns the value of attribute dry_run.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def dry_run
  @dry_run
end

#forceObject (readonly)

Returns the value of attribute force.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def force
  @force
end

#helpObject (readonly)

Returns the value of attribute help.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def help
  @help
end

#history_maxObject (readonly)

Returns the value of attribute history_max.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def history_max
  @history_max
end

#insecure_skip_tls_verifyObject (readonly)

Returns the value of attribute insecure_skip_tls_verify.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def insecure_skip_tls_verify
  @insecure_skip_tls_verify
end

#installObject (readonly)

Returns the value of attribute install.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def install
  @install
end

#key_fileObject (readonly)

Returns the value of attribute key_file.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def key_file
  @key_file
end

#keyringObject (readonly)

Returns the value of attribute keyring.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def keyring
  @keyring
end

#no_hooksObject (readonly)

Returns the value of attribute no_hooks.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def no_hooks
  @no_hooks
end

#outputObject (readonly)

Returns the value of attribute output.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def output
  @output
end

#pass_credentialsObject (readonly)

Returns the value of attribute pass_credentials.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def pass_credentials
  @pass_credentials
end

#passwordObject (readonly)

Returns the value of attribute password.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def password
  @password
end

#post_rendererObject (readonly)

Returns the value of attribute post_renderer.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def post_renderer
  @post_renderer
end

#releaseObject (readonly)

Returns the value of attribute release.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def release
  @release
end

#render_subchart_notesObject (readonly)

Returns the value of attribute render_subchart_notes.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def render_subchart_notes
  @render_subchart_notes
end

#repoObject (readonly)

Returns the value of attribute repo.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def repo
  @repo
end

#reset_valuesObject (readonly)

Returns the value of attribute reset_values.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def reset_values
  @reset_values
end

#reuse_valuesObject (readonly)

Returns the value of attribute reuse_values.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def reuse_values
  @reuse_values
end

#setObject (readonly)

Returns the value of attribute set.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def set
  @set
end

#set_fileObject (readonly)

Returns the value of attribute set_file.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def set_file
  @set_file
end

#set_stringObject (readonly)

Returns the value of attribute set_string.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def set_string
  @set_string
end

#skip_crdsObject (readonly)

Returns the value of attribute skip_crds.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def skip_crds
  @skip_crds
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def timeout
  @timeout
end

#usernameObject (readonly)

Returns the value of attribute username.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def username
  @username
end

#valuesObject (readonly)

Returns the value of attribute values.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def values
  @values
end

#verifyObject (readonly)

Returns the value of attribute verify.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def verify
  @verify
end

#versionObject (readonly)

Returns the value of attribute version.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def version
  @version
end

#waitObject (readonly)

Returns the value of attribute wait.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def wait
  @wait
end

#wait_for_jobsObject (readonly)

Returns the value of attribute wait_for_jobs.



8
9
10
# File 'lib/rhelm/subcommand/upgrade.rb', line 8

def wait_for_jobs
  @wait_for_jobs
end

Instance Method Details

#cli_argsObject



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/rhelm/subcommand/upgrade.rb', line 94

def cli_args
  super.tap do |args|
    args << '--atomic' if atomic
    args << ['--ca-file', ca_file] if ca_file
    args << ['--cert-file', cert_file] if cert_file
    args << '--cleanup-on-fail' if cleanup_on_fail
    args << '--create-namespace' if create_namespace
    args << ['--description', description] if description
    args << '--devel' if devel
    args << '--disable-openapi-validation' if disable_openapi_validation
    args << '--dry-run' if dry_run
    args << '--force' if force
    args << '--help' if help
    args << ['--history-max', history_max] if history_max
    args << '--insecure-skip-tls-verify' if insecure_skip_tls_verify
    args << '--install' if install
    args << ['--key-file', key_file] if key_file
    args << ['--keyring', keyring] if keyring
    args << '--no-hooks' if no_hooks
    args << ['--output', output] if output
    args << '--pass-credentials' if pass_credentials
    args << ['--password', password] if password
    args << ['--post-renderer', post_renderer] if post_renderer
    args << '--render-subchart-notes' if render_subchart_notes
    args << ['--repo', repo] if repo
    args << '--reset-values' if reset_values
    args << '--reuse-values' if reuse_values

    if set && !set.empty?
      case set
      when Hash
        args << set.map { |key, value| ['--set', "#{key}=#{value}" ] }.flatten
      else
        args << ['--set', set]
      end
    end

    if set_file && !set_file.empty?
      case set_file
      when Hash
        args << set_file.map { |key, value| ['--set-file', "#{key}=#{value}" ] }.flatten
      else
        args << ['--set-file', set_file]
      end
    end

    if set_string && !set_string.empty?
      case set_string
      when Hash
        args << set_string.map { |key, value| ['--set-string', "#{key}=#{value}" ] }.flatten
      else
        args << ['--set-string', set_string]
      end
    end

    args << '--skip-crds' if skip_crds
    args << ['--timeout', timeout] if timeout
    args << ['--username', username] if username

    if values && !values.empty?
      case values
      when Array
        args << values.map { |values_file| ['--values', values_file ] }.flatten
      else
        args << ['--values', values]
      end
    end

    args << '--verify' if verify
    args << ['--version', version] if version
    args << '--wait' if wait
    args << '--wait-for-jobs' if wait_for_jobs

    args << release
    args << chart
  end.flatten
end

#subcommand_nameObject



90
91
92
# File 'lib/rhelm/subcommand/upgrade.rb', line 90

def subcommand_name
  "upgrade"
end