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
Jérome Perrin
gitlab-ce
Commits
31c256c1
Commit
31c256c1
authored
Nov 02, 2017
by
Alessio Caiazza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
General cleanup
parent
30938b89
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
38 deletions
+21
-38
app/models/clusters/applications/helm.rb
app/models/clusters/applications/helm.rb
+1
-1
app/services/clusters/base_helm_service.rb
app/services/clusters/base_helm_service.rb
+1
-1
app/services/clusters/install_app_service.rb
app/services/clusters/install_app_service.rb
+0
-1
app/services/clusters/install_tiller_service.rb
app/services/clusters/install_tiller_service.rb
+0
-24
db/migrate/20171031100710_create_clusters_kubernetes_helm_apps.rb
...te/20171031100710_create_clusters_kubernetes_helm_apps.rb
+4
-0
lib/gitlab/kubernetes/helm.rb
lib/gitlab/kubernetes/helm.rb
+15
-11
No files found.
app/models/clusters/applications/helm.rb
View file @
31c256c1
...
...
@@ -9,7 +9,7 @@ module Clusters
belongs_to
:cluster
,
class_name:
'Clusters::Cluster'
,
foreign_key: :cluster_id
default_value_for
:version
,
Gitlab
::
Cluster
s
::
Helm
::
HELM_VERSION
default_value_for
:version
,
Gitlab
::
Kubernete
s
::
Helm
::
HELM_VERSION
def
name
NAME
...
...
app/services/clusters/base_helm_service.rb
View file @
31c256c1
...
...
@@ -17,7 +17,7 @@ module Clusters
end
def
helm_api
@helm
||=
Gitlab
::
Cluster
s
::
Helm
.
new
(
kubeclient
)
@helm
||=
Gitlab
::
Kubernete
s
::
Helm
.
new
(
kubeclient
)
end
end
end
app/services/clusters/install_app_service.rb
View file @
31c256c1
...
...
@@ -15,7 +15,6 @@ module Clusters
rescue
KubeException
=>
ke
app
.
make_errored!
(
"Kubernetes error:
#{
ke
.
message
}
"
)
rescue
StandardError
=>
e
Rails
.
logger
.
warn
(
e
.
message
)
app
.
make_errored!
(
"Can't start installation process"
)
end
end
...
...
app/services/clusters/install_tiller_service.rb
deleted
100644 → 0
View file @
30938b89
module
Clusters
class
InstallTillerService
<
BaseService
def
execute
ensure_namespace
install
end
private
def
kubernetes_service
return
@kubernetes_service
if
defined?
(
@kubernetes_service
)
@kubernetes_service
=
project
&
.
kubernetes_service
end
def
ensure_namespace
kubernetes_service
&
.
ensure_namespace!
end
def
install
kubernetes_service
&
.
helm_client
&
.
init!
end
end
end
db/migrate/20171031100710_create_clusters_kubernetes_helm_apps.rb
View file @
31c256c1
class
CreateClustersKubernetesHelmApps
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
create_table
:clusters_applications_helm
do
|
t
|
t
.
references
:cluster
,
null:
false
,
unique:
true
,
foreign_key:
{
on_delete: :cascade
}
...
...
lib/gitlab/
cluster
s/helm.rb
→
lib/gitlab/
kubernete
s/helm.rb
View file @
31c256c1
module
Gitlab
module
Cluster
s
module
Kubernete
s
class
Helm
Error
=
Class
.
new
(
StandardError
)
HELM_VERSION
=
'2.7.0'
.
freeze
NAMESPACE
=
'gitlab-managed-apps'
.
freeze
COMMAND_SCRIPT
=
<<-
EOS
.
freeze
...
...
@@ -18,12 +17,11 @@ module Gitlab
end
def
init!
ensure_namespace!
@kubeclient
.
create_pod
(
pod_resource
(
OpenStruct
.
new
(
name:
'helm'
)))
install
(
OpenStruct
.
new
(
name:
'helm'
))
end
def
install
(
app
)
ensure_namespace!
create_namespace!
unless
has_namespace?
@kubeclient
.
create_pod
(
pod_resource
(
app
))
end
...
...
@@ -86,18 +84,24 @@ module Gitlab
"install
#{
app
.
chart
}
--name
#{
app
.
name
}
--namespace
#{
NAMESPACE
}
"
end
def
ensure_namespace!
def
has_namespace?
return
@has_namespace
if
defined?
(
@has_namespace
)
begin
@kubeclient
.
get_namespace
(
NAMESPACE
)
@has_namespace
=
true
rescue
KubeException
=>
ke
raise
ke
unless
ke
.
error_code
==
404
false
end
end
namespace_resource
=
::
Kubeclient
::
Resource
.
new
namespace_resource
.
metadata
=
{}
namespace_resource
.
metadata
.
name
=
NAMESPACE
def
create_namespace!
namespace_resource
=
::
Kubeclient
::
Resource
.
new
namespace_resource
.
metadata
=
{}
namespace_resource
.
metadata
.
name
=
NAMESPACE
@kubeclient
.
create_namespace
(
namespace_resource
)
end
@kubeclient
.
create_namespace
(
namespace_resource
)
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