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
path: root/app
diff options
context:
space:
mode:
authorDylan Griffith <dyl.griffith@gmail.com>2018-02-20 05:49:35 +0300
committerDylan Griffith <dyl.griffith@gmail.com>2018-02-20 05:49:35 +0300
commit3d3d09fa9d0ea81f0e20037f64bd43b0cd1e5891 (patch)
tree37f859e6c9a857d7173a9a49aec6645fed89293e /app
parentba4114d25f538d198df2f681b9cb08567494207e (diff)
Schedule Ingress IP address fetch from K8s after clusters page load (#42643)
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects/clusters_controller.rb5
-rw-r--r--app/models/clusters/applications/ingress.rb8
-rw-r--r--app/models/clusters/concerns/application_core.rb5
3 files changed, 18 insertions, 0 deletions
diff --git a/app/controllers/projects/clusters_controller.rb b/app/controllers/projects/clusters_controller.rb
index 142e8b6e4bc..c351caeeb7b 100644
--- a/app/controllers/projects/clusters_controller.rb
+++ b/app/controllers/projects/clusters_controller.rb
@@ -4,6 +4,7 @@ class Projects::ClustersController < Projects::ApplicationController
before_action :authorize_create_cluster!, only: [:new]
before_action :authorize_update_cluster!, only: [:update]
before_action :authorize_admin_cluster!, only: [:destroy]
+ before_action :sync_application_details, only: [:status]
STATUS_POLLING_INTERVAL = 10_000
@@ -114,4 +115,8 @@ class Projects::ClustersController < Projects::ApplicationController
def authorize_admin_cluster!
access_denied! unless can?(current_user, :admin_cluster, cluster)
end
+
+ def sync_application_details
+ @cluster.applications.each(&:sync_details)
+ end
end
diff --git a/app/models/clusters/applications/ingress.rb b/app/models/clusters/applications/ingress.rb
index 418ce7d1504..e36fe9019c2 100644
--- a/app/models/clusters/applications/ingress.rb
+++ b/app/models/clusters/applications/ingress.rb
@@ -36,6 +36,14 @@ module Clusters
def install_command
Gitlab::Kubernetes::Helm::InstallCommand.new(name, chart: chart, chart_values_file: chart_values_file)
end
+
+ def sync_details
+ return unless installed?
+ return if external_ip
+
+ ClusterWaitForIngressIpAddressWorker.perform_in(
+ ClusterWaitForIngressIpAddressWorker::INTERVAL, name, id, IP_ADDRESS_FETCH_RETRIES)
+ end
end
end
end
diff --git a/app/models/clusters/concerns/application_core.rb b/app/models/clusters/concerns/application_core.rb
index a98fa85a5ff..44b0fca3d01 100644
--- a/app/models/clusters/concerns/application_core.rb
+++ b/app/models/clusters/concerns/application_core.rb
@@ -23,6 +23,11 @@ module Clusters
def name
self.class.application_name
end
+
+ def sync_details
+ # Override if you need extra data synchronized
+ # from K8s after installation
+ end
end
end
end