Class: VagrantK8s::KustomizeConfig
- Inherits:
-
Object
- Object
- VagrantK8s::KustomizeConfig
- Defined in:
- lib/vagrant-k8s/kustomize_provisioner.rb
Overview
Vagrant provisioner configuration for kubectl apply -k.
Instance Attribute Summary collapse
-
#force_conflicts ⇒ Boolean
Whether to pass
--force-conflicts. -
#namespace ⇒ String?
Target namespace; falls back to
k8s.namespace. -
#path ⇒ String
Kustomization directory, relative to the Vagrantfile.
-
#prune ⇒ Boolean
Whether to pass
--prune(requiresprune_selector). -
#prune_selector ⇒ String?
Label selector passed to
--selectorwhen pruning. -
#server_side ⇒ Boolean
Whether to pass
--server-side. -
#wait ⇒ Boolean
Whether to wait for pods to become ready after applying.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ KustomizeConfig
constructor
A new instance of KustomizeConfig.
- #validate(_machine) ⇒ Object
Constructor Details
#initialize ⇒ KustomizeConfig
Returns a new instance of KustomizeConfig.
25 26 27 28 |
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 25 def initialize @path = @namespace = @prune_selector = UNSET_VALUE @prune = @server_side = @force_conflicts = @wait = UNSET_VALUE end |
Instance Attribute Details
#force_conflicts ⇒ Boolean
Returns Whether to pass --force-conflicts.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 22 class KustomizeConfig < Vagrant.plugin('2', :config) attr_accessor :path, :namespace, :prune, :prune_selector, :server_side, :force_conflicts, :wait def initialize @path = @namespace = @prune_selector = UNSET_VALUE @prune = @server_side = @force_conflicts = @wait = UNSET_VALUE end 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 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 end |
#namespace ⇒ String?
Returns Target namespace; falls back to k8s.namespace.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 22 class KustomizeConfig < Vagrant.plugin('2', :config) attr_accessor :path, :namespace, :prune, :prune_selector, :server_side, :force_conflicts, :wait def initialize @path = @namespace = @prune_selector = UNSET_VALUE @prune = @server_side = @force_conflicts = @wait = UNSET_VALUE end 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 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 end |
#path ⇒ String
Returns Kustomization directory, relative to the Vagrantfile.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 22 class KustomizeConfig < Vagrant.plugin('2', :config) attr_accessor :path, :namespace, :prune, :prune_selector, :server_side, :force_conflicts, :wait def initialize @path = @namespace = @prune_selector = UNSET_VALUE @prune = @server_side = @force_conflicts = @wait = UNSET_VALUE end 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 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 end |
#prune ⇒ Boolean
Returns Whether to pass --prune (requires prune_selector).
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 22 class KustomizeConfig < Vagrant.plugin('2', :config) attr_accessor :path, :namespace, :prune, :prune_selector, :server_side, :force_conflicts, :wait def initialize @path = @namespace = @prune_selector = UNSET_VALUE @prune = @server_side = @force_conflicts = @wait = UNSET_VALUE end 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 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 end |
#prune_selector ⇒ String?
Returns Label selector passed to --selector when pruning.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 22 class KustomizeConfig < Vagrant.plugin('2', :config) attr_accessor :path, :namespace, :prune, :prune_selector, :server_side, :force_conflicts, :wait def initialize @path = @namespace = @prune_selector = UNSET_VALUE @prune = @server_side = @force_conflicts = @wait = UNSET_VALUE end 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 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 end |
#server_side ⇒ Boolean
Returns Whether to pass --server-side.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 22 class KustomizeConfig < Vagrant.plugin('2', :config) attr_accessor :path, :namespace, :prune, :prune_selector, :server_side, :force_conflicts, :wait def initialize @path = @namespace = @prune_selector = UNSET_VALUE @prune = @server_side = @force_conflicts = @wait = UNSET_VALUE end 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 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 end |
#wait ⇒ Boolean
Returns Whether to wait for pods to become ready after applying.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 22 class KustomizeConfig < Vagrant.plugin('2', :config) attr_accessor :path, :namespace, :prune, :prune_selector, :server_side, :force_conflicts, :wait def initialize @path = @namespace = @prune_selector = UNSET_VALUE @prune = @server_side = @force_conflicts = @wait = UNSET_VALUE end 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 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 end |
Instance Method Details
#finalize! ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 30 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
39 40 41 42 43 44 45 46 |
# File 'lib/vagrant-k8s/kustomize_provisioner.rb', line 39 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 |