Sha256: 4caaa3167792ecf3b3f5997224583573eaeb6cb40adbd9b8340f416030f17238

Contents?: true

Size: 814 Bytes

Versions: 8

Compression:

Stored size: 814 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,
      deploy_strategy:  service_attrs.deploy_strategy,
    )
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kuber_kit-0.3.1 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.3.0 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.2.9 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.2.8 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.2.7 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.2.6 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.2.5 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.2.4 lib/kuber_kit/core/service_factory.rb