diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-07 03:07:49 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-07 03:07:49 +0000 |
commit | a31408ba64f61275813cc3ffd5aa9bc9ce9f3319 (patch) | |
tree | 711e3c6f7ea239e0aedc28a815d7067280399314 /app/services/clusters | |
parent | 175f124d93ba52aeb850b5c032930168612d1e71 (diff) | |
download | gitlab-ce-a31408ba64f61275813cc3ffd5aa9bc9ce9f3319.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/clusters')
-rw-r--r-- | app/services/clusters/applications/check_upgrade_progress_service.rb | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/app/services/clusters/applications/check_upgrade_progress_service.rb b/app/services/clusters/applications/check_upgrade_progress_service.rb deleted file mode 100644 index c4fd234b302..00000000000 --- a/app/services/clusters/applications/check_upgrade_progress_service.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -module Clusters - module Applications - class CheckUpgradeProgressService < BaseHelmService - def execute - return unless app.updating? - - case phase - when ::Gitlab::Kubernetes::Pod::SUCCEEDED - on_success - when ::Gitlab::Kubernetes::Pod::FAILED - on_failed - else - check_timeout - end - rescue ::Kubeclient::HttpError => e - app.make_update_errored!("Kubernetes error: #{e.message}") unless app.update_errored? - end - - private - - def on_success - app.make_installed! - ensure - remove_pod - end - - def on_failed - app.make_update_errored!(errors || 'Update silently failed') - ensure - remove_pod - end - - def check_timeout - if timed_out? - begin - app.make_update_errored!('Update timed out') - ensure - remove_pod - end - else - ::ClusterWaitForAppUpdateWorker.perform_in( - ::ClusterWaitForAppUpdateWorker::INTERVAL, app.name, app.id) - end - end - - def timed_out? - Time.current.utc - app.updated_at.to_time.utc > ::ClusterWaitForAppUpdateWorker::TIMEOUT - end - - def remove_pod - helm_api.delete_pod!(pod_name) - rescue StandardError - # no-op - end - - def phase - helm_api.status(pod_name) - end - - def errors - helm_api.log(pod_name) - end - - def pod_name - @pod_name ||= patch_command.pod_name - end - end - end -end |