Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-11-02 17:10:46 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2017-11-02 17:10:46 +0300
commit64be8d70ae20928df351e495a3442bb6036bc3e7 (patch)
tree6eb01452391ccfa45d1dbaeae261d118d323bcc1 /app/services
parent461c385ebca7ecb52d0b385fd61c856eb395481a (diff)
Improve backend structure of data
Diffstat (limited to 'app/services')
-rw-r--r--app/services/clusters/base_helm_service.rb12
-rw-r--r--app/services/clusters/fetch_app_installation_status_service.rb4
-rw-r--r--app/services/clusters/finalize_app_installation_service.rb2
-rw-r--r--app/services/clusters/install_app_service.rb4
4 files changed, 14 insertions, 8 deletions
diff --git a/app/services/clusters/base_helm_service.rb b/app/services/clusters/base_helm_service.rb
index b8ed52bf376..c7f7e2d0877 100644
--- a/app/services/clusters/base_helm_service.rb
+++ b/app/services/clusters/base_helm_service.rb
@@ -8,10 +8,16 @@ module Clusters
protected
- def helm
- return @helm if defined?(@helm)
+ def cluster
+ app.cluster
+ end
+
+ def kubeclient
+ cluster.kubeclient
+ end
- @helm = @app.cluster.helm
+ def helm_api
+ @helm ||= Gitlab::Clusters::Helm.new(kubeclient)
end
end
end
diff --git a/app/services/clusters/fetch_app_installation_status_service.rb b/app/services/clusters/fetch_app_installation_status_service.rb
index e21aa49bb43..9b281c77c49 100644
--- a/app/services/clusters/fetch_app_installation_status_service.rb
+++ b/app/services/clusters/fetch_app_installation_status_service.rb
@@ -3,8 +3,8 @@ module Clusters
def execute
return unless app.installing?
- phase = helm.installation_status(app)
- log = helm.installation_log(app) if phase == 'Failed'
+ 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?
diff --git a/app/services/clusters/finalize_app_installation_service.rb b/app/services/clusters/finalize_app_installation_service.rb
index c921747febc..b9d5da063eb 100644
--- a/app/services/clusters/finalize_app_installation_service.rb
+++ b/app/services/clusters/finalize_app_installation_service.rb
@@ -1,7 +1,7 @@
module Clusters
class FinalizeAppInstallationService < BaseHelmService
def execute
- helm.delete_installation_pod!(app)
+ helm_api.delete_installation_pod!(app)
app.make_errored!('Installation aborted') if aborted?
end
diff --git a/app/services/clusters/install_app_service.rb b/app/services/clusters/install_app_service.rb
index dd8556108d4..496af2495fd 100644
--- a/app/services/clusters/install_app_service.rb
+++ b/app/services/clusters/install_app_service.rb
@@ -4,14 +4,14 @@ module Clusters
return unless app.scheduled?
begin
- helm.install(app)
+ helm_api.install(app)
+
if app.make_installing
ClusterWaitForAppInstallationWorker.perform_in(
ClusterWaitForAppInstallationWorker::INITIAL_INTERVAL, app.name, app.id)
else
app.make_errored!("Failed to update app record; #{app.errors}")
end
-
rescue KubeException => ke
app.make_errored!("Kubernetes error: #{ke.message}")
rescue StandardError => e