class KubernetesApplication

Attributes

app_config[RW]
cluster_name[RW]
file_path[RW]
namespace[RW]

Public Class Methods

new(app_config: [], namespace:, cluster_name:, file_name:) click to toggle source
# File lib/orchparty/kubernetes_application.rb, line 272
def initialize(app_config: [], namespace:, cluster_name:, file_name:)
  self.file_path = Pathname.new(file_name).parent.expand_path
  self.cluster_name = cluster_name
  self.namespace = namespace
  self.app_config = app_config
end

Public Instance Methods

combine_charts(app_config) click to toggle source
# File lib/orchparty/kubernetes_application.rb, line 291
def combine_charts(app_config)
  services = app_config._service_order.map(&:to_s)
  app_config._service_order.each do |name|
    current_service = app_config[:services][name]
    if current_service._type == "chart"
      current_service._services.each do |n|
        services.delete n.to_s
      end
    end
  end
  services
end
each_service(method) click to toggle source
# File lib/orchparty/kubernetes_application.rb, line 304
def each_service(method)
  services = combine_charts(app_config)
  services.each do |name|
    service = app_config[:services][name]
    "::Orchparty::Services::#{service._type.classify}".constantize.new(cluster_name: cluster_name, namespace: namespace, file_path: file_path, app_config: app_config).send(method, service)
  end
end
install() click to toggle source
# File lib/orchparty/kubernetes_application.rb, line 279
def install
  each_service(:install)
end
print(method) click to toggle source
upgrade() click to toggle source
# File lib/orchparty/kubernetes_application.rb, line 283
def upgrade
  each_service(:upgrade)
end