diff options
author | Thong Kuah <tkuah@gitlab.com> | 2018-12-19 21:50:12 +1300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2019-01-15 10:03:08 +1300 |
commit | 8296ff580c2bb1b2a9ee07193f79f66fd6444de0 (patch) | |
tree | c101388d589cee84b116974e47046c0f90ebe6d6 /app/models/clusters/applications/prometheus.rb | |
parent | 4a6c7661edae664a7f6366201d017e24d8f42026 (diff) | |
download | gitlab-ce-8296ff580c2bb1b2a9ee07193f79f66fd6444de0.tar.gz |
Port generic upgrade functionality to CE55544-port-upgrade-command
Port from EE generic upgrade related functionality used to upgrade Helm
applications
Remove memoization which could be incorrect
It looks like we are memoizing without regard to the method's argument
so this could result in an incorrect upgrade_command
Remove `const_get` indirection now we are no longer in EE
Diffstat (limited to 'app/models/clusters/applications/prometheus.rb')
-rw-r--r-- | app/models/clusters/applications/prometheus.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb index e25be522d68..7a97760536a 100644 --- a/app/models/clusters/applications/prometheus.rb +++ b/app/models/clusters/applications/prometheus.rb @@ -25,13 +25,21 @@ module Clusters end def ready_status - [:installed] + [:installed, :updating, :updated, :update_errored] end def ready? ready_status.include?(status_name) end + def update_in_progress? + status_name == :updating + end + + def update_errored? + status_name == :update_errored + end + def chart 'stable/prometheus' end @@ -55,6 +63,24 @@ module Clusters ) end + def upgrade_command(values) + ::Gitlab::Kubernetes::Helm::UpgradeCommand.new( + name, + version: VERSION, + chart: chart, + rbac: cluster.platform_kubernetes_rbac?, + files: files_with_replaced_values(values) + ) + end + + # Returns a copy of files where the values of 'values.yaml' + # are replaced by the argument. + # + # See #values for the data format required + def files_with_replaced_values(replaced_values) + files.merge('values.yaml': replaced_values) + end + def prometheus_client return unless kube_client |