Class: VagrantK8s::HelmConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-k8s/helm_provisioner.rb

Overview

Vagrant provisioner configuration for helm upgrade --install.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHelmConfig

Returns a new instance of HelmConfig.



37
38
39
40
41
42
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 37

def initialize
  @release = @chart = UNSET_VALUE
  @repo = @version = @namespace = UNSET_VALUE
  @values = @set = UNSET_VALUE
  @wait = @atomic = @create_namespace = @timeout = @helm = UNSET_VALUE
end

Instance Attribute Details

#atomicBoolean

Returns Whether to roll back automatically on a failed install.

Returns:

  • (Boolean)

    Whether to roll back automatically on a failed install.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 33

class HelmConfig < Vagrant.plugin('2', :config)
  attr_accessor :release, :chart, :repo, :version, :namespace, :values, :set, :wait, :atomic, :create_namespace,
                :timeout, :helm

  def initialize
    @release = @chart = UNSET_VALUE
    @repo = @version = @namespace = UNSET_VALUE
    @values = @set = UNSET_VALUE
    @wait = @atomic = @create_namespace = @timeout = @helm = UNSET_VALUE
  end

  def finalize!
    @repo = nil if @repo == UNSET_VALUE
    @version = nil if @version == UNSET_VALUE
    @namespace = nil if @namespace == UNSET_VALUE
    @values = [] if @values == UNSET_VALUE
    @set = {} if @set == UNSET_VALUE
    @wait = false if @wait == UNSET_VALUE
    @atomic = false if @atomic == UNSET_VALUE
    @create_namespace = false if @create_namespace == UNSET_VALUE
    @timeout = nil if @timeout == UNSET_VALUE
    @helm = 'helm' if @helm == UNSET_VALUE
  end

  def validate(_machine)
    errors = []
    errors << 'helm.release is required' unless @release.is_a?(String) && !@release.empty?
    errors << 'helm.chart is required' unless @chart.is_a?(String) && !@chart.empty?
    errors << 'helm.values must be an array' unless @values.is_a?(Array)
    errors << 'helm.set must be a hash' unless @set.is_a?(Hash)
    { 'vagrant-k8s' => errors }
  end
end

#chartString

Returns Chart reference, e.g. repo/chart or a local path.

Returns:

  • (String)

    Chart reference, e.g. repo/chart or a local path.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 33

class HelmConfig < Vagrant.plugin('2', :config)
  attr_accessor :release, :chart, :repo, :version, :namespace, :values, :set, :wait, :atomic, :create_namespace,
                :timeout, :helm

  def initialize
    @release = @chart = UNSET_VALUE
    @repo = @version = @namespace = UNSET_VALUE
    @values = @set = UNSET_VALUE
    @wait = @atomic = @create_namespace = @timeout = @helm = UNSET_VALUE
  end

  def finalize!
    @repo = nil if @repo == UNSET_VALUE
    @version = nil if @version == UNSET_VALUE
    @namespace = nil if @namespace == UNSET_VALUE
    @values = [] if @values == UNSET_VALUE
    @set = {} if @set == UNSET_VALUE
    @wait = false if @wait == UNSET_VALUE
    @atomic = false if @atomic == UNSET_VALUE
    @create_namespace = false if @create_namespace == UNSET_VALUE
    @timeout = nil if @timeout == UNSET_VALUE
    @helm = 'helm' if @helm == UNSET_VALUE
  end

  def validate(_machine)
    errors = []
    errors << 'helm.release is required' unless @release.is_a?(String) && !@release.empty?
    errors << 'helm.chart is required' unless @chart.is_a?(String) && !@chart.empty?
    errors << 'helm.values must be an array' unless @values.is_a?(Array)
    errors << 'helm.set must be a hash' unless @set.is_a?(Hash)
    { 'vagrant-k8s' => errors }
  end
end

#create_namespaceBoolean

Returns Whether to pass --create-namespace.

Returns:

  • (Boolean)

    Whether to pass --create-namespace.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 33

