Class: EksCli::CloudFormation::EKS

Inherits:
Object
  • Object
show all
Defined in:
lib/eks_cli/cloudformation/eks.rb

Instance Method Summary collapse

Constructor Details

#initialize(cluster_name) ⇒ EKS

Returns a new instance of EKS.



11
12
13
# File 'lib/eks_cli/cloudformation/eks.rb', line 11

def initialize(cluster_name)
  @cluster_name = cluster_name
end

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/eks_cli/cloudformation/eks.rb', line 15

def create
  Log.info "creating EKS stack for #{@cluster_name}"
  s = Stack.create(@cluster_name, cf_config)
  Stack.await([s])
  s.reload
  Log.info "Outputs are:
    SecurityGroups: #{s.output("SecurityGroups")}
    VpcId: #{s.output("VpcId")}
    SubnetIds: #{s.output("SubnetIds")}
    EKSClusterARN: #{s.output("EKSClusterARN")}
    NodeGroupsInClusterSecurityGroup: #{s.output("NodeGroupsInClusterSecurityGroup")}
  "
  {control_plane_sg_id: s.output("SecurityGroups"),
   vpc_id: s.output("VpcId"),
   subnets: s.output("SubnetIds").split(","),
   nodes_sg_id: s.output("NodeGroupsInClusterSecurityGroup"),
   cluster_arn: s.output("EKSClusterARN")}
end

#deleteObject



34
35
36
# File 'lib/eks_cli/cloudformation/eks.rb', line 34

def delete
  Stack.new(@cluster_name, stack_name).delete
end