2018-12-23 12:14:25 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
module Gitlab
|
|
|
|
module Kubernetes
|
|
|
|
module Helm
|
2018-11-18 11:00:15 +05:30
|
|
|
module BaseCommand
|
2018-03-27 19:54:05 +05:30
|
|
|
def pod_resource
|
2018-11-20 20:47:30 +05:30
|
|
|
pod_service_account_name = rbac? ? service_account_name : nil
|
|
|
|
|
|
|
|
Gitlab::Kubernetes::Helm::Pod.new(self, namespace, service_account_name: pod_service_account_name).generate
|
2018-03-27 19:54:05 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def generate_script
|
|
|
|
<<~HEREDOC
|
2018-12-23 12:14:25 +05:30
|
|
|
set -xeo pipefail
|
2018-03-27 19:54:05 +05:30
|
|
|
HEREDOC
|
|
|
|
end
|
|
|
|
|
|
|
|
def pod_name
|
|
|
|
"install-#{name}"
|
|
|
|
end
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
def config_map_resource
|
|
|
|
Gitlab::Kubernetes::ConfigMap.new(name, files).generate
|
|
|
|
end
|
|
|
|
|
2018-11-20 20:47:30 +05:30
|
|
|
def service_account_resource
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def cluster_role_binding_resource
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
def file_names
|
|
|
|
files.keys
|
|
|
|
end
|
|
|
|
|
|
|
|
def name
|
|
|
|
raise "Not implemented"
|
|
|
|
end
|
|
|
|
|
2018-11-20 20:47:30 +05:30
|
|
|
def rbac?
|
|
|
|
raise "Not implemented"
|
|
|
|
end
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
def files
|
|
|
|
raise "Not implemented"
|
|
|
|
end
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
private
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
def files_dir
|
|
|
|
"/data/helm/#{name}/config"
|
|
|
|
end
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
def namespace
|
|
|
|
Gitlab::Kubernetes::Helm::NAMESPACE
|
|
|
|
end
|
2018-11-20 20:47:30 +05:30
|
|
|
|
|
|
|
def service_account_name
|
|
|
|
Gitlab::Kubernetes::Helm::SERVICE_ACCOUNT
|
|
|
|
end
|
2018-03-27 19:54:05 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|