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
Léo-Paul Géneau
gitlab-ce
Commits
08752e5d
Commit
08752e5d
authored
Nov 03, 2017
by
Alessio Caiazza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `Clusters::Applications::FetchInstallationStatusService`
parent
c46417c5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
38 deletions
+60
-38
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+1
-1
app/services/clusters/applications/check_installation_progress_service.rb
...sters/applications/check_installation_progress_service.rb
+45
-19
app/services/clusters/applications/fetch_installation_status_service.rb
...lusters/applications/fetch_installation_status_service.rb
+0
-15
app/services/clusters/applications/install_service.rb
app/services/clusters/applications/install_service.rb
+1
-1
app/workers/cluster_wait_for_app_installation_worker.rb
app/workers/cluster_wait_for_app_installation_worker.rb
+1
-2
lib/gitlab/kubernetes/pod.rb
lib/gitlab/kubernetes/pod.rb
+12
-0
No files found.
app/models/clusters/cluster.rb
View file @
08752e5d
...
@@ -52,7 +52,7 @@ module Clusters
...
@@ -52,7 +52,7 @@ module Clusters
end
end
def
applications
def
applications
[
[
application_helm
||
build_application_helm
application_helm
||
build_application_helm
]
]
end
end
...
...
app/services/clusters/applications/check_installation_progress_service.rb
View file @
08752e5d
...
@@ -4,26 +4,52 @@ module Clusters
...
@@ -4,26 +4,52 @@ module Clusters
def
execute
def
execute
return
unless
app
.
installing?
return
unless
app
.
installing?
FetchInstallationStatusService
.
new
(
app
).
execute
do
|
phase
,
log
|
case
installation_phase
case
phase
when
Gitlab
::
Kubernetes
::
Pod
::
SUCCEEDED
when
'Succeeded'
on_succeeded
if
app
.
make_installed
when
Gitlab
::
Kubernetes
::
Pod
::
FAILED
FinalizeInstallationService
.
new
(
app
).
execute
on_failed
else
else
app
.
make_errored!
(
"Failed to update app record;
#{
app
.
errors
}
"
)
check_timeout
end
when
'Failed'
app
.
make_errored!
(
log
||
'Installation silently failed'
)
FinalizeInstallationService
.
new
(
app
).
execute
else
if
Time
.
now
.
utc
-
app
.
updated_at
.
to_time
.
utc
>
ClusterWaitForAppInstallationWorker
::
TIMEOUT
app
.
make_errored!
(
'App installation timeouted'
)
else
ClusterWaitForAppInstallationWorker
.
perform_in
(
ClusterWaitForAppInstallationWorker
::
EAGER_INTERVAL
,
app
.
name
,
app
.
id
)
end
end
end
end
rescue
KubeException
=>
ke
app
.
make_errored!
(
"Kubernetes error:
#{
ke
.
message
}
"
)
unless
app
.
errored?
end
private
def
on_succeeded
if
app
.
make_installed
finalize_installation
else
app
.
make_errored!
(
"Failed to update app record;
#{
app
.
errors
}
"
)
end
end
def
on_failed
app
.
make_errored!
(
log
||
'Installation silently failed'
)
finalize_installation
end
def
check_timeout
if
Time
.
now
.
utc
-
app
.
updated_at
.
to_time
.
utc
>
ClusterWaitForAppInstallationWorker
::
TIMEOUT
app
.
make_errored!
(
'App installation timeouted'
)
else
ClusterWaitForAppInstallationWorker
.
perform_in
(
ClusterWaitForAppInstallationWorker
::
INTERVAL
,
app
.
name
,
app
.
id
)
end
end
def
finilize_installation
FinalizeInstallationService
.
new
(
app
).
execute
end
def
installation_phase
helm_api
.
installation_status
(
app
)
end
def
installation_errors
helm_api
.
installation_log
(
app
)
end
end
end
end
end
end
...
...
app/services/clusters/applications/fetch_installation_status_service.rb
deleted
100644 → 0
View file @
c46417c5
module
Clusters
module
Applications
class
FetchInstallationStatusService
<
BaseHelmService
def
execute
return
unless
app
.
installing?
phase
=
helm_api
.
installation_status
(
app
)
log
=
helm_api
.
installation_log
(
app
)
if
phase
==
'Failed'
yield
(
phase
,
log
)
if
block_given?
rescue
KubeException
=>
ke
app
.
make_errored!
(
"Kubernetes error:
#{
ke
.
message
}
"
)
unless
app
.
errored?
end
end
end
end
app/services/clusters/applications/install_service.rb
View file @
08752e5d
...
@@ -9,7 +9,7 @@ module Clusters
...
@@ -9,7 +9,7 @@ module Clusters
if
app
.
make_installing
if
app
.
make_installing
ClusterWaitForAppInstallationWorker
.
perform_in
(
ClusterWaitForAppInstallationWorker
.
perform_in
(
ClusterWaitForAppInstallationWorker
::
IN
ITIAL_IN
TERVAL
,
app
.
name
,
app
.
id
)
ClusterWaitForAppInstallationWorker
::
INTERVAL
,
app
.
name
,
app
.
id
)
else
else
app
.
make_errored!
(
"Failed to update app record;
#{
app
.
errors
}
"
)
app
.
make_errored!
(
"Failed to update app record;
#{
app
.
errors
}
"
)
end
end
...
...
app/workers/cluster_wait_for_app_installation_worker.rb
View file @
08752e5d
...
@@ -3,8 +3,7 @@ class ClusterWaitForAppInstallationWorker
...
@@ -3,8 +3,7 @@ class ClusterWaitForAppInstallationWorker
include
ClusterQueue
include
ClusterQueue
include
ClusterApplications
include
ClusterApplications
INITIAL_INTERVAL
=
30
.
seconds
INTERVAL
=
30
.
seconds
EAGER_INTERVAL
=
10
.
seconds
TIMEOUT
=
20
.
minutes
TIMEOUT
=
20
.
minutes
def
perform
(
app_name
,
app_id
)
def
perform
(
app_name
,
app_id
)
...
...
lib/gitlab/kubernetes/pod.rb
0 → 100644
View file @
08752e5d
module
Gitlab
module
Kubernetes
module
Pod
PENDING
=
'Pending'
.
freeze
RUNNING
=
'Running'
.
freeze
SUCCEEDED
=
'Succeeded'
.
freeze
FAILED
=
'Failed'
.
freeze
UNKNOWN
=
'Unknown'
.
freeze
PHASES
=
[
PENDING
,
RUNNING
,
SUCCEEDED
,
FAILED
,
UNKNONW
].
freeze
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