Skip to content
Snippets Groups Projects
Commit 4d0a700d authored by Kamil Trzcińśki's avatar Kamil Trzcińśki
Browse files

Expose applications as array via API

parent 94d5f568
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -5,7 +5,7 @@ module Clusters
 
NAME = 'helm'.freeze
 
include ::Clusters::Concerns::AppStatus
include ::Clusters::Concerns::ApplicationStatus
 
belongs_to :cluster, class_name: 'Clusters::Cluster', foreign_key: :cluster_id
 
Loading
Loading
Loading
Loading
@@ -51,6 +51,12 @@ module Clusters
end
end
 
def applications
[
application_helm || build_application_helm
]
end
def provider
return provider_gcp if gcp?
end
Loading
Loading
module Clusters
module Concerns
module AppStatus
module ApplicationStatus
extend ActiveSupport::Concern
 
included do
state_machine :status, initial: :scheduled do
state_machine :status, initial: :installable do
state :errored, value: -1
state :scheduled, value: 0
state :installing, value: 1
state :installed, value: 2
state :installable, value: 0
state :scheduled, value: 1
state :installing, value: 2
state :installed, value: 3
 
event :make_installing do
transition any - [:installing] => :installing
Loading
Loading
Loading
Loading
@@ -5,11 +5,5 @@ module Clusters
def gke_cluster_url
"https://console.cloud.google.com/kubernetes/clusters/details/#{provider.zone}/#{name}" if gcp?
end
def applications
Clusters::Cluster::APPLICATIONS.map do |key, value|
value.find_by(cluster_id: id)
end.compact
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment