Class: AWSCDK::EKSv2::NodegroupOptions

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ek_sv2/nodegroup_options.rb

Overview

The Nodegroup Options for addNodeGroup() method.

Direct Known Subclasses

NodegroupProps

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ami_type: nil, capacity_type: nil, desired_size: nil, disk_size: nil, enable_node_auto_repair: nil, force_update: nil, instance_types: nil, labels: nil, launch_template_spec: nil, max_size: nil, max_unavailable: nil, max_unavailable_percentage: nil, min_size: nil, nodegroup_name: nil, node_role: nil, release_version: nil, remote_access: nil, removal_policy: nil, subnets: nil, tags: nil, taints: nil) ⇒ NodegroupOptions

Returns a new instance of NodegroupOptions.

Parameters:

  • ami_type (AWSCDK::EKSv2::NodegroupAmiType, nil) (defaults to: nil)

    The AMI type for your node group.

  • capacity_type (AWSCDK::EKSv2::CapacityType, nil) (defaults to: nil)

    The capacity type of the nodegroup.

  • desired_size (Numeric, nil) (defaults to: nil)

    The current number of worker nodes that the managed node group should maintain.

  • disk_size (Numeric, nil) (defaults to: nil)

    The root device disk size (in GiB) for your node group instances.

  • enable_node_auto_repair (Boolean, nil) (defaults to: nil)

    Specifies whether to enable node auto repair for the node group.

  • force_update (Boolean, nil) (defaults to: nil)

    Force the update if the existing node group's pods are unable to be drained due to a pod disruption budget issue.

  • instance_types (Array<AWSCDK::EC2::InstanceType>, nil) (defaults to: nil)

    The instance types to use for your node group.

  • labels (Hash{String => String}, nil) (defaults to: nil)

    The Kubernetes labels to be applied to the nodes in the node group when they are created.

  • launch_template_spec (AWSCDK::EKSv2::LaunchTemplateSpec, nil) (defaults to: nil)

    Launch template specification used for the nodegroup.

  • max_size (Numeric, nil) (defaults to: nil)

    The maximum number of worker nodes that the managed node group can scale out to.

  • max_unavailable (Numeric, nil) (defaults to: nil)

    The maximum number of nodes unavailable at once during a version update.

  • max_unavailable_percentage (Numeric, nil) (defaults to: nil)

    The maximum percentage of nodes unavailable during a version update.

  • min_size (Numeric, nil) (defaults to: nil)

    The minimum number of worker nodes that the managed node group can scale in to.

  • nodegroup_name (String, nil) (defaults to: nil)

    Name of the Nodegroup.

  • node_role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    The IAM role to associate with your node group.

  • release_version (String, nil) (defaults to: nil)

    The AMI version of the Amazon EKS-optimized AMI to use with your node group (for example, 1.14.7-YYYYMMDD).

  • remote_access (AWSCDK::EKSv2::NodegroupRemoteAccess, nil) (defaults to: nil)

    The remote access (SSH) configuration to use with your node group.

  • removal_policy (AWSCDK::RemovalPolicy, nil) (defaults to: nil)

    The removal policy applied to the managed node group resources.

  • subnets (AWSCDK::EC2::SubnetSelection, nil) (defaults to: nil)

    The subnets to use for the Auto Scaling group that is created for your node group.

  • tags (Hash{String => String}, nil) (defaults to: nil)

    The metadata to apply to the node group to assist with categorization and organization.

  • taints (Array<AWSCDK::EKSv2::TaintSpec>, nil) (defaults to: nil)

    The Kubernetes taints to be applied to the nodes in the node group when they are created.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'ek_sv2/nodegroup_options.rb', line 28

