gitlab-org--gitlab-foss/app/models/clusters/applications/ingress.rb

56 lines
1.3 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-11-06 04:41:27 -05:00
module Clusters
module Applications
class Ingress < ActiveRecord::Base
VERSION = '0.23.0'.freeze
2017-11-06 04:41:27 -05:00
self.table_name = 'clusters_applications_ingress'
include ::Clusters::Concerns::ApplicationCore
2017-11-06 04:41:27 -05:00
include ::Clusters::Concerns::ApplicationStatus
include ::Clusters::Concerns::ApplicationVersion
include ::Clusters::Concerns::ApplicationData
include AfterCommitQueue
2017-11-06 04:41:27 -05:00
default_value_for :ingress_type, :nginx
default_value_for :version, VERSION
2017-11-06 04:41:27 -05:00
enum ingress_type: {
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
2017-11-06 04:41:27 -05:00
def chart
'stable/nginx-ingress'
end
2017-11-07 11:49:27 -05:00
def install_command
Gitlab::Kubernetes::Helm::InstallCommand.new(
name,
version: VERSION,
chart: chart,
values: values
)
2017-11-07 11:49:27 -05:00
end
def schedule_status_update
return unless installed?
return if external_ip
ClusterWaitForIngressIpAddressWorker.perform_async(name, id)
end
2017-11-06 04:41:27 -05:00
end
end
end