Class: EksCli::NodeGroup
- Inherits:
-
Object
- Object
- EksCli::NodeGroup
- Defined in:
- lib/eks_cli/nodegroup.rb
Constant Summary collapse
- T =
{cluster_name: "ClusterName", control_plane_sg_id: "ClusterControlPlaneSecurityGroup", nodes_sg_id: "ClusterSecurityGroup", min: "NodeAutoScalingGroupMinSize", max: "NodeAutoScalingGroupMaxSize", instance_type: "NodeInstanceType", ami: "NodeImageId", volume_size: "NodeVolumeSize", ssh_key_name: "KeyName", vpc_id: "VpcId", subnets: "Subnets", group_name: "NodeGroupName", bootstrap_args: "BootstrapArguments"}
- CAPABILITIES =
["CAPABILITY_IAM"]
Instance Method Summary collapse
- #create(wait_for_completion: true) ⇒ Object
- #delete ⇒ Object
- #detach_iam_policies ⇒ Object
-
#initialize(cluster_name, name) ⇒ NodeGroup
constructor
A new instance of NodeGroup.
- #tags ⇒ Object
Constructor Details
#initialize(cluster_name, name) ⇒ NodeGroup
Returns a new instance of NodeGroup.
27 28 29 30 |
# File 'lib/eks_cli/nodegroup.rb', line 27 def initialize(cluster_name, name) @cluster_name = cluster_name @group = Config[cluster_name].for_group(name) end |
Instance Method Details
#create(wait_for_completion: true) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/eks_cli/nodegroup.rb', line 32 def create(wait_for_completion: true) Log.info "creating stack for nodegroup #{@group["group_name"]}" stack = CloudFormation::Stack.create(@cluster_name, cloudformation_config) Log.info "stack created - #{@group["group_name"]} - #{stack.id}" if wait_for_completion await(stack) end stack end |
#delete ⇒ Object
51 52 53 54 |
# File 'lib/eks_cli/nodegroup.rb', line 51 def delete detach_iam_policies cf_stack.delete end |
#detach_iam_policies ⇒ Object
47 48 49 |
# File 'lib/eks_cli/nodegroup.rb', line 47 def detach_iam_policies IAM::Client.new(@cluster_name).detach_node_policies(cf_stack.node_instance_role_name) end |
#tags ⇒ Object
42 43 44 45 |
# File 'lib/eks_cli/nodegroup.rb', line 42 def [{key: "eks-nodegroup", value: @group["group_name"]}, {key: "eks-cluster", value: @cluster_name}] end |