From ba4114d25f538d198df2f681b9cb08567494207e Mon Sep 17 00:00:00 2001 From: Dylan Griffith Date: Tue, 20 Feb 2018 12:42:05 +1100 Subject: Refactor ingress IP address waiting code (#42643) --- app/models/clusters/applications/ingress.rb | 15 ++++++++++----- app/models/clusters/concerns/application_core.rb | 4 ---- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'app/models/clusters') diff --git a/app/models/clusters/applications/ingress.rb b/app/models/clusters/applications/ingress.rb index 5e9086aecca..418ce7d1504 100644 --- a/app/models/clusters/applications/ingress.rb +++ b/app/models/clusters/applications/ingress.rb @@ -5,6 +5,7 @@ module Clusters include ::Clusters::Concerns::ApplicationCore include ::Clusters::Concerns::ApplicationStatus + include AfterCommitQueue default_value_for :ingress_type, :nginx default_value_for :version, :nginx @@ -15,6 +16,15 @@ module Clusters IP_ADDRESS_FETCH_RETRIES = 3 + state_machine :status do + before_transition any => [:installed] do |application| + application.run_after_commit do + ClusterWaitForIngressIpAddressWorker.perform_in( + ClusterWaitForIngressIpAddressWorker::INTERVAL, application.name, application.id, IP_ADDRESS_FETCH_RETRIES) + end + end + end + def chart 'stable/nginx-ingress' end @@ -26,11 +36,6 @@ module Clusters def install_command Gitlab::Kubernetes::Helm::InstallCommand.new(name, chart: chart, chart_values_file: chart_values_file) end - - def post_install - 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 b047fbce214..a98fa85a5ff 100644 --- a/app/models/clusters/concerns/application_core.rb +++ b/app/models/clusters/concerns/application_core.rb @@ -23,10 +23,6 @@ module Clusters def name self.class.application_name end - - def post_install - # Override for any extra work that needs to be done after install - end end end end -- cgit v1.2.3