Commit 661fd213 authored by Chris Baumbauer's avatar Chris Baumbauer

Update helm version 1.7.2 -> 2.11.0

parent 742f8d64
......@@ -25,6 +25,7 @@ module Clusters
algorithm: 'aes-256-cbc'
before_validation :enforce_namespace_to_lower_case
before_validation :enforce_ca_whitespace_trimming
validates :namespace,
allow_blank: true,
......@@ -191,6 +192,11 @@ module Clusters
self.namespace = self.namespace&.downcase
end
def enforce_ca_whitespace_trimming
self.ca_pem = self.ca_pem&.strip
self.token = self.token&.strip
end
def prevent_modification
return unless managed?
......
---
title: Update Helm version to 2.11.0
author: Chris Baumbauer
type: changed
module Gitlab
module Kubernetes
module Helm
HELM_VERSION = '2.7.2'.freeze
HELM_VERSION = '2.11.0'.freeze
NAMESPACE = 'gitlab-managed-apps'.freeze
SERVICE_ACCOUNT = 'tiller'.freeze
CLUSTER_ROLE_BINDING = 'tiller-admin'.freeze
......
......@@ -14,7 +14,7 @@ module Gitlab
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
apk add -U wget ca-certificates openssl >/dev/null
apk add -U wget ca-certificates openssl git >/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
......
......@@ -4,21 +4,23 @@ module Gitlab
class InstallCommand
include BaseCommand
attr_reader :name, :files, :chart, :version, :repository
attr_reader :name, :files, :chart, :version, :repository, :setargs
def initialize(name:, chart:, files:, rbac:, version: nil, repository: nil)
def initialize(name:, chart:, files:, rbac:, version: nil, repository: nil, setargs: nil)
@name = name
@chart = chart
@version = version
@rbac = rbac
@files = files
@repository = repository
@setargs = setargs
end
def generate_script
super + [
init_command,
repository_command,
repository_update_command,
script_command
].compact.join("\n")
end
......@@ -37,6 +39,10 @@ module Gitlab
['helm', 'repo', 'add', name, repository].shelljoin if repository
end
def repository_update_command
'helm repo update >/dev/null' if repository
end
def script_command
command = ['helm', 'install', chart] + install_command_flags
......@@ -47,13 +53,15 @@ module Gitlab
name_flag = ['--name', name]
namespace_flag = ['--namespace', Gitlab::Kubernetes::Helm::NAMESPACE]
value_flag = ['-f', "/data/helm/#{name}/config/values.yaml"]
args_flag = optional_install_set_args_flag
name_flag +
optional_tls_flags +
optional_version_flag +
optional_rbac_create_flag +
namespace_flag +
value_flag
value_flag +
args_flag
end
def optional_rbac_create_flag
......@@ -64,6 +72,15 @@ module Gitlab
%w[--set rbac.create=true,rbac.enabled=true]
end
def optional_install_set_args_flag
return [] unless setargs
args = []
setargs.each do |s|
args.push("--set", s)
end
end
def optional_version_flag
return [] unless version
......
......@@ -24,6 +24,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
<<~EOS
helm init --client-only >/dev/null
helm repo add app-name https://repository.example.com
helm repo update >/dev/null
#{helm_install_comand}
EOS
end
......@@ -51,6 +52,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
<<~EOS
helm init --client-only >/dev/null
helm repo add app-name https://repository.example.com
helm repo update >/dev/null
#{helm_install_command}
EOS
end
......@@ -107,6 +109,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
<<~EOS
helm init --client-only >/dev/null
helm repo add app-name https://repository.example.com
helm repo update >/dev/null
#{helm_install_command}
EOS
end
......@@ -131,6 +134,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
<<~EOS
helm init --client-only >/dev/null
helm repo add app-name https://repository.example.com
helm repo update >/dev/null
#{helm_install_command}
EOS
end
......
......@@ -6,8 +6,8 @@ shared_examples 'helm commands' do
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
apk add -U wget ca-certificates openssl >/dev/null
wget -q -O - https://kubernetes-helm.storage.googleapis.com/helm-v2.7.2-linux-amd64.tar.gz | tar zxC /tmp >/dev/null
apk add -U wget ca-certificates openssl git >/dev/null
wget -q -O - https://kubernetes-helm.storage.googleapis.com/helm-v2.11.0-linux-amd64.tar.gz | tar zxC /tmp >/dev/null
mv /tmp/linux-amd64/helm /usr/bin/
EOS
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment