Class: KubernetesApplication
- Inherits:
-
Object
- Object
- KubernetesApplication
- Defined in:
- lib/orchparty/kubernetes_application.rb
Instance Attribute Summary collapse
-
#app_config ⇒ Object
Returns the value of attribute app_config.
-
#cluster_name ⇒ Object
Returns the value of attribute cluster_name.
-
#file_path ⇒ Object
Returns the value of attribute file_path.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
Instance Method Summary collapse
- #combine_charts(app_config) ⇒ Object
- #each_service(method) ⇒ Object
-
#initialize(app_config: [], namespace:, cluster_name:, file_name:) ⇒ KubernetesApplication
constructor
A new instance of KubernetesApplication.
- #install ⇒ Object
- #print(method) ⇒ Object
- #upgrade ⇒ Object
Constructor Details
#initialize(app_config: [], namespace:, cluster_name:, file_name:) ⇒ KubernetesApplication
Returns a new instance of KubernetesApplication.
272 273 274 275 276 277 |
# 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. self.cluster_name = cluster_name self.namespace = namespace self.app_config = app_config end |
Instance Attribute Details
#app_config ⇒ Object
Returns the value of attribute app_config.
270 271 272 |
# File 'lib/orchparty/kubernetes_application.rb', line 270 def app_config @app_config end |
#cluster_name ⇒ Object
Returns the value of attribute cluster_name.
267 268 269 |
# File 'lib/orchparty/kubernetes_application.rb', line 267 def cluster_name @cluster_name end |
#file_path ⇒ Object
Returns the value of attribute file_path.
268 269 270 |
# File 'lib/orchparty/kubernetes_application.rb', line 268 def file_path @file_path end |
#namespace ⇒ Object
Returns the value of attribute namespace.
269 270 271 |
# File 'lib/orchparty/kubernetes_application.rb', line 269 def namespace @namespace end |
Instance Method Details
#combine_charts(app_config) ⇒ Object
291 292 293 294 295 296 297 298 299 300 301 302 |
# 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) ⇒ Object
304 305 306 307 308 309 310 |
# 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 ⇒ Object
279 280 281 |
# File 'lib/orchparty/kubernetes_application.rb', line 279 def install each_service(:install) end |
#print(method) ⇒ Object
287 288 289 |
# File 'lib/orchparty/kubernetes_application.rb', line 287 def print(method) each_service("print_#{method}".to_sym) end |
#upgrade ⇒ Object
283 284 285 |
# File 'lib/orchparty/kubernetes_application.rb', line 283 def upgrade each_service(:upgrade) end |