class HelmConfig < Vagrant.plugin('2', :config)
  attr_accessor :release, :chart, :repo, :version, :namespace, :values, :set, :wait, :atomic, :create_namespace,
                :timeout, :helm

  def initialize
    @release = @chart = UNSET_VALUE
    @repo = @version = @namespace = UNSET_VALUE
    @values = @set = UNSET_VALUE
    @wait = @atomic = @create_namespace = @timeout = @helm = UNSET_VALUE
  end

  def finalize!
    @repo = nil if @repo == UNSET_VALUE
    @version = nil if @version == UNSET_VALUE
    @namespace = nil if @namespace == UNSET_VALUE
    @values = [] if @values == UNSET_VALUE
    @set = {} if @set == UNSET_VALUE
    @wait = false if @wait == UNSET_VALUE
    @atomic = false if @atomic == UNSET_VALUE
    @create_namespace = false if @create_namespace == UNSET_VALUE
    @timeout = nil if @timeout == UNSET_VALUE
    @helm = 'helm' if @helm == UNSET_VALUE
  end

  def validate(_machine)
    errors = []
    errors << 'helm.release is required' unless @release.is_a?(String) && !@release.empty?
    errors << 'helm.chart is required' unless @chart.is_a?(String) && !@chart.empty?
    errors << 'helm.values must be an array' unless @values.is_a?(Array)
    errors << 'helm.set must be a hash' unless @set.is_a?(Hash)
    { 'vagrant-k8s' => errors }
  end
end

#helmString

Returns Path to the helm executable.

Returns:

  • (String)

    Path to the helm executable.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 33

class HelmConfig < Vagrant.plugin('2', :config)
  attr_accessor :release, :chart, :repo, :version, :namespace, :values, :set, :wait, :atomic, :create_namespace,
                :timeout, :helm

  def initialize
    @release = @chart = UNSET_VALUE
    @repo = @version = @namespace = UNSET_VALUE
    @values = @set = UNSET_VALUE
    @wait = @atomic = @create_namespace = @timeout = @helm = UNSET_VALUE
  end

  def finalize!
    @repo = nil if @repo == UNSET_VALUE
    @version = nil if @version == UNSET_VALUE
    @namespace = nil if @namespace == UNSET_VALUE
    @values = [] if @values == UNSET_VALUE
    @set = {} if @set == UNSET_VALUE
    @wait = false if @wait == UNSET_VALUE
    @atomic = false if @atomic == UNSET_VALUE
    @create_namespace = false if @create_namespace == UNSET_VALUE
    @timeout = nil if @timeout == UNSET_VALUE
    @helm = 'helm' if @helm == UNSET_VALUE
  end

  def validate(_machine)
    errors = []
    errors << 'helm.release is required' unless @release.is_a?(String) && !@release.empty?
    errors << 'helm.chart is required' unless @chart.is_a?(String) && !@chart.empty?
    errors << 'helm.values must be an array' unless @values.is_a?(Array)
    errors << 'helm.set must be a hash' unless @set.is_a?(Hash)
    { 'vagrant-k8s' => errors }
  end
end

#namespaceString?

Returns Target namespace; falls back to k8s.namespace.

Returns:

  • (String, nil)

    Target namespace; falls back to k8s.namespace.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 33

class HelmConfig < Vagrant.plugin('2', :config)
  attr_accessor :release, :chart, :repo, :version, :namespace, :values, :set, :wait, :atomic, :create_namespace,
                :timeout, :helm

  def initialize
    @release = @chart = UNSET_VALUE
    @repo = @version = @namespace = UNSET_VALUE
    @values = @set = UNSET_VALUE
    @wait = @atomic = @create_namespace = @timeout = @helm = UNSET_VALUE
  end

  def finalize!
    @repo = nil if @repo == UNSET_VALUE
    @version = nil if @version == UNSET_VALUE
    @namespace = nil if @namespace == UNSET_VALUE
    @values = [] if @values == UNSET_VALUE
    @set = {} if @set == UNSET_VALUE
    @wait = false if @wait == UNSET_VALUE
    @atomic = false if @atomic == UNSET_VALUE
    @create_namespace = false if @create_namespace == UNSET_VALUE
    @timeout = nil if @timeout == UNSET_VALUE
    @helm = 'helm' if @helm == UNSET_VALUE
  end

  def validate(_machine)
    errors = []
    errors << 'helm.release is required' unless @release.is_a?(String) && !@release.empty?
    errors << 'helm.chart is required' unless @chart.is_a?(String) && !@chart.empty?
    errors << 'helm.values must be an array' unless @values.is_a?(Array)
    errors << 'helm.set must be a hash' unless @set.is_a?(Hash)
    { 'vagrant-k8s' => errors }
  end
