diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-03-01 17:38:04 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-03-01 17:38:04 +0000 |
commit | ccb080d94aa765d8391f262e25c5ead0764dc2ff (patch) | |
tree | 643e50759d3d92617606850ac987507c0ed59774 /app/models | |
parent | 52e133d17627396f29c1875b972534eaba4a837e (diff) | |
parent | ebac9c81ad1e859afe73482dd6f112b141cf9ede (diff) | |
download | gitlab-ce-ccb080d94aa765d8391f262e25c5ead0764dc2ff.tar.gz |
Merge branch '42643-persist-external-ip-of-ingress-controller-gke' into 'master'
Display ingress IP address in the Kubernetes page
See merge request gitlab-org/gitlab-ce!17052
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/clusters/applications/ingress.rb | 19 | ||||
-rw-r--r-- | app/models/clusters/concerns/application_core.rb | 5 |
2 files changed, 24 insertions, 0 deletions
diff --git a/app/models/clusters/applications/ingress.rb b/app/models/clusters/applications/ingress.rb index aa5cf97756f..9f583342c19 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 @@ -13,6 +14,17 @@ module Clusters nginx: 1 } + FETCH_IP_ADDRESS_DELAY = 30.seconds + + state_machine :status do + before_transition any => [:installed] do |application| + application.run_after_commit do + ClusterWaitForIngressIpAddressWorker.perform_in( + FETCH_IP_ADDRESS_DELAY, application.name, application.id) + end + end + end + def chart 'stable/nginx-ingress' end @@ -24,6 +36,13 @@ module Clusters def install_command Gitlab::Kubernetes::Helm::InstallCommand.new(name, chart: chart, chart_values_file: chart_values_file) end + + def schedule_status_update + return unless installed? + return if external_ip + + ClusterWaitForIngressIpAddressWorker.perform_async(name, id) + end end end end diff --git a/app/models/clusters/concerns/application_core.rb b/app/models/clusters/concerns/application_core.rb index a98fa85a5ff..623b836c0ed 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 schedule_status_update + # Override if you need extra data synchronized + # from K8s after installation + end end end end |