2018-03-01 18:46:02 -05:00
|
|
|
module Gitlab
|
|
|
|
module Kubernetes
|
|
|
|
module Helm
|
|
|
|
class BaseCommand
|
|
|
|
attr_reader :name
|
|
|
|
|
|
|
|
def initialize(name)
|
|
|
|
@name = name
|
|
|
|
end
|
|
|
|
|
|
|
|
def pod_resource
|
|
|
|
Gitlab::Kubernetes::Helm::Pod.new(self, namespace).generate
|
|
|
|
end
|
|
|
|
|
|
|
|
def generate_script
|
|
|
|
<<~HEREDOC
|
|
|
|
set -eo pipefail
|
2018-04-30 05:18:14 -04:00
|
|
|
ALPINE_VERSION=$(cat /etc/alpine-release | cut -d '.' -f 1,2)
|
|
|
|
echo http://mirror.clarkson.edu/alpine/v$ALPINE_VERSION/main >> /etc/apk/repositories
|
|
|
|
echo http://mirror1.hs-esslingen.de/pub/Mirrors/alpine/v$ALPINE_VERSION/main >> /etc/apk/repositories
|
2018-03-01 18:46:02 -05:00
|
|
|
apk add -U ca-certificates openssl >/dev/null
|
|
|
|
wget -q -O - https://kubernetes-helm.storage.googleapis.com/helm-v#{Gitlab::Kubernetes::Helm::HELM_VERSION}-linux-amd64.tar.gz | tar zxC /tmp >/dev/null
|
|
|
|
mv /tmp/linux-amd64/helm /usr/bin/
|
|
|
|
HEREDOC
|
|
|
|
end
|
|
|
|
|
|
|
|
def config_map?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def pod_name
|
|
|
|
"install-#{name}"
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def namespace
|
|
|
|
Gitlab::Kubernetes::Helm::NAMESPACE
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|