Class: Gitlab::Kubernetes::Helm::V3::PatchCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/gitlab/kubernetes/helm/v3/patch_command.rb

Constant Summary

Constants inherited from BaseCommand

BaseCommand::HELM_VERSION

Instance Attribute Summary collapse

Attributes inherited from BaseCommand

#files, #name

Instance Method Summary collapse

Methods inherited from BaseCommand

#cluster_role_binding_resource, #config_map_resource, #env, #file_names, #pod_name, #pod_resource, #rbac?, #repository_command, #service_account_resource

Constructor Details

#initialize(chart:, version:, repository: nil, **args) ⇒ PatchCommand

Returns a new instance of PatchCommand.

Raises:

  • (ArgumentError)

13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gitlab/kubernetes/helm/v3/patch_command.rb', line 13

def initialize(chart:, version:, repository: nil, **args)
  super(**args)

  # version is mandatory to prevent chart mismatches
  # we do not want our values interpreted in the context of the wrong version
  raise ArgumentError, 'version is required' if version.blank?

  @chart = chart
  @version = version
  @repository = repository
end

Instance Attribute Details

#chartObject (readonly)

Returns the value of attribute chart.


10
11
12
# File 'lib/gitlab/kubernetes/helm/v3/patch_command.rb', line 10

def chart
  @chart
end

#repositoryObject (readonly)

Returns the value of attribute repository.


10
11
12
# File 'lib/gitlab/kubernetes/helm/v3/patch_command.rb', line 10

def repository
  @repository
end

#versionObject

Returns the value of attribute version.


11
12
13
# File 'lib/gitlab/kubernetes/helm/v3/patch_command.rb', line 11

def version
  @version
end

Instance Method Details

#generate_scriptObject


25
26
27
28
29
30
31
# File 'lib/gitlab/kubernetes/helm/v3/patch_command.rb', line 25

def generate_script
  super + [
    repository_command,
    repository_update_command,
    upgrade_command
  ].compact.join("\n")
end