Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
da783695
Commit
da783695
authored
Nov 09, 2018
by
Dylan Griffith
Committed by
Kamil Trzciński
Nov 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve Debugging Capabilities For Helm Application Installs
parent
8b1212ed
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
40 additions
and
41 deletions
+40
-41
app/models/clusters/applications/knative.rb
app/models/clusters/applications/knative.rb
+1
-1
lib/gitlab/kubernetes/helm/base_command.rb
lib/gitlab/kubernetes/helm/base_command.rb
+1
-1
lib/gitlab/kubernetes/helm/init_command.rb
lib/gitlab/kubernetes/helm/init_command.rb
+1
-1
lib/gitlab/kubernetes/helm/install_command.rb
lib/gitlab/kubernetes/helm/install_command.rb
+3
-3
lib/gitlab/kubernetes/helm/upgrade_command.rb
lib/gitlab/kubernetes/helm/upgrade_command.rb
+2
-2
spec/lib/gitlab/kubernetes/helm/init_command_spec.rb
spec/lib/gitlab/kubernetes/helm/init_command_spec.rb
+2
-2
spec/lib/gitlab/kubernetes/helm/install_command_spec.rb
spec/lib/gitlab/kubernetes/helm/install_command_spec.rb
+20
-21
spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb
spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb
+8
-8
spec/support/shared_examples/helm_generated_script.rb
spec/support/shared_examples/helm_generated_script.rb
+2
-2
No files found.
app/models/clusters/applications/knative.rb
View file @
da783695
...
@@ -44,7 +44,7 @@ module Clusters
...
@@ -44,7 +44,7 @@ module Clusters
private
private
def
install_script
def
install_script
[
"/usr/bin/kubectl apply -f
#{
ISTIO_CRDS
}
>/dev/null
"
]
[
"/usr/bin/kubectl apply -f
#{
ISTIO_CRDS
}
"
]
end
end
end
end
end
end
...
...
lib/gitlab/kubernetes/helm/base_command.rb
View file @
da783695
...
@@ -10,7 +10,7 @@ module Gitlab
...
@@ -10,7 +10,7 @@ module Gitlab
def
generate_script
def
generate_script
<<~
HEREDOC
<<~
HEREDOC
set -eo pipefail
set -
x
eo pipefail
HEREDOC
HEREDOC
end
end
...
...
lib/gitlab/kubernetes/helm/init_command.rb
View file @
da783695
...
@@ -45,7 +45,7 @@ module Gitlab
...
@@ -45,7 +45,7 @@ module Gitlab
def
init_helm_command
def
init_helm_command
command
=
%w[helm init]
+
init_command_flags
command
=
%w[helm init]
+
init_command_flags
command
.
shelljoin
+
" >/dev/null
\n
"
command
.
shelljoin
end
end
def
init_command_flags
def
init_command_flags
...
...
lib/gitlab/kubernetes/helm/install_command.rb
View file @
da783695
...
@@ -35,7 +35,7 @@ module Gitlab
...
@@ -35,7 +35,7 @@ module Gitlab
private
private
def
init_command
def
init_command
'helm init --client-only
>/dev/null
'
'helm init --client-only'
end
end
def
repository_command
def
repository_command
...
@@ -43,13 +43,13 @@ module Gitlab
...
@@ -43,13 +43,13 @@ module Gitlab
end
end
def
repository_update_command
def
repository_update_command
'helm repo update
>/dev/null
'
if
repository
'helm repo update'
if
repository
end
end
def
install_command
def
install_command
command
=
[
'helm'
,
'install'
,
chart
]
+
install_command_flags
command
=
[
'helm'
,
'install'
,
chart
]
+
install_command_flags
command
.
shelljoin
+
" >/dev/null
\n
"
command
.
shelljoin
end
end
def
preinstall_command
def
preinstall_command
...
...
lib/gitlab/kubernetes/helm/upgrade_command.rb
View file @
da783695
...
@@ -36,7 +36,7 @@ module Gitlab
...
@@ -36,7 +36,7 @@ module Gitlab
private
private
def
init_command
def
init_command
'helm init --client-only
>/dev/null
'
'helm init --client-only'
end
end
def
repository_command
def
repository_command
...
@@ -50,7 +50,7 @@ module Gitlab
...
@@ -50,7 +50,7 @@ module Gitlab
" --namespace
#{
::
Gitlab
::
Kubernetes
::
Helm
::
NAMESPACE
}
"
\
" --namespace
#{
::
Gitlab
::
Kubernetes
::
Helm
::
NAMESPACE
}
"
\
" -f /data/helm/
#{
name
}
/config/values.yaml"
" -f /data/helm/
#{
name
}
/config/values.yaml"
"helm upgrade
#{
name
}
#{
chart
}#{
upgrade_flags
}
>/dev/null
\n
"
"helm upgrade
#{
name
}
#{
chart
}#{
upgrade_flags
}
"
end
end
def
optional_version_flag
def
optional_version_flag
...
...
spec/lib/gitlab/kubernetes/helm/init_command_spec.rb
View file @
da783695
...
@@ -8,7 +8,7 @@ describe Gitlab::Kubernetes::Helm::InitCommand do
...
@@ -8,7 +8,7 @@ describe Gitlab::Kubernetes::Helm::InitCommand do
let
(
:commands
)
do
let
(
:commands
)
do
<<~
EOS
<<~
EOS
helm init --tiller-tls --tiller-tls-verify --tls-ca-cert /data/helm/helm/config/ca.pem --tiller-tls-cert /data/helm/helm/config/cert.pem --tiller-tls-key /data/helm/helm/config/key.pem
>/dev/null
helm init --tiller-tls --tiller-tls-verify --tls-ca-cert /data/helm/helm/config/ca.pem --tiller-tls-cert /data/helm/helm/config/cert.pem --tiller-tls-key /data/helm/helm/config/key.pem
EOS
EOS
end
end
...
@@ -22,7 +22,7 @@ describe Gitlab::Kubernetes::Helm::InitCommand do
...
@@ -22,7 +22,7 @@ describe Gitlab::Kubernetes::Helm::InitCommand do
it_behaves_like
'helm commands'
do
it_behaves_like
'helm commands'
do
let
(
:commands
)
do
let
(
:commands
)
do
<<~
EOS
<<~
EOS
helm init --tiller-tls --tiller-tls-verify --tls-ca-cert /data/helm/helm/config/ca.pem --tiller-tls-cert /data/helm/helm/config/cert.pem --tiller-tls-key /data/helm/helm/config/key.pem --service-account tiller
>/dev/null
helm init --tiller-tls --tiller-tls-verify --tls-ca-cert /data/helm/helm/config/ca.pem --tiller-tls-cert /data/helm/helm/config/cert.pem --tiller-tls-key /data/helm/helm/config/key.pem --service-account tiller
EOS
EOS
end
end
end
end
...
...
spec/lib/gitlab/kubernetes/helm/install_command_spec.rb
View file @
da783695
...
@@ -26,9 +26,9 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
...
@@ -26,9 +26,9 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
it_behaves_like
'helm commands'
do
it_behaves_like
'helm commands'
do
let
(
:commands
)
do
let
(
:commands
)
do
<<~
EOS
<<~
EOS
helm init --client-only
>/dev/null
helm init --client-only
helm repo add app-name https://repository.example.com
helm repo add app-name https://repository.example.com
helm repo update
>/dev/null
helm repo update
#{
helm_install_comand
}
#{
helm_install_comand
}
EOS
EOS
end
end
...
@@ -43,7 +43,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
...
@@ -43,7 +43,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
--tls-key /data/helm/app-name/config/key.pem
--tls-key /data/helm/app-name/config/key.pem
--version 1.2.3
--version 1.2.3
--namespace gitlab-managed-apps
--namespace gitlab-managed-apps
-f /data/helm/app-name/config/values.yaml
>/dev/null
-f /data/helm/app-name/config/values.yaml
EOS
EOS
end
end
end
end
...
@@ -54,9 +54,9 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
...
@@ -54,9 +54,9 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
it_behaves_like
'helm commands'
do
it_behaves_like
'helm commands'
do
let
(
:commands
)
do
let
(
:commands
)
do
<<~
EOS
<<~
EOS
helm init --client-only
>/dev/null
helm init --client-only
helm repo add app-name https://repository.example.com
helm repo add app-name https://repository.example.com
helm repo update
>/dev/null
helm repo update
#{
helm_install_command
}
#{
helm_install_command
}
EOS
EOS
end
end
...
@@ -72,7 +72,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
...
@@ -72,7 +72,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
--version 1.2.3
--version 1.2.3
--set rbac.create
\\
=true,rbac.enabled
\\
=true
--set rbac.create
\\
=true,rbac.enabled
\\
=true
--namespace gitlab-managed-apps
--namespace gitlab-managed-apps
-f /data/helm/app-name/config/values.yaml
>/dev/null
-f /data/helm/app-name/config/values.yaml
EOS
EOS
end
end
end
end
...
@@ -84,7 +84,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
...
@@ -84,7 +84,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
it_behaves_like
'helm commands'
do
it_behaves_like
'helm commands'
do
let
(
:commands
)
do
let
(
:commands
)
do
<<~
EOS
<<~
EOS
helm init --client-only
>/dev/null
helm init --client-only
#{
helm_install_command
}
#{
helm_install_command
}
EOS
EOS
end
end
...
@@ -99,7 +99,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
...
@@ -99,7 +99,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
--tls-key /data/helm/app-name/config/key.pem
--tls-key /data/helm/app-name/config/key.pem
--version 1.2.3
--version 1.2.3
--namespace gitlab-managed-apps
--namespace gitlab-managed-apps
-f /data/helm/app-name/config/values.yaml
>/dev/null
-f /data/helm/app-name/config/values.yaml
EOS
EOS
end
end
end
end
...
@@ -111,9 +111,9 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
...
@@ -111,9 +111,9 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
it_behaves_like
'helm commands'
do
it_behaves_like
'helm commands'
do
let
(
:commands
)
do
let
(
:commands
)
do
<<~
EOS
<<~
EOS
helm init --client-only
>/dev/null
helm init --client-only
helm repo add app-name https://repository.example.com
helm repo add app-name https://repository.example.com
helm repo update
>/dev/null
helm repo update
#{
helm_install_command
}
#{
helm_install_command
}
EOS
EOS
end
end
...
@@ -122,7 +122,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
...
@@ -122,7 +122,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
<<~
EOS
.
strip
<<~
EOS
.
strip
/bin/date
/bin/date
/bin/true
/bin/true
helm install chart-name --name app-name --tls --tls-ca-cert /data/helm/app-name/config/ca.pem --tls-cert /data/helm/app-name/config/cert.pem --tls-key /data/helm/app-name/config/key.pem --version 1.2.3 --namespace gitlab-managed-apps -f /data/helm/app-name/config/values.yaml
>/dev/null
helm install chart-name --name app-name --tls --tls-ca-cert /data/helm/app-name/config/ca.pem --tls-cert /data/helm/app-name/config/cert.pem --tls-key /data/helm/app-name/config/key.pem --version 1.2.3 --namespace gitlab-managed-apps -f /data/helm/app-name/config/values.yaml
EOS
EOS
end
end
end
end
...
@@ -134,17 +134,16 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
...
@@ -134,17 +134,16 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
it_behaves_like
'helm commands'
do
it_behaves_like
'helm commands'
do
let
(
:commands
)
do
let
(
:commands
)
do
<<~
EOS
<<~
EOS
helm init --client-only
>/dev/null
helm init --client-only
helm repo add app-name https://repository.example.com
helm repo add app-name https://repository.example.com
helm repo update
>/dev/null
helm repo update
#{
helm_install_command
}
#{
helm_install_command
}
EOS
EOS
end
end
let
(
:helm_install_command
)
do
let
(
:helm_install_command
)
do
<<~
EOS
.
strip
<<~
EOS
.
strip
helm install chart-name --name app-name --tls --tls-ca-cert /data/helm/app-name/config/ca.pem --tls-cert /data/helm/app-name/config/cert.pem --tls-key /data/helm/app-name/config/key.pem --version 1.2.3 --namespace gitlab-managed-apps -f /data/helm/app-name/config/values.yaml >/dev/null
helm install chart-name --name app-name --tls --tls-ca-cert /data/helm/app-name/config/ca.pem --tls-cert /data/helm/app-name/config/cert.pem --tls-key /data/helm/app-name/config/key.pem --version 1.2.3 --namespace gitlab-managed-apps -f /data/helm/app-name/config/values.yaml
/bin/date
/bin/date
/bin/false
/bin/false
EOS
EOS
...
@@ -158,9 +157,9 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
...
@@ -158,9 +157,9 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
it_behaves_like
'helm commands'
do
it_behaves_like
'helm commands'
do
let
(
:commands
)
do
let
(
:commands
)
do
<<~
EOS
<<~
EOS
helm init --client-only
>/dev/null
helm init --client-only
helm repo add app-name https://repository.example.com
helm repo add app-name https://repository.example.com
helm repo update
>/dev/null
helm repo update
#{
helm_install_command
}
#{
helm_install_command
}
EOS
EOS
end
end
...
@@ -171,7 +170,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
...
@@ -171,7 +170,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
--name app-name
--name app-name
--version 1.2.3
--version 1.2.3
--namespace gitlab-managed-apps
--namespace gitlab-managed-apps
-f /data/helm/app-name/config/values.yaml
>/dev/null
-f /data/helm/app-name/config/values.yaml
EOS
EOS
end
end
end
end
...
@@ -183,9 +182,9 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
...
@@ -183,9 +182,9 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
it_behaves_like
'helm commands'
do
it_behaves_like
'helm commands'
do
let
(
:commands
)
do
let
(
:commands
)
do
<<~
EOS
<<~
EOS
helm init --client-only
>/dev/null
helm init --client-only
helm repo add app-name https://repository.example.com
helm repo add app-name https://repository.example.com
helm repo update
>/dev/null
helm repo update
#{
helm_install_command
}
#{
helm_install_command
}
EOS
EOS
end
end
...
@@ -199,7 +198,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
...
@@ -199,7 +198,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
--tls-cert /data/helm/app-name/config/cert.pem
--tls-cert /data/helm/app-name/config/cert.pem
--tls-key /data/helm/app-name/config/key.pem
--tls-key /data/helm/app-name/config/key.pem
--namespace gitlab-managed-apps
--namespace gitlab-managed-apps
-f /data/helm/app-name/config/values.yaml
>/dev/null
-f /data/helm/app-name/config/values.yaml
EOS
EOS
end
end
end
end
...
...
spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb
View file @
da783695
...
@@ -21,8 +21,8 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do
...
@@ -21,8 +21,8 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do
it_behaves_like
'helm commands'
do
it_behaves_like
'helm commands'
do
let
(
:commands
)
do
let
(
:commands
)
do
<<~
EOS
<<~
EOS
helm init --client-only
>/dev/null
helm init --client-only
helm upgrade
#{
application
.
name
}
#{
application
.
chart
}
--tls --tls-ca-cert /data/helm/
#{
application
.
name
}
/config/ca.pem --tls-cert /data/helm/
#{
application
.
name
}
/config/cert.pem --tls-key /data/helm/
#{
application
.
name
}
/config/key.pem --reset-values --install --namespace
#{
namespace
}
-f /data/helm/
#{
application
.
name
}
/config/values.yaml
>/dev/null
helm upgrade
#{
application
.
name
}
#{
application
.
chart
}
--tls --tls-ca-cert /data/helm/
#{
application
.
name
}
/config/ca.pem --tls-cert /data/helm/
#{
application
.
name
}
/config/cert.pem --tls-key /data/helm/
#{
application
.
name
}
/config/key.pem --reset-values --install --namespace
#{
namespace
}
-f /data/helm/
#{
application
.
name
}
/config/values.yaml
EOS
EOS
end
end
end
end
...
@@ -33,8 +33,8 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do
...
@@ -33,8 +33,8 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do
it_behaves_like
'helm commands'
do
it_behaves_like
'helm commands'
do
let
(
:commands
)
do
let
(
:commands
)
do
<<~
EOS
<<~
EOS
helm init --client-only
>/dev/null
helm init --client-only
helm upgrade
#{
application
.
name
}
#{
application
.
chart
}
--tls --tls-ca-cert /data/helm/
#{
application
.
name
}
/config/ca.pem --tls-cert /data/helm/
#{
application
.
name
}
/config/cert.pem --tls-key /data/helm/
#{
application
.
name
}
/config/key.pem --reset-values --install --namespace
#{
namespace
}
-f /data/helm/
#{
application
.
name
}
/config/values.yaml
>/dev/null
helm upgrade
#{
application
.
name
}
#{
application
.
chart
}
--tls --tls-ca-cert /data/helm/
#{
application
.
name
}
/config/ca.pem --tls-cert /data/helm/
#{
application
.
name
}
/config/cert.pem --tls-key /data/helm/
#{
application
.
name
}
/config/key.pem --reset-values --install --namespace
#{
namespace
}
-f /data/helm/
#{
application
.
name
}
/config/values.yaml
EOS
EOS
end
end
end
end
...
@@ -56,9 +56,9 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do
...
@@ -56,9 +56,9 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do
it_behaves_like
'helm commands'
do
it_behaves_like
'helm commands'
do
let
(
:commands
)
do
let
(
:commands
)
do
<<~
EOS
<<~
EOS
helm init --client-only
>/dev/null
helm init --client-only
helm repo add
#{
application
.
name
}
#{
application
.
repository
}
helm repo add
#{
application
.
name
}
#{
application
.
repository
}
helm upgrade
#{
application
.
name
}
#{
application
.
chart
}
--tls --tls-ca-cert /data/helm/
#{
application
.
name
}
/config/ca.pem --tls-cert /data/helm/
#{
application
.
name
}
/config/cert.pem --tls-key /data/helm/
#{
application
.
name
}
/config/key.pem --reset-values --install --namespace
#{
namespace
}
-f /data/helm/
#{
application
.
name
}
/config/values.yaml
>/dev/null
helm upgrade
#{
application
.
name
}
#{
application
.
chart
}
--tls --tls-ca-cert /data/helm/
#{
application
.
name
}
/config/ca.pem --tls-cert /data/helm/
#{
application
.
name
}
/config/cert.pem --tls-key /data/helm/
#{
application
.
name
}
/config/key.pem --reset-values --install --namespace
#{
namespace
}
-f /data/helm/
#{
application
.
name
}
/config/values.yaml
EOS
EOS
end
end
end
end
...
@@ -70,8 +70,8 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do
...
@@ -70,8 +70,8 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do
it_behaves_like
'helm commands'
do
it_behaves_like
'helm commands'
do
let
(
:commands
)
do
let
(
:commands
)
do
<<~
EOS
<<~
EOS
helm init --client-only
>/dev/null
helm init --client-only
helm upgrade
#{
application
.
name
}
#{
application
.
chart
}
--reset-values --install --namespace
#{
namespace
}
-f /data/helm/
#{
application
.
name
}
/config/values.yaml
>/dev/null
helm upgrade
#{
application
.
name
}
#{
application
.
chart
}
--reset-values --install --namespace
#{
namespace
}
-f /data/helm/
#{
application
.
name
}
/config/values.yaml
EOS
EOS
end
end
end
end
...
...
spec/support/shared_examples/helm_generated_script.rb
View file @
da783695
...
@@ -2,12 +2,12 @@ shared_examples 'helm commands' do
...
@@ -2,12 +2,12 @@ shared_examples 'helm commands' do
describe
'#generate_script'
do
describe
'#generate_script'
do
let
(
:helm_setup
)
do
let
(
:helm_setup
)
do
<<~
EOS
<<~
EOS
set -eo pipefail
set -
x
eo pipefail
EOS
EOS
end
end
it
'should return appropriate command'
do
it
'should return appropriate command'
do
expect
(
subject
.
generate_script
).
to
eq
(
helm_setup
+
commands
)
expect
(
subject
.
generate_script
.
strip
).
to
eq
((
helm_setup
+
commands
).
strip
)
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment