Sha256: 3c57d1ba71883e8b7a5929a5cd7f4d59c4100e32d1c7c49feee13a2d6289687b

Contents?: true

Size: 828 Bytes

Versions: 7

Compression:

Stored size: 828 Bytes

Contents

class KuberKit::Core::ServiceFactory
  AttributeNotSetError = Class.new(KuberKit::Error)

  def create(definition)
    service_attrs = definition.to_service_attrs

    if service_attrs.template_name.nil?
      raise AttributeNotSetError, "Please set template for service using #template method"
    end

    configuration_attributes = KuberKit.current_configuration.service_attributes(service_attrs.name)
    attributes = (service_attrs.attributes || {}).merge(configuration_attributes)

    KuberKit::Core::Service.new(
      name:               service_attrs.name,
      template_name:      service_attrs.template_name,
      tags:               service_attrs.tags,
      images:             service_attrs.images,
      attributes:         attributes,
      deployer_strategy:  service_attrs.deployer_strategy,
    )
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kuber_kit-0.3.8 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.3.7 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.3.6 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.3.5 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.3.4 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.3.3 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.3.2 lib/kuber_kit/core/service_factory.rb