diff options
author | Thong Kuah <tkuah@gitlab.com> | 2019-04-15 07:02:52 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-04-30 08:55:12 +0300 |
commit | 024ddcab17517befafc0c5163d66cdcaae1b69e6 (patch) | |
tree | 49745142971ae8e930a358ca2eb3318021ee440f /app | |
parent | eae0fc2bcd6f7e2e183a922321ace3380c329adc (diff) |
Deactivate any prometheus_service upon destroy
Basically does the reverse of after_transition to :installed.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/clusters/applications/prometheus.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb index 1a8543f378e..1a715830953 100644 --- a/app/models/clusters/applications/prometheus.rb +++ b/app/models/clusters/applications/prometheus.rb @@ -16,6 +16,8 @@ module Clusters default_value_for :version, VERSION + after_destroy :disable_prometheus_integration + state_machine :status do after_transition any => [:installed] do |application| application.cluster.projects.each do |project| @@ -90,6 +92,12 @@ module Clusters private + def disable_prometheus_integration + cluster.projects.each do |project| + project.prometheus_service&.update(active: false) + end + end + def kube_client cluster&.kubeclient&.core_client end |