end

#releaseString

Returns Helm release name.

Returns:

  • (String)

    Helm release name.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 33

class HelmConfig < Vagrant.plugin('2', :config)
  attr_accessor :release, :chart, :repo, :version, :namespace, :values, :set, :wait, :atomic, :create_namespace,
                :timeout, :helm

  def initialize
    @release = @chart = UNSET_VALUE
    @repo = @version = @namespace = UNSET_VALUE
    @values = @set = UNSET_VALUE
    @wait = @atomic = @create_namespace = @timeout = @helm = UNSET_VALUE
  end

  def finalize!
    @repo = nil if @repo == UNSET_VALUE
    @version = nil if @version == UNSET_VALUE
    @namespace = nil if @namespace == UNSET_VALUE
    @values = [] if @values == UNSET_VALUE
    @set = {} if @set == UNSET_VALUE
    @wait = false if @wait == UNSET_VALUE
    @atomic = false if @atomic == UNSET_VALUE
    @create_namespace = false if @create_namespace == UNSET_VALUE
    @timeout = nil if @timeout == UNSET_VALUE
    @helm = 'helm' if @helm == UNSET_VALUE
  end

  def validate(_machine)
    errors = []
    errors << 'helm.release is required' unless @release.is_a?(String) && !@release.empty?
    errors << 'helm.chart is required' unless @chart.is_a?(String) && !@chart.empty?
    errors << 'helm.values must be an array' unless @values.is_a?(Array)
    errors << 'helm.set must be a hash' unless @set.is_a?(Hash)
    { 'vagrant-k8s' => errors }
  end
end

#repoString?

Returns Chart repository URL, passed as --repo.

Returns:

  • (String, nil)

    Chart repository URL, passed as --repo.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 33

class HelmConfig < Vagrant.plugin('2', :config)
  attr_accessor :release, :chart, :repo, :version, :namespace, :values, :set, :wait, :atomic, :create_namespace,
                :timeout, :helm

  def initialize
    @release = @chart = UNSET_VALUE
    @repo = @version = @namespace = UNSET_VALUE
    @values = @set = UNSET_VALUE
    @wait = @atomic = @create_namespace = @timeout = @helm = UNSET_VALUE
  end

  def finalize!
    @repo = nil if @repo == UNSET_VALUE
    @version = nil if @version == UNSET_VALUE
    @namespace = nil if @namespace == UNSET_VALUE
    @values = [] if @values == UNSET_VALUE
    @set = {} if @set == UNSET_VALUE
    @wait = false if @wait == UNSET_VALUE
    @atomic = false if @atomic == UNSET_VALUE
    @create_namespace = false if @create_namespace == UNSET_VALUE
    @timeout = nil if @timeout == UNSET_VALUE
    @helm = 'helm' if @helm == UNSET_VALUE
  end

  def validate(_machine)
    errors = []
    errors << 'helm.release is required' unless @release.is_a?(String) && !@release.empty?
    errors << 'helm.chart is required' unless @chart.is_a?(String) && !@chart.empty?
    errors << 'helm.values must be an array' unless @values.is_a?(Array)
    errors << 'helm.set must be a hash' unless @set.is_a?(Hash)
    { 'vagrant-k8s' => errors }
  end
end

#setHash

Returns Individual values passed as repeated --set key=value.

Returns:

  • (Hash)

    Individual values passed as repeated --set key=value.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 33

