Welcome to mirror list, hosted at ThFree Co, Russian Federation.

helm.rb « applications « clusters « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c7949d11ef8a20d33a00e432d5174cbb51c6d84d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
module Clusters
  module Applications
    class Helm < ActiveRecord::Base
      self.table_name = 'clusters_applications_helm'

      include ::Clusters::Concerns::ApplicationStatus

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

      default_value_for :version, Gitlab::Kubernetes::Helm::HELM_VERSION

      validates :cluster, presence: true

      after_initialize :set_initial_status

      def self.application_name
        self.to_s.demodulize.underscore
      end

      def set_initial_status
        return unless not_installable?

        self.status = 'installable' if cluster&.platform_kubernetes_active?
      end

      def name
        self.class.application_name
      end

      def install_command
        Gitlab::Kubernetes::Helm::InstallCommand.new(name, true)
      end
    end
  end
end