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 ...@@ -25,6 +25,7 @@ module Clusters
algorithm: 'aes-256-cbc' algorithm: 'aes-256-cbc'
before_validation :enforce_namespace_to_lower_case before_validation :enforce_namespace_to_lower_case
before_validation :enforce_ca_whitespace_trimming
validates :namespace, validates :namespace,
allow_blank: true, allow_blank: true,
...@@ -191,6 +192,11 @@ module Clusters ...@@ -191,6 +192,11 @@ module Clusters
self.namespace = self.namespace&.downcase self.namespace = self.namespace&.downcase
end end
def enforce_ca_whitespace_trimming
self.ca_pem = self.ca_pem&.strip
self.token = self.token&.strip
end
def prevent_modification def prevent_modification
return unless managed? return unless managed?
......
---
title: Update Helm version to 2.11.0
author: Chris Baumbauer
type: changed
module Gitlab module Gitlab
module Kubernetes module Kubernetes
module Helm module Helm
HELM_VERSION = '2.7.2'.freeze HELM_VERSION = '2.11.0'.freeze
NAMESPACE = 'gitlab-managed-apps'.freeze NAMESPACE = 'gitlab-managed-apps'.freeze
SERVICE_ACCOUNT = 'tiller'.freeze SERVICE_ACCOUNT = 'tiller'.freeze
CLUSTER_ROLE_BINDING = 'tiller-admin'.freeze CLUSTER_ROLE_BINDING = 'tiller-admin'.freeze
......
...@@ -14,7 +14,7 @@ module Gitlab ...@@ -14,7 +14,7 @@ module Gitlab
ALPINE_VERSION=$(cat /etc/alpine-release | cut -d '.' -f 1,2) 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://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 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 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/ mv /tmp/linux-amd64/helm /usr/bin/
HEREDOC HEREDOC
......
...@@ -4,21 +4,23 @@ module Gitlab ...@@ -4,21 +4,23 @@ module Gitlab
class InstallCommand class InstallCommand
include BaseCommand 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 @name = name
@chart = chart @chart = chart
@version = version @version = version
@rbac = rbac @rbac = rbac
@files = files @files = files
@repository = repository @repository = repository
@setargs = setargs
end end
def generate_script def generate_script
super + [ super + [
init_command, init_command,
repository_command, repository_command,
repository_update_command,
script_command script_command
].compact.join("\n") ].compact.join("\n")
end end
...@@ -37,6 +39,10 @@ module Gitlab ...@@ -37,6 +39,10 @@ module Gitlab
['helm', 'repo', 'add', name, repository].shelljoin if repository ['helm', 'repo', 'add', name, repository].shelljoin if repository
end end
def repository_update_command
'helm repo update >/dev/null' if repository
end
def script_command def script_command
command = ['helm', 'install', chart] + install_command_flags command = ['helm', 'install', chart] + install_command_flags
...@@ -47,13 +53,15 @@ module Gitlab ...@@ -47,13 +53,15 @@ module Gitlab
name_flag = ['--name', name] name_flag = ['--name', name]
namespace_flag = ['--namespace', Gitlab::Kubernetes::Helm::NAMESPACE] namespace_flag = ['--namespace', Gitlab::Kubernetes::Helm::NAMESPACE]
value_flag = ['-f', "/data/helm/#{name}/config/values.yaml"] value_flag = ['-f', "/data/helm/#{name}/config/values.yaml"]
args_flag = optional_install_set_args_flag
name_flag + name_flag +
optional_tls_flags + optional_tls_flags +
optional_version_flag + optional_version_flag +
optional_rbac_create_flag + optional_rbac_create_flag +
namespace_flag + namespace_flag +
value_flag value_flag +
args_flag
end end
def optional_rbac_create_flag def optional_rbac_create_flag
...@@ -64,6 +72,15 @@ module Gitlab ...@@ -64,6 +72,15 @@ module Gitlab
%w[--set rbac.create=true,rbac.enabled=true] %w[--set rbac.create=true,rbac.enabled=true]
end 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 def optional_version_flag
return [] unless version return [] unless version
......
...@@ -24,6 +24,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do ...@@ -24,6 +24,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
<<~EOS <<~EOS
helm init --client-only >/dev/null helm init --client-only >/dev/null
helm repo add app-name https://repository.example.com helm repo add app-name https://repository.example.com
helm repo update >/dev/null
#{helm_install_comand} #{helm_install_comand}
EOS EOS
end end
...@@ -51,6 +52,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do ...@@ -51,6 +52,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
<<~EOS <<~EOS
helm init --client-only >/dev/null helm init --client-only >/dev/null
helm repo add app-name https://repository.example.com helm repo add app-name https://repository.example.com
helm repo update >/dev/null
#{helm_install_command} #{helm_install_command}
EOS EOS
end end
...@@ -107,6 +109,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do ...@@ -107,6 +109,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
<<~EOS <<~EOS
helm init --client-only >/dev/null helm init --client-only >/dev/null
helm repo add app-name https://repository.example.com helm repo add app-name https://repository.example.com
helm repo update >/dev/null
#{helm_install_command} #{helm_install_command}
EOS EOS
end end
...@@ -131,6 +134,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do ...@@ -131,6 +134,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
<<~EOS <<~EOS
helm init --client-only >/dev/null helm init --client-only >/dev/null
helm repo add app-name https://repository.example.com helm repo add app-name https://repository.example.com
helm repo update >/dev/null
#{helm_install_command} #{helm_install_command}
EOS EOS
end end
......
...@@ -6,8 +6,8 @@ shared_examples 'helm commands' do ...@@ -6,8 +6,8 @@ shared_examples 'helm commands' do
ALPINE_VERSION=$(cat /etc/alpine-release | cut -d '.' -f 1,2) 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://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 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-v2.7.2-linux-amd64.tar.gz | tar zxC /tmp >/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/ mv /tmp/linux-amd64/helm /usr/bin/
EOS EOS
end 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