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
88375194
Commit
88375194
authored
Nov 03, 2018
by
Amit Rathi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pushing WIP state for backup
parent
98a504ec
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
99 additions
and
12 deletions
+99
-12
app/assets/javascripts/clusters/clusters_bundle.js
app/assets/javascripts/clusters/clusters_bundle.js
+2
-0
app/assets/javascripts/clusters/components/applications.vue
app/assets/javascripts/clusters/components/applications.vue
+27
-0
app/assets/javascripts/clusters/services/clusters_service.js
app/assets/javascripts/clusters/services/clusters_service.js
+1
-0
app/assets/javascripts/clusters/stores/clusters_store.js
app/assets/javascripts/clusters/stores/clusters_store.js
+8
-0
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+3
-0
app/services/clusters/applications/check_installation_progress_service.rb
...sters/applications/check_installation_progress_service.rb
+3
-1
app/services/clusters/applications/create_service.rb
app/services/clusters/applications/create_service.rb
+5
-0
app/services/clusters/applications/install_service.rb
app/services/clusters/applications/install_service.rb
+10
-2
app/views/projects/clusters/show.html.haml
app/views/projects/clusters/show.html.haml
+1
-0
app/workers/cluster_install_app_worker.rb
app/workers/cluster_install_app_worker.rb
+1
-0
db/schema.rb
db/schema.rb
+13
-1
lib/gitlab/kubernetes/helm/api.rb
lib/gitlab/kubernetes/helm/api.rb
+21
-7
lib/gitlab/kubernetes/helm/install_command.rb
lib/gitlab/kubernetes/helm/install_command.rb
+4
-1
No files found.
app/assets/javascripts/clusters/clusters_bundle.js
View file @
88375194
...
...
@@ -26,6 +26,7 @@ export default class Clusters {
statusPath
,
installHelmPath
,
installIngressPath
,
installCertManagerPath
,
installRunnerPath
,
installJupyterPath
,
installPrometheusPath
,
...
...
@@ -46,6 +47,7 @@ export default class Clusters {
endpoint
:
statusPath
,
installHelmEndpoint
:
installHelmPath
,
installIngressEndpoint
:
installIngressPath
,
installCertManagerEndpoint
:
installCertManagerPath
,
installRunnerEndpoint
:
installRunnerPath
,
installPrometheusEndpoint
:
installPrometheusPath
,
installJupyterEndpoint
:
installJupyterPath
,
...
...
app/assets/javascripts/clusters/components/applications.vue
View file @
88375194
...
...
@@ -7,6 +7,7 @@ import helmLogo from 'images/cluster_app_logos/helm.png';
import
jeagerLogo
from
'
images/cluster_app_logos/jeager.png
'
;
import
jupyterhubLogo
from
'
images/cluster_app_logos/jupyterhub.png
'
;
import
kubernetesLogo
from
'
images/cluster_app_logos/kubernetes.png
'
;
import
certManagerLogo
from
'
images/cluster_app_logos/cert_manager.png
'
;
import
meltanoLogo
from
'
images/cluster_app_logos/meltano.png
'
;
import
prometheusLogo
from
'
images/cluster_app_logos/prometheus.png
'
;
import
{
s__
,
sprintf
}
from
'
../../locale
'
;
...
...
@@ -53,6 +54,7 @@ export default {
jeagerLogo
,
jupyterhubLogo
,
kubernetesLogo
,
certManagerLogo
,
meltanoLogo
,
prometheusLogo
,
}),
...
...
@@ -69,6 +71,9 @@ export default {
ingressInstalled
()
{
return
this
.
applications
.
ingress
.
status
===
APPLICATION_STATUS
.
INSTALLED
;
},
certManagerInstalled
()
{
return
this
.
applications
.
cert_manager
.
status
===
APPLICATION_STATUS
.
INSTALLED
;
},
ingressExternalIp
()
{
return
this
.
applications
.
ingress
.
externalIp
;
},
...
...
@@ -275,6 +280,28 @@ export default {
</div>
</div>
</application-row>
<application-row
id=
"cert_manager"
:logo-url=
"certManagerLogo"
:title=
"applications.cert_manager.title"
:status=
"applications.cert_manager.status"
:status-reason=
"applications.cert_manager.statusReason"
:request-status=
"applications.cert_manager.requestStatus"
:request-reason=
"applications.cert_manager.requestReason"
:disabled=
"!helmInstalled"
class=
"hide-bottom-border rounded-bottom"
title-link=
"https://cert-manager.readthedocs.io/en/latest/#"
>
<div
slot=
"description"
>
<p>
{{ s__(`ClusterIntegration|Cert-Manager is a native Kubernetes
certificate management controller. It will ensure certificates
are valid and up to date, and attempt to renew certificates at
a configured time before expiry. We use Lets Encrypt as a Certificate
Authority with Cert-Manager.`) }}
</p>
</div>
</application-row>
<application-row
id=
"prometheus"
:logo-url=
"prometheusLogo"
...
...
app/assets/javascripts/clusters/services/clusters_service.js
View file @
88375194
...
...
@@ -6,6 +6,7 @@ export default class ClusterService {
this
.
appInstallEndpointMap
=
{
helm
:
this
.
options
.
installHelmEndpoint
,
ingress
:
this
.
options
.
installIngressEndpoint
,
cert_manager
:
this
.
options
.
installCertManagerEndpoint
,
runner
:
this
.
options
.
installRunnerEndpoint
,
prometheus
:
this
.
options
.
installPrometheusEndpoint
,
jupyter
:
this
.
options
.
installJupyterEndpoint
,
...
...
app/assets/javascripts/clusters/stores/clusters_store.js
View file @
88375194
...
...
@@ -24,6 +24,14 @@ export default class ClusterStore {
requestReason
:
null
,
externalIp
:
null
,
},
cert_manager
:
{
title
:
s__
(
'
ClusterIntegration|Cert-Manager
'
),
status
:
null
,
statusReason
:
null
,
requestStatus
:
null
,
requestReason
:
null
,
externalIp
:
null
,
},
runner
:
{
title
:
s__
(
'
ClusterIntegration|GitLab Runner
'
),
status
:
null
,
...
...
app/models/clusters/cluster.rb
View file @
88375194
...
...
@@ -9,6 +9,7 @@ module Clusters
APPLICATIONS
=
{
Applications
::
Helm
.
application_name
=>
Applications
::
Helm
,
Applications
::
Ingress
.
application_name
=>
Applications
::
Ingress
,
Applications
::
CertManager
.
application_name
=>
Applications
::
CertManager
,
Applications
::
Prometheus
.
application_name
=>
Applications
::
Prometheus
,
Applications
::
Runner
.
application_name
=>
Applications
::
Runner
,
Applications
::
Jupyter
.
application_name
=>
Applications
::
Jupyter
...
...
@@ -33,6 +34,7 @@ module Clusters
has_one
:application_helm
,
class_name:
'Clusters::Applications::Helm'
has_one
:application_ingress
,
class_name:
'Clusters::Applications::Ingress'
has_one
:application_cert_manager
,
class_name:
'Clusters::Applications::CertManager'
has_one
:application_prometheus
,
class_name:
'Clusters::Applications::Prometheus'
has_one
:application_runner
,
class_name:
'Clusters::Applications::Runner'
has_one
:application_jupyter
,
class_name:
'Clusters::Applications::Jupyter'
...
...
@@ -99,6 +101,7 @@ module Clusters
[
application_helm
||
build_application_helm
,
application_ingress
||
build_application_ingress
,
application_cert_manager
||
build_application_cert_manager
,
application_prometheus
||
build_application_prometheus
,
application_runner
||
build_application_runner
,
application_jupyter
||
build_application_jupyter
...
...
app/services/clusters/applications/check_installation_progress_service.rb
View file @
88375194
...
...
@@ -27,9 +27,11 @@ module Clusters
end
def
on_failed
Gitlab
::
AppLogger
.
info
(
"Installation FAILED!!"
)
app
.
make_errored!
(
'Installation failed'
)
ensure
remove_installation_pod
Gitlab
::
AppLogger
.
info
(
"SKIP CLEARING POD!"
)
# remove_installation_pod
end
def
check_timeout
...
...
app/services/clusters/applications/create_service.rb
View file @
88375194
...
...
@@ -19,6 +19,10 @@ module Clusters
application
.
hostname
=
params
[
:hostname
]
end
if
application
.
has_attribute?
(
:email
)
application
.
email
=
@current_user
.
email
end
if
application
.
respond_to?
(
:oauth_application
)
application
.
oauth_application
=
create_oauth_application
(
application
,
request
)
end
...
...
@@ -43,6 +47,7 @@ module Clusters
{
"helm"
=>
->
(
cluster
)
{
cluster
.
application_helm
||
cluster
.
build_application_helm
},
"ingress"
=>
->
(
cluster
)
{
cluster
.
application_ingress
||
cluster
.
build_application_ingress
},
"cert_manager"
=>
->
(
cluster
)
{
cluster
.
application_cert_manager
||
cluster
.
build_application_cert_manager
},
"prometheus"
=>
->
(
cluster
)
{
cluster
.
application_prometheus
||
cluster
.
build_application_prometheus
},
"runner"
=>
->
(
cluster
)
{
cluster
.
application_runner
||
cluster
.
build_application_runner
},
"jupyter"
=>
->
(
cluster
)
{
cluster
.
application_jupyter
||
cluster
.
build_application_jupyter
}
...
...
app/services/clusters/applications/install_service.rb
View file @
88375194
...
...
@@ -4,17 +4,25 @@ module Clusters
module
Applications
class
InstallService
<
BaseHelmService
def
execute
Gitlab
::
AppLogger
.
info
(
'---- IN execute installing ----'
)
return
unless
app
.
scheduled?
begin
app
.
make_installing!
helm_api
.
install
(
install_command
)
ClusterWaitForAppInstallationWorker
.
perform_in
(
ClusterWaitForAppInstallationWorker
::
INTERVAL
,
app
.
name
,
app
.
id
)
rescue
Kubeclient
::
HttpError
rescue
Kubeclient
::
HttpError
=>
e
Gitlab
::
AppLogger
.
info
(
'HttpError---- IN execute installing ----'
)
Gitlab
::
AppLogger
.
error
(
e
)
Gitlab
::
AppLogger
.
error
(
e
.
backtrace
.
join
(
"
\n
"
))
app
.
make_errored!
(
"Kubernetes error."
)
rescue
StandardError
rescue
StandardError
=>
e
Gitlab
::
AppLogger
.
info
(
'StandardError---- IN execute installing ----'
)
Gitlab
::
AppLogger
.
error
(
e
)
Gitlab
::
AppLogger
.
error
(
e
.
backtrace
.
join
(
"
\n
"
))
app
.
make_errored!
(
"Can't start installation process."
)
end
end
...
...
app/views/projects/clusters/show.html.haml
View file @
88375194
...
...
@@ -9,6 +9,7 @@
.edit-cluster-form.js-edit-cluster-form
{
data:
{
status_path:
status_path
,
install_helm_path:
install_applications_namespace_project_cluster_path
(
@cluster
.
project
.
namespace
,
@cluster
.
project
,
@cluster
,
:helm
),
install_ingress_path:
install_applications_namespace_project_cluster_path
(
@cluster
.
project
.
namespace
,
@cluster
.
project
,
@cluster
,
:ingress
),
install_cert_manager_path:
install_applications_namespace_project_cluster_path
(
@cluster
.
project
.
namespace
,
@cluster
.
project
,
@cluster
,
:cert_manager
),
install_prometheus_path:
install_applications_namespace_project_cluster_path
(
@cluster
.
project
.
namespace
,
@cluster
.
project
,
@cluster
,
:prometheus
),
install_runner_path:
install_applications_namespace_project_cluster_path
(
@cluster
.
project
.
namespace
,
@cluster
.
project
,
@cluster
,
:runner
),
install_jupyter_path:
install_applications_namespace_project_cluster_path
(
@cluster
.
project
.
namespace
,
@cluster
.
project
,
@cluster
,
:jupyter
),
...
...
app/workers/cluster_install_app_worker.rb
View file @
88375194
...
...
@@ -7,6 +7,7 @@ class ClusterInstallAppWorker
def
perform
(
app_name
,
app_id
)
find_application
(
app_name
,
app_id
)
do
|
app
|
Clusters
::
Applications
::
InstallService
.
new
(
app
).
execute
end
end
...
...
db/schema.rb
View file @
88375194
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20181
017001059
)
do
ActiveRecord
::
Schema
.
define
(
version:
20181
101191341
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -668,6 +668,16 @@ ActiveRecord::Schema.define(version: 20181017001059) do
add_index
"clusters"
,
[
"enabled"
],
name:
"index_clusters_on_enabled"
,
using: :btree
add_index
"clusters"
,
[
"user_id"
],
name:
"index_clusters_on_user_id"
,
using: :btree
create_table
"clusters_applications_cert_managers"
,
force: :cascade
do
|
t
|
t
.
integer
"cluster_id"
,
null:
false
t
.
integer
"status"
,
null:
false
t
.
string
"version"
,
null:
false
t
.
string
"email"
,
null:
false
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
text
"status_reason"
end
create_table
"clusters_applications_helm"
,
force: :cascade
do
|
t
|
t
.
integer
"cluster_id"
,
null:
false
t
.
datetime_with_timezone
"created_at"
,
null:
false
...
...
@@ -1843,6 +1853,7 @@ ActiveRecord::Schema.define(version: 20181017001059) do
end
add_index
"redirect_routes"
,
[
"path"
],
name:
"index_redirect_routes_on_path"
,
unique:
true
,
using: :btree
add_index
"redirect_routes"
,
[
"path"
],
name:
"index_redirect_routes_on_path_text_pattern_ops"
,
using: :btree
,
opclasses:
{
"path"
=>
"varchar_pattern_ops"
}
add_index
"redirect_routes"
,
[
"source_type"
,
"source_id"
],
name:
"index_redirect_routes_on_source_type_and_source_id"
,
using: :btree
create_table
"releases"
,
force: :cascade
do
|
t
|
...
...
@@ -2391,6 +2402,7 @@ ActiveRecord::Schema.define(version: 20181017001059) do
add_foreign_key
"cluster_projects"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"cluster_providers_gcp"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"clusters"
,
"users"
,
on_delete: :nullify
add_foreign_key
"clusters_applications_cert_managers"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"clusters_applications_helm"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"clusters_applications_ingress"
,
"clusters"
,
name:
"fk_753a7b41c1"
,
on_delete: :cascade
add_foreign_key
"clusters_applications_jupyter"
,
"clusters"
,
on_delete: :cascade
...
...
lib/gitlab/kubernetes/helm/api.rb
View file @
88375194
...
...
@@ -8,13 +8,26 @@ module Gitlab
end
def
install
(
command
)
namespace
.
ensure_exists!
create_service_account
(
command
)
create_cluster_role_binding
(
command
)
create_config_map
(
command
)
kubeclient
.
create_pod
(
command
.
pod_resource
)
begin
namespace
.
ensure_exists!
create_service_account
(
command
)
create_cluster_role_binding
(
command
)
Gitlab
::
AppLogger
.
info
(
"---CREATING CONFIG MAP-----"
)
Gitlab
::
AppLogger
.
info
(
command
)
create_config_map
(
command
)
Gitlab
::
AppLogger
.
info
(
"---CREATING K8s POD-----"
)
kubeclient
.
create_pod
(
command
.
pod_resource
)
rescue
StandardError
=>
e
Gitlab
::
AppLogger
.
info
(
'install_api_error------------------------------------------------'
)
Gitlab
::
AppLogger
.
error
(
e
)
Gitlab
::
AppLogger
.
error
(
e
.
backtrace
.
join
(
"
\n
"
))
rescue
Exception
=>
e
Gitlab
::
AppLogger
.
info
(
'install_api_exception--------------------------------------------------'
)
Gitlab
::
AppLogger
.
error
(
e
)
Gitlab
::
AppLogger
.
error
(
e
.
backtrace
.
join
(
"
\n
"
))
end
end
def
update
(
command
)
...
...
@@ -54,6 +67,7 @@ module Gitlab
def
create_config_map
(
command
)
command
.
config_map_resource
.
tap
do
|
config_map_resource
|
Gitlab
::
AppLogger
.
info
(
config_map_resource
)
kubeclient
.
create_config_map
(
config_map_resource
)
end
end
...
...
lib/gitlab/kubernetes/helm/install_command.rb
View file @
88375194
...
...
@@ -47,13 +47,16 @@ module Gitlab
name_flag
=
[
'--name'
,
name
]
namespace_flag
=
[
'--namespace'
,
Gitlab
::
Kubernetes
::
Helm
::
NAMESPACE
]
value_flag
=
[
'-f'
,
"/data/helm/
#{
name
}
/config/values.yaml"
]
a
=
[
'--set'
,
'ingressShim.defaultIssuerName=letsencrypt-prod'
]
b
=
[
'--set'
,
'ingressShim.defaultIssuerKind=ClusterIssuer'
]
c
=
[
'--set'
,
'rbac.create=false'
]
name_flag
+
optional_tls_flags
+
optional_version_flag
+
optional_rbac_create_flag
+
namespace_flag
+
value_flag
value_flag
+
a
+
b
+
c
end
def
optional_rbac_create_flag
...
...
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