debian-mirror-gitlab/lib/gitlab/kubernetes/helm/delete_command.rb

50 lines
1,015 B
Ruby
Raw Normal View History

2019-07-31 22:56:46 +05:30
# frozen_string_literal: true
module Gitlab
module Kubernetes
module Helm
class DeleteCommand
include BaseCommand
include ClientCommand
2019-10-12 21:52:04 +05:30
attr_reader :predelete, :postdelete
2019-07-31 22:56:46 +05:30
attr_accessor :name, :files
2019-10-12 21:52:04 +05:30
def initialize(name:, rbac:, files:, predelete: nil, postdelete: nil)
2019-07-31 22:56:46 +05:30
@name = name
@files = files
@rbac = rbac
2019-10-12 21:52:04 +05:30
@predelete = predelete
@postdelete = postdelete
2019-07-31 22:56:46 +05:30
end
def generate_script
super + [
init_command,
wait_for_tiller_command,
2019-10-12 21:52:04 +05:30
predelete,
delete_command,
postdelete
2019-07-31 22:56:46 +05:30
].compact.join("\n")
end
def pod_name
"uninstall-#{name}"
end
def rbac?
@rbac
end
private
def delete_command
2020-01-01 13:55:28 +05:30
command = ['helm', 'delete', '--purge', name] + tls_flags_if_remote_tiller
2019-07-31 22:56:46 +05:30
command.shelljoin
end
end
end
end
end