diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-07 21:09:59 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-07 21:09:59 +0000 |
commit | 364e69bafd235e5689fba44bb5eef37305cb6c6d (patch) | |
tree | 563bb6addd54e5ba4c93eaf1dee54eaab60f7a68 /app/services/clusters | |
parent | 59f37a99433dbdc3093e06f0f57beff171bae5d4 (diff) | |
download | gitlab-ce-364e69bafd235e5689fba44bb5eef37305cb6c6d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/clusters')
-rw-r--r-- | app/services/clusters/applications/check_ingress_ip_address_service.rb | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/app/services/clusters/applications/check_ingress_ip_address_service.rb b/app/services/clusters/applications/check_ingress_ip_address_service.rb deleted file mode 100644 index e254a0358a0..00000000000 --- a/app/services/clusters/applications/check_ingress_ip_address_service.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -module Clusters - module Applications - class CheckIngressIpAddressService < BaseHelmService - include Gitlab::Utils::StrongMemoize - - Error = Class.new(StandardError) - - LEASE_TIMEOUT = 15.seconds.to_i - - def execute - return if app.external_ip - return if app.external_hostname - return unless try_obtain_lease - - app.external_ip = ingress_ip if ingress_ip - app.external_hostname = ingress_hostname if ingress_hostname - - app.save! if app.changed? - end - - private - - def try_obtain_lease - Gitlab::ExclusiveLease - .new("check_ingress_ip_address_service:#{app.id}", timeout: LEASE_TIMEOUT) - .try_obtain - end - - def ingress_ip - ingress_service&.ip - end - - def ingress_hostname - ingress_service&.hostname - end - - def ingress_service - strong_memoize(:ingress_service) do - app.ingress_service.status.loadBalancer.ingress&.first - end - end - end - end -end |