2017-11-02 10:14:10 +00:00
|
|
|
module Clusters
|
2017-11-02 14:10:46 +00:00
|
|
|
module Applications
|
|
|
|
class Helm < ActiveRecord::Base
|
|
|
|
self.table_name = 'clusters_applications_helm'
|
|
|
|
|
2017-11-02 16:57:50 +00:00
|
|
|
include ::Clusters::Concerns::ApplicationStatus
|
2017-11-02 10:14:10 +00:00
|
|
|
|
2017-11-02 14:31:25 +00:00
|
|
|
belongs_to :cluster, class_name: 'Clusters::Cluster', foreign_key: :cluster_id
|
2017-11-02 10:14:10 +00:00
|
|
|
|
2017-11-02 15:57:18 +00:00
|
|
|
default_value_for :version, Gitlab::Kubernetes::Helm::HELM_VERSION
|
2017-11-02 10:14:10 +00:00
|
|
|
|
2017-11-03 10:10:50 +00:00
|
|
|
validates :cluster, presence: true
|
|
|
|
|
2017-11-03 18:20:29 +00:00
|
|
|
def self.application_name
|
|
|
|
self.to_s.demodulize.underscore
|
|
|
|
end
|
|
|
|
|
2017-11-07 12:50:04 +00:00
|
|
|
def initial_status
|
|
|
|
if cluster&.platform_kubernetes_active?
|
|
|
|
:installable
|
|
|
|
else
|
|
|
|
:not_installable
|
|
|
|
end
|
2017-11-06 14:48:44 +00:00
|
|
|
end
|
|
|
|
|
2017-11-02 10:14:10 +00:00
|
|
|
def name
|
2017-11-03 18:20:29 +00:00
|
|
|
self.class.application_name
|
2017-11-02 10:14:10 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|