def initialize(ami_type: nil, capacity_type: nil, desired_size: nil, disk_size: nil, enable_node_auto_repair: nil, force_update: nil, instance_types: nil, labels: nil, launch_template_spec: nil, max_size: nil, max_unavailable: nil, max_unavailable_percentage: nil, min_size: nil, nodegroup_name: nil, node_role: nil, release_version: nil, remote_access: nil, removal_policy: nil, subnets: nil, tags: nil, taints: nil)
  @ami_type = ami_type
  Jsii::Type.check_type(@ami_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLk5vZGVncm91cEFtaVR5cGUifQ==")), "amiType") unless @ami_type.nil?
  @capacity_type = capacity_type
  Jsii::Type.check_type(@capacity_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLkNhcGFjaXR5VHlwZSJ9")), "capacityType") unless @capacity_type.nil?
  @desired_size = desired_size
  Jsii::Type.check_type(@desired_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "desiredSize") unless @desired_size.nil?
  @disk_size = disk_size
  Jsii::Type.check_type(@disk_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "diskSize") unless @disk_size.nil?
  @enable_node_auto_repair = enable_node_auto_repair
  Jsii::Type.check_type(@enable_node_auto_repair, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableNodeAutoRepair") unless @enable_node_auto_repair.nil?
  @force_update = force_update
  Jsii::Type.check_type(@force_update, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "forceUpdate") unless @force_update.nil?
  @instance_types = instance_types
  Jsii::Type.check_type(@instance_types, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSW5zdGFuY2VUeXBlIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "instanceTypes") unless @instance_types.nil?
  @labels = labels
  Jsii::Type.check_type(@labels, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "labels") unless @labels.nil?
  @launch_template_spec = launch_template_spec.is_a?(Hash) ? ::AWSCDK::EKSv2::LaunchTemplateSpec.new(**launch_template_spec.transform_keys(&:to_sym)) : launch_template_spec
  Jsii::Type.check_type(@launch_template_spec, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLkxhdW5jaFRlbXBsYXRlU3BlYyJ9")), "launchTemplateSpec") unless @launch_template_spec.nil?
  @max_size = max_size
  Jsii::Type.check_type(@max_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxSize") unless @max_size.nil?
  @max_unavailable = max_unavailable
  Jsii::Type.check_type(@max_unavailable, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxUnavailable") unless @max_unavailable.nil?
  @max_unavailable_percentage = max_unavailable_percentage
  Jsii::Type.check_type(@max_unavailable_percentage, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxUnavailablePercentage") unless @max_unavailable_percentage.nil?
  @min_size = min_size
  Jsii::Type.check_type(@min_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minSize") unless @min_size.nil?
  @nodegroup_name = nodegroup_name
  Jsii::Type.check_type(@nodegroup_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nodegroupName") unless @nodegroup_name.nil?
  @node_role = node_role
  Jsii::Type.check_type(@node_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "nodeRole") unless @node_role.nil?
  @release_version = release_version
  Jsii::Type.check_type(@release_version, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "releaseVersion") unless @release_version.nil?
  @remote_access = remote_access.is_a?(Hash) ? ::AWSCDK::EKSv2::NodegroupRemoteAccess.new(**remote_access.transform_keys(&:to_sym)) : remote_access
  Jsii::Type.check_type(@remote_access, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLk5vZGVncm91cFJlbW90ZUFjY2VzcyJ9")), "remoteAccess") unless @remote_access.nil?
  @removal_policy = removal_policy
  Jsii::Type.check_type(@removal_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "removalPolicy") unless @removal_policy.nil?
  @subnets = subnets.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**subnets.transform_keys(&:to_sym)) : subnets
  Jsii::Type.check_type(@subnets, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "subnets") unless @subnets.nil?
  @tags = tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "tags") unless @tags.nil?
  @taints = taints.is_a?(Array) ? taints.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::EKSv2::TaintSpec.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : taints
  Jsii::Type.check_type(@taints, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19la3NfdjIuVGFpbnRTcGVjIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "taints") unless @taints.nil?
end

Instance Attribute Details

#ami_typeAWSCDK::EKSv2::NodegroupAmiType? (readonly)

Note:

Default: - auto-determined from the instanceTypes property when launchTemplateSpec property is not specified

The AMI type for your node group.

If you explicitly specify the launchTemplate with custom AMI, do not specify this property, or the node group deployment will fail. In other cases, you will need to specify correct amiType for the nodegroup.



80
81
82
# File 'ek_sv2/nodegroup_options.rb', line 80

def ami_type
  @ami_type
end

#capacity_typeAWSCDK::EKSv2::CapacityType? (readonly)

Note:

Default: CapacityType.ON_DEMAND

The capacity type of the nodegroup.

Returns:



85
86
87
# File 'ek_sv2/nodegroup_options.rb', line 85

def capacity_type
  @capacity_type
end

#desired_sizeNumeric? (readonly)

Note:

Default: 2

The current number of worker nodes that the managed node group should maintain.

If not specified, the nodewgroup will initially create min_size instances.

Returns:

  • (Numeric, nil)


93
94
95
# File 'ek_sv2/nodegroup_options.rb', line 93

def desired_size
  @desired_size
end

#disk_sizeNumeric? (readonly)

Note:

Default: 20

The root device disk size (in GiB) for your node group instances.

Returns:

  • (Numeric, nil)


98
99
100
# File 'ek_sv2/nodegroup_options.rb', line 98

def disk_size
  @disk_size
end

#enable_node_auto_repairBoolean? (readonly)

Note:

Default: false

Specifies whether to enable node auto repair for the node group.

Node auto repair is disabled by default.



106
107
108
# File 'ek_sv2/nodegroup_options.rb', line 106

def enable_node_auto_repair
  @enable_node_auto_repair
end

#force_updateBoolean? (readonly)

Note:

Default: true

Force the update if the existing node group's pods are unable to be drained due to a pod disruption budget issue.

If an update fails because pods could not be drained, you can force the update after it fails to terminate the old node whether or not any pods are running on the node.

Returns:

  • (Boolean, nil)


115
116
117
# File 'ek_sv2/nodegroup_options.rb', line 115

def force_update
  @force_update
end

#instance_typesArray<AWSCDK::EC2::InstanceType>? (readonly)

Note:

Default: t3.medium will be used according to the cloudformation document.

The instance types to use for your node group.



121
122
123
# File 'ek_sv2/nodegroup_options.rb', line 121

def instance_types
  @instance_types
end

#labelsHash{String => String}? (readonly)

Note:

Default: - None

The Kubernetes labels to be applied to the nodes in the node group when they are created.

Returns:

  • (Hash{String => String}, nil)


126
127
128
# File 'ek_sv2/nodegroup_options.rb', line 126

def labels
  @labels
end

#launch_template_specAWSCDK::EKSv2::LaunchTemplateSpec? (readonly)

Note:

Default: - no launch template

Launch template specification used for the nodegroup.



132
133
134
# File 'ek_sv2/nodegroup_options.rb', line 132

def launch_template_spec
  @launch_template_spec
end

#max_sizeNumeric? (readonly)

Note:

Default: - same as desiredSize property

The maximum number of worker nodes that the managed node group can scale out to.

Managed node groups can support up to 100 nodes by default.

Returns:

  • (Numeric, nil)


139
140
141
# File 'ek_sv2/nodegroup_options.rb', line 139

def max_size
  @max_size
end

#max_unavailableNumeric? (readonly)

Note:

Default: 1

The maximum number of nodes unavailable at once during a version update.

Nodes will be updated in parallel. The maximum number is 100.

This value or max_unavailable_percentage is required to have a value for custom update configurations to be applied.



149
150
151
# File 'ek_sv2/nodegroup_options.rb', line 149

def max_unavailable
  @max_unavailable
end

#max_unavailable_percentageNumeric? (readonly)

Note:

Default: undefined - node groups will update instances one at a time

The maximum percentage of nodes unavailable during a version update.

This percentage of nodes will be updated in parallel, up to 100 nodes at once.

This value or max_unavailable is required to have a value for custom update configurations to be applied.



159
160
161
# File 'ek_sv2/nodegroup_options.rb', line 159

def max_unavailable_percentage
  @max_unavailable_percentage
end

#min_sizeNumeric? (readonly)

Note:

Default: 1

The minimum number of worker nodes that the managed node group can scale in to.

This number must be greater than or equal to zero.

Returns:

  • (Numeric, nil)


166
167
168
# File 'ek_sv2/nodegroup_options.rb', line 166

def min_size
  @min_size
end

#node_roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: - None. Auto-generated if not specified.

The IAM role to associate with your node group.

The Amazon EKS worker node kubelet daemon makes calls to AWS APIs on your behalf. Worker nodes receive permissions for these API calls through an IAM instance profile and associated policies. Before you can launch worker nodes and register them into a cluster, you must create an IAM role for those worker nodes to use when they are launched.

Returns:



181
182
183
# File 'ek_sv2/nodegroup_options.rb', line 181

def node_role
  @node_role
end

#nodegroup_nameString? (readonly)

Note:

Default: - resource ID

Name of the Nodegroup.

Returns:

  • (String, nil)


171
172
173
# File 'ek_sv2/nodegroup_options.rb', line 171

def nodegroup_name
  @nodegroup_name
end

#release_versionString? (readonly)

Note:

Default: - The latest available AMI version for the node group's current Kubernetes version is used.

The AMI version of the Amazon EKS-optimized AMI to use with your node group (for example, 1.14.7-YYYYMMDD).

Returns:

  • (String, nil)


186
187
188
# File 'ek_sv2/nodegroup_options.rb', line 186

def release_version
  @release_version
end

#remote_accessAWSCDK::EKSv2::NodegroupRemoteAccess? (readonly)

Note:

Default: - disabled

The remote access (SSH) configuration to use with your node group.

Disabled by default, however, if you specify an Amazon EC2 SSH key but do not specify a source security group when you create a managed node group, then port 22 on the worker nodes is opened to the internet (0.0.0.0/0)



195
196
197
# File 'ek_sv2/nodegroup_options.rb', line 195

def remote_access
  @remote_access
end

#removal_policyAWSCDK::RemovalPolicy? (readonly)

Note:

Default: RemovalPolicy.DESTROY

The removal policy applied to the managed node group resources.

The removal policy controls what happens to the resource if it stops being managed by CloudFormation. This can happen in one of three situations:

  • The resource is removed from the template, so CloudFormation stops managing it
  • A change to the resource is made that requires it to be replaced, so CloudFormation stops managing it
  • The stack is deleted, so CloudFormation stops managing all resources in it

Returns:



207
208
209
# File 'ek_sv2/nodegroup_options.rb', line 207

def removal_policy
  @removal_policy
end

#subnetsAWSCDK::EC2::SubnetSelection? (readonly)

Note:

Default: - private subnets

The subnets to use for the Auto Scaling group that is created for your node group.

By specifying the SubnetSelection, the selected subnets will automatically apply required tags i.e. kubernetes.io/cluster/CLUSTER_NAME with a value of shared, where CLUSTER_NAME is replaced with the name of your cluster.



217
218
219
# File 'ek_sv2/nodegroup_options.rb', line 217

def subnets
  @subnets
end

#tagsHash{String => String}? (readonly)

Note:

Default: None

The metadata to apply to the node group to assist with categorization and organization.

Each tag consists of a key and an optional value, both of which you define. Node group tags do not propagate to any other resources associated with the node group, such as the Amazon EC2 instances or subnets.

Returns:

  • (Hash{String => String}, nil)


226
227
228
# File 'ek_sv2/nodegroup_options.rb', line 226

def tags
  @tags
end

#taintsArray<AWSCDK::EKSv2::TaintSpec>? (readonly)

Note:

Default: - None

The Kubernetes taints to be applied to the nodes in the node group when they are created.

Returns:



231
232
233
# File 'ek_sv2/nodegroup_options.rb', line 231

def taints
  @taints
end

Class Method Details

.jsii_propertiesObject



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'ek_sv2/nodegroup_options.rb', line 233

def self.jsii_properties
  {
    :ami_type => "amiType",
    :capacity_type => "capacityType",
    :desired_size => "desiredSize",
    :disk_size => "diskSize",
    :enable_node_auto_repair => "enableNodeAutoRepair",
    :force_update => "forceUpdate",
    :instance_types => "instanceTypes",
    :labels => "labels",
    :launch_template_spec => "launchTemplateSpec",
    :max_size => "maxSize",
    :max_unavailable => "maxUnavailable",
    :max_unavailable_percentage => "maxUnavailablePercentage",
    :min_size => "minSize",
    :nodegroup_name => "nodegroupName",
    :node_role => "nodeRole",
    :release_version => "releaseVersion",
    :remote_access => "remoteAccess",
    :removal_policy => "removalPolicy",
    :subnets => "subnets",
    :tags => "tags",
    :taints => "taints",
  }
end

Instance Method Details

#to_jsiiObject



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'ek_sv2/nodegroup_options.rb', line 259

def to_jsii
  result = {}
  result.merge!({
    "amiType" => @ami_type,
    "capacityType" => @capacity_type,
    "desiredSize" => @desired_size,
    "diskSize" => @disk_size,
    "enableNodeAutoRepair" => @enable_node_auto_repair,
    "forceUpdate" => @force_update,
    "instanceTypes" => @instance_types,
    "labels" => @labels,
    "launchTemplateSpec" => @launch_template_spec,
    "maxSize" => @max_size,
    "maxUnavailable" => @max_unavailable,
    "maxUnavailablePercentage" => @max_unavailable_percentage,
    "minSize" => @min_size,
    "nodegroupName" => @nodegroup_name,
    "nodeRole" => @node_role,
    "releaseVersion" => @release_version,
    "remoteAccess" => @remote_access,
    "removalPolicy" => @removal_policy,
    "subnets" => @subnets,
    "tags" => @tags,
    "taints" => @taints,
  })
  result.compact
end