Class: Dapp::Deployment::Config::Directive::Expose

Inherits:
Base show all
Defined in:
lib/dapp/deployment/config/directive/expose.rb

Defined Under Namespace

Classes: Port

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#hostname_pattern

Methods inherited from Config::Directive::Base

#clone, #encode_with

Constructor Details

#initialize(dapp:) ⇒ Expose

Returns a new instance of Expose.



9
10
11
12
13
# File 'lib/dapp/deployment/config/directive/expose.rb', line 9

def initialize(dapp:)
  @_port = []
  @_type = 'ClusterIP'
  super
end

Instance Attribute Details

#_portObject (readonly)

Returns the value of attribute _port.



6
7
8
# File 'lib/dapp/deployment/config/directive/expose.rb', line 6

def _port
  @_port
end

#_typeObject (readonly)

Returns the value of attribute _type.



7
8
9
# File 'lib/dapp/deployment/config/directive/expose.rb', line 7

def _type
  @_type
end

Instance Method Details

#cluster_ipObject



15
16
17
# File 'lib/dapp/deployment/config/directive/expose.rb', line 15

def cluster_ip
  sub_directive_eval { @_type = 'ClusterIP' }
end

#load_balancerObject



19
20
21
# File 'lib/dapp/deployment/config/directive/expose.rb', line 19

def load_balancer
  sub_directive_eval { @_type = 'LoadBalancer' }
end

#node_portObject



23
24
25
# File 'lib/dapp/deployment/config/directive/expose.rb', line 23

def node_port
  sub_directive_eval { @_type = 'NodePort' }
end

#port(number, &blk) ⇒ Object



27
28
29
# File 'lib/dapp/deployment/config/directive/expose.rb', line 27

def port(number, &blk)
  sub_directive_eval { @_port << Port.new(number, dapp: dapp, &blk) }
end