Sha256: be50623d8d7b53259e861cb48a1271f3f7beabef700fac5843c74803bb345352

Contents?: true

Size: 679 Bytes

Versions: 1

Compression:

Stored size: 679 Bytes

Contents

module Kubec
  class Kubernetes
    # :nodoc:
    class Container < Hash
      include HasAttribute

      attribute :image
      attribute :name
      attribute :ports

      def initialize(name, &block)
        self[:name] = name
        instance_eval(&block)
      end

      # TODO: Add object to check fields
      def port(container_port, host_port = nil,
               ip: nil, name: nil, protocol: nil)
        self[:ports] ||= []
        port = {
          containerPort: container_port,
          hostPort: host_port,
          hostIP: ip,
          name: name,
          protocol: protocol
        }.compact
        self[:ports].push port
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kubec-0.2.0 lib/kubec/kubernetes/container.rb