class HelmConfig < Vagrant.plugin('2', :config)
  attr_accessor :release, :chart, :repo, :version, :namespace, :values, :set, :wait, :atomic, :create_namespace,
                :timeout, :helm

  def initialize
    @release = @chart = UNSET_VALUE
    @repo = @version = @namespace = UNSET_VALUE
    @values = @set = UNSET_VALUE
    @wait = @atomic = @create_namespace = @timeout = @helm = UNSET_VALUE
  end

  def finalize!
    @repo = nil if @repo == UNSET_VALUE
    @version = nil if @version == UNSET_VALUE
    @namespace = nil if @namespace == UNSET_VALUE
    @values = [] if @values == UNSET_VALUE
    @set = {} if @set == UNSET_VALUE
    @wait = false if @wait == UNSET_VALUE
    @atomic = false if @atomic == UNSET_VALUE
    @create_namespace = false if @create_namespace == UNSET_VALUE
    @timeout = nil if @timeout == UNSET_VALUE
    @helm = 'helm' if @helm == UNSET_VALUE
  end

  def validate(_machine)
    errors = []
    errors << 'helm.release is required' unless @release.is_a?(String) && !@release.empty?
    errors << 'helm.chart is required' unless @chart.is_a?(String) && !@chart.empty?
    errors << 'helm.values must be an array' unless @values.is_a?(Array)
    errors << 'helm.set must be a hash' unless @set.is_a?(Hash)
    { 'vagrant-k8s' => errors }
  end
end

#timeoutString?

Returns Helm timeout, e.g. "5m".

Returns:

  • (String, nil)

    Helm timeout, e.g. "5m".



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 33

class HelmConfig < Vagrant.plugin('2', :config)
  attr_accessor :release, :chart, :repo, :version, :namespace, :values, :set, :wait, :atomic, :create_namespace,
                :timeout, :helm

  def initialize
    @release = @chart = UNSET_VALUE
    @repo = @version = @namespace = UNSET_VALUE
    @values = @set = UNSET_VALUE
    @wait = @atomic = @create_namespace = @timeout = @helm = UNSET_VALUE
  end

  def finalize!
    @repo = nil if @repo == UNSET_VALUE
    @version = nil if @version == UNSET_VALUE
    @namespace = nil if @namespace == UNSET_VALUE
    @values = [] if @values == UNSET_VALUE
    @set = {} if @set == UNSET_VALUE
    @wait = false if @wait == UNSET_VALUE
    @atomic = false if @atomic == UNSET_VALUE
    @create_namespace = false if @create_namespace == UNSET_VALUE
    @timeout = nil if @timeout == UNSET_VALUE
    @helm = 'helm' if @helm == UNSET_VALUE
  end

  def validate(_machine)
    errors = []
    errors << 'helm.release is required' unless @release.is_a?(String) && !@release.empty?
    errors << 'helm.chart is required' unless @chart.is_a?(String) && !@chart.empty?
    errors << 'helm.values must be an array' unless @values.is_a?(Array)
    errors << 'helm.set must be a hash' unless @set.is_a?(Hash)
    { 'vagrant-k8s' => errors }
  end
end

#valuesArray<String>

Returns Values files, relative to the Vagrantfile.

Returns:

  • (Array<String>)

    Values files, relative to the Vagrantfile.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 33

class HelmConfig < Vagrant.plugin('2', :config)
  attr_accessor :release, :chart, :repo, :version, :namespace, :values, :set, :wait, :atomic, :create_namespace,
                :timeout, :helm

  def initialize
    @release = @chart = UNSET_VALUE
    @repo = @version = @namespace = UNSET_VALUE
    @values = @set = UNSET_VALUE
    @wait = @atomic = @create_namespace = @timeout = @helm = UNSET_VALUE
  end

  def finalize!
    @repo = nil if @repo == UNSET_VALUE
    @version = nil if @version == UNSET_VALUE
    @namespace = nil if @namespace == UNSET_VALUE
    @values = [] if @values == UNSET_VALUE
    @set = {} if @set == UNSET_VALUE
    @wait = false if @wait == UNSET_VALUE
    @atomic = false if @atomic == UNSET_VALUE
    @create_namespace = false if @create_namespace == UNSET_VALUE
    @timeout = nil if @timeout == UNSET_VALUE
    @helm = 'helm' if @helm == UNSET_VALUE
  end

  def validate(_machine)
    errors = []
    errors << 'helm.release is required' unless @release.is_a?(String) && !@release.empty?
    errors << 'helm.chart is required' unless @chart.is_a?(String) && !@chart.empty?
    errors << 'helm.values must be an array' unless @values.is_a?(Array)
    errors << 'helm.set must be a hash' unless @set.is_a?(Hash)
    { 'vagrant-k8s' => errors }
  end
end

#versionString?

Returns Chart version to install.

Returns:

  • (String, nil)

    Chart version to install.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 33

