Class: VagrantK8s::HelmConfig
- Inherits:
-
Object
- Object
- VagrantK8s::HelmConfig
- Defined in:
- lib/vagrant-k8s/helm_provisioner.rb
Overview
Vagrant provisioner configuration for helm upgrade --install.
Instance Attribute Summary collapse
-
#atomic ⇒ Boolean
Whether to roll back automatically on a failed install.
-
#chart ⇒ String
Chart reference, e.g.
-
#create_namespace ⇒ Boolean
Whether to pass
--create-namespace. -
#helm ⇒ String
Path to the helm executable.
-
#namespace ⇒ String?
Target namespace; falls back to
k8s.namespace. -
#release ⇒ String
Helm release name.
-
#repo ⇒ String?
Chart repository URL, passed as
--repo. -
#set ⇒ Hash
Individual values passed as repeated
--set key=value. -
#timeout ⇒ String?
Helm timeout, e.g.
-
#values ⇒ Array<String>
Values files, relative to the Vagrantfile.
-
#version ⇒ String?
Chart version to install.
-
#wait ⇒ Boolean
Whether to pass
--wait.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ HelmConfig
constructor
A new instance of HelmConfig.
- #validate(_machine) ⇒ Object
Constructor Details
#initialize ⇒ HelmConfig
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
#atomic ⇒ Boolean
Returns 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 |
#chart ⇒ String
Returns 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_namespace ⇒ Boolean
Returns 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 |
#helm ⇒ String
Returns 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 |
#namespace ⇒ String?
Returns 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 |
#release ⇒ String
Returns 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 |
#repo ⇒ String?
Returns 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 |
#set ⇒ Hash
Returns 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 |
#timeout ⇒ String?
Returns 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 |
#values ⇒ Array<String>
Returns 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 |
#version ⇒ String?
Returns 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 |
#wait ⇒ Boolean
Returns 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 |