Class: KubernetesDeploy::TaskConfigValidator
- Inherits:
-
Object
- Object
- KubernetesDeploy::TaskConfigValidator
show all
- Defined in:
- lib/kubernetes-deploy/task_config_validator.rb
Constant Summary
collapse
- DEFAULT_VALIDATIONS =
%i(
validate_kubeconfig
validate_context_exists_in_kubeconfig
validate_context_reachable
validate_server_version
validate_namespace_exists
).freeze
Instance Method Summary
collapse
Constructor Details
#initialize(task_config, kubectl, kubeclient_builder, only: nil) ⇒ TaskConfigValidator
Returns a new instance of TaskConfigValidator.
14
15
16
17
18
19
20
|
# File 'lib/kubernetes-deploy/task_config_validator.rb', line 14
def initialize(task_config, kubectl, kubeclient_builder, only: nil)
@task_config = task_config
@kubectl = kubectl
@kubeclient_builder = kubeclient_builder
@errors = nil
@validations = only || DEFAULT_VALIDATIONS
end
|
Instance Method Details
#errors ⇒ Object
31
32
33
34
|
# File 'lib/kubernetes-deploy/task_config_validator.rb', line 31
def errors
valid?
@errors
end
|
#valid? ⇒ Boolean
22
23
24
25
26
27
28
29
|
# File 'lib/kubernetes-deploy/task_config_validator.rb', line 22
def valid?
@errors = []
@validations.each do |validator_name|
break if @errors.present?
send(validator_name)
end
@errors.empty?
end
|