class HelmConfig < Vagrant.plugin('2', :config)
  attr_accessor :release, :chart, :repo, :version, :namespace, :values, :set, :wait, :atomic, :create_namespace,
                :timeout, :helm

  def initialize
    @release = @chart = UNSET_VALUE
    @repo = @version = @namespace = UNSET_VALUE
    @values = @set = UNSET_VALUE
    @wait = @atomic = @create_namespace = @timeout = @helm = UNSET_VALUE
  end

  def finalize!
    @repo = nil if @repo == UNSET_VALUE
    @version = nil if @version == UNSET_VALUE
    @namespace = nil if @namespace == UNSET_VALUE
    @values = [] if @values == UNSET_VALUE
    @set = {} if @set == UNSET_VALUE
    @wait = false if @wait == UNSET_VALUE
    @atomic = false if @atomic == UNSET_VALUE
    @create_namespace = false if @create_namespace == UNSET_VALUE
    @timeout = nil if @timeout == UNSET_VALUE
    @helm = 'helm' if @helm == UNSET_VALUE
  end

  def validate(_machine)
    errors = []
    errors << 'helm.release is required' unless @release.is_a?(String) && !@release.empty?
    errors << 'helm.chart is required' unless @chart.is_a?(String) && !@chart.empty?
    errors << 'helm.values must be an array' unless @values.is_a?(Array)
    errors << 'helm.set must be a hash' unless @set.is_a?(Hash)
    { 'vagrant-k8s' => errors }
  end
end

#waitBoolean

Returns Whether to pass --wait.

Returns:

  • (Boolean)

    Whether to pass --wait.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 33

class HelmConfig < Vagrant.plugin('2', :config)
  attr_accessor :release, :chart, :repo, :version, :namespace, :values, :set, :wait, :atomic, :create_namespace,
                :timeout, :helm

  def initialize
    @release = @chart = UNSET_VALUE
    @repo = @version = @namespace = UNSET_VALUE
    @values = @set = UNSET_VALUE
    @wait = @atomic = @create_namespace = @timeout = @helm = UNSET_VALUE
  end

  def finalize!
    @repo = nil if @repo == UNSET_VALUE
    @version = nil if @version == UNSET_VALUE
    @namespace = nil if @namespace == UNSET_VALUE
    @values = [] if @values == UNSET_VALUE
    @set = {} if @set == UNSET_VALUE
    @wait = false if @wait == UNSET_VALUE
    @atomic = false if @atomic == UNSET_VALUE
    @create_namespace = false if @create_namespace == UNSET_VALUE
    @timeout = nil if @timeout == UNSET_VALUE
    @helm = 'helm' if @helm == UNSET_VALUE
  end

  def validate(_machine)
    errors = []
    errors << 'helm.release is required' unless @release.is_a?(String) && !@release.empty?
    errors << 'helm.chart is required' unless @chart.is_a?(String) && !@chart.empty?
    errors << 'helm.values must be an array' unless @values.is_a?(Array)
    errors << 'helm.set must be a hash' unless @set.is_a?(Hash)
    { 'vagrant-k8s' => errors }
  end
end

Instance Method Details

#finalize!Object



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 44

def finalize!
  @repo = nil if @repo == UNSET_VALUE
  @version = nil if @version == UNSET_VALUE
  @namespace = nil if @namespace == UNSET_VALUE
  @values = [] if @values == UNSET_VALUE
  @set = {} if @set == UNSET_VALUE
  @wait = false if @wait == UNSET_VALUE
  @atomic = false if @atomic == UNSET_VALUE
  @create_namespace = false if @create_namespace == UNSET_VALUE
  @timeout = nil if @timeout == UNSET_VALUE
  @helm = 'helm' if @helm == UNSET_VALUE
end

#validate(_machine) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/vagrant-k8s/helm_provisioner.rb', line 57

def validate(_machine)
  errors = []
  errors << 'helm.release is required' unless @release.is_a?(String) && !@release.empty?
  errors << 'helm.chart is required' unless @chart.is_a?(String) && !@chart.empty?
  errors << 'helm.values must be an array' unless @values.is_a?(Array)
  errors << 'helm.set must be a hash' unless @set.is_a?(Hash)
  { 'vagrant-k8s' => errors }
end