Class: VagrantK8s::KustomizeConfig

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeKustomizeConfig

Returns a new instance of KustomizeConfig.



9
10
11
12
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 9

def initialize
  @path = @namespace = @prune_selector = UNSET_VALUE
  @prune = @server_side = @force_conflicts = @wait = UNSET_VALUE
end

Instance Attribute Details

#force_conflictsObject

Returns the value of attribute force_conflicts.



7
8
9
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 7

def force_conflicts
  @force_conflicts
end

#namespaceObject

Returns the value of attribute namespace.



7
8
9
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 7

def namespace
  @namespace
end

#pathObject

Returns the value of attribute path.



7
8
9
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 7

def path
  @path
end

#pruneObject

Returns the value of attribute prune.



7
8
9
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 7

def prune
  @prune
end

#prune_selectorObject

Returns the value of attribute prune_selector.



7
8
9
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 7

def prune_selector
  @prune_selector
end

#server_sideObject

Returns the value of attribute server_side.



7
8
9
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 7

def server_side
  @server_side
end

#waitObject

Returns the value of attribute wait.



7
8
9
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 7

def wait
  @wait
end

Instance Method Details

#finalize!Object



14
15
16
17
18
19
20
21
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 14

def finalize!
  @namespace = nil if @namespace == UNSET_VALUE
  @prune_selector = nil if @prune_selector == UNSET_VALUE
  @prune = false if @prune == UNSET_VALUE
  @server_side = false if @server_side == UNSET_VALUE
  @force_conflicts = false if @force_conflicts == UNSET_VALUE
  @wait = false if @wait == UNSET_VALUE
end

#validate(_machine) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 23

def validate(_machine)
  errors = []
  errors << 'kustomize.path is required' unless @path.is_a?(String) && !@path.empty?
  if @prune && !Kubeconfig.present?(@prune_selector)
    errors << 'kustomize.prune_selector is required when prune is true'
  end
  { 'vagrant-k8s' => errors }
end