diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-11-06 10:41:27 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-11-06 10:41:27 +0100 |
commit | d8223468ae2ae061020cc26336c51dc93cc75571 (patch) | |
tree | 9855fdb31d017c1501703f46a8c3965cbf0ed180 /app/models/clusters | |
parent | 3a174c999dfb61f2dde53f6eb7b2baec8b5e3683 (diff) | |
download | gitlab-ce-d8223468ae2ae061020cc26336c51dc93cc75571.tar.gz |
Add ingress application
Diffstat (limited to 'app/models/clusters')
-rw-r--r-- | app/models/clusters/applications/ingress.rb | 32 | ||||
-rw-r--r-- | app/models/clusters/cluster.rb | 7 |
2 files changed, 37 insertions, 2 deletions
diff --git a/app/models/clusters/applications/ingress.rb b/app/models/clusters/applications/ingress.rb new file mode 100644 index 00000000000..0554cf84ed7 --- /dev/null +++ b/app/models/clusters/applications/ingress.rb @@ -0,0 +1,32 @@ +module Clusters + module Applications + class Ingress < ActiveRecord::Base + self.table_name = 'clusters_applications_ingress' + + include ::Clusters::Concerns::ApplicationStatus + + belongs_to :cluster, class_name: 'Clusters::Cluster', foreign_key: :cluster_id + + validates :cluster, presence: true + + default_value_for :ingress_type, :nginx + default_value_for :version, :nginx + + enum ingress_type: { + nginx: 1 + } + + def self.application_name + self.to_s.demodulize.underscore + end + + def name + self.class.application_name + end + + def chart + 'stable/nginx-ingress' + end + end + end +end diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb index 7d0be3d3739..cfed9c52860 100644 --- a/app/models/clusters/cluster.rb +++ b/app/models/clusters/cluster.rb @@ -5,7 +5,8 @@ module Clusters self.table_name = 'clusters' APPLICATIONS = { - Applications::Helm.application_name => Applications::Helm + Applications::Helm.application_name => Applications::Helm, + Applications::Ingress.application_name => Applications::Ingress }.freeze belongs_to :user @@ -20,6 +21,7 @@ module Clusters has_one :platform_kubernetes, class_name: 'Clusters::Platforms::Kubernetes', autosave: true, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent has_one :application_helm, class_name: 'Clusters::Applications::Helm' + has_one :application_ingress, class_name: 'Clusters::Applications::Ingress' accepts_nested_attributes_for :provider_gcp, update_only: true accepts_nested_attributes_for :platform_kubernetes, update_only: true @@ -59,7 +61,8 @@ module Clusters def applications [ - application_helm || build_application_helm + application_helm || build_application_helm, + application_ingress || build_application_ingress ] end |