helm.rb 705 Bytes
Newer Older
1
module Clusters
2 3 4 5
  module Applications
    class Helm < ActiveRecord::Base
      self.table_name = 'clusters_applications_helm'

6
      include ::Clusters::Concerns::ApplicationStatus
7

8
      belongs_to :cluster, class_name: 'Clusters::Cluster', foreign_key: :cluster_id
9

Alessio Caiazza's avatar
Alessio Caiazza committed
10
      default_value_for :version, Gitlab::Kubernetes::Helm::HELM_VERSION
11

12 13
      validates :cluster, presence: true

14 15
      after_initialize :set_initial_status
      
16 17 18 19
      def self.application_name
        self.to_s.demodulize.underscore
      end

20
      def set_initial_status
21
        self.status = 0 unless cluster&.platform_kubernetes_active?
22 23
      end

24
      def name
25
        self.class.application_name
26 27 28 29
      end
    end
  end
end