Class: AWSCDK::EKSv2::NodegroupProps

Inherits:
NodegroupOptions
  • Object
show all
Defined in:
ek_sv2/nodegroup_props.rb

Overview

NodeGroup properties interface.

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, cluster:) ⇒ NodegroupProps

Returns a new instance of NodegroupProps.

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.

  • cluster (AWSCDK::EKSv2::ICluster)

    Cluster resource.



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
72
73
74
# File 'ek_sv2/nodegroup_props.rb', line 29

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, cluster:)
  @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?
  @cluster = cluster
  Jsii::Type.check_type(@cluster, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLklDbHVzdGVyIn0=")), "cluster")
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.



83
84
85
# File 'ek_sv2/nodegroup_props.rb', line 83

def ami_type
  @ami_type
end

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

Note:

Default: CapacityType.ON_DEMAND

The capacity type of the nodegroup.

Returns:



88
89
90
# File 'ek_sv2/nodegroup_props.rb', line 88

def capacity_type
  @capacity_type
end

#clusterAWSCDK::EKSv2::ICluster (readonly)

Cluster resource.



238
239
240
# File 'ek_sv2/nodegroup_props.rb', line 238

def cluster
  @cluster
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)


96
97
98
# File 'ek_sv2/nodegroup_props.rb', line 96

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)


101
102
103
# File 'ek_sv2/nodegroup_props.rb', line 101

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.



109
110
111
# File 'ek_sv2/nodegroup_props.rb', line 109

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)


118
119
120
# File 'ek_sv2/nodegroup_props.rb', line 118

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.



124
125
126
# File 'ek_sv2/nodegroup_props.rb', line 124

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)


129
130
131
# File 'ek_sv2/nodegroup_props.rb', line 129

def labels
  @labels
end

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

Note:

Default: - no launch template

Launch template specification used for the nodegroup.



135
136
137
# File 'ek_sv2/nodegroup_props.rb', line 135

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)


142
143
144
# File 'ek_sv2/nodegroup_props.rb', line 142

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.



152
153
154
# File 'ek_sv2/nodegroup_props.rb', line 152

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.



162
163
164
# File 'ek_sv2/nodegroup_props.rb', line 162

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)


169
170
171
# File 'ek_sv2/nodegroup_props.rb', line 169

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:



184
185
186
# File 'ek_sv2/nodegroup_props.rb', line 184

def node_role
  @node_role
end

#nodegroup_nameString? (readonly)

Note:

Default: - resource ID

Name of the Nodegroup.

Returns:

  • (String, nil)


174
175
176
# File 'ek_sv2/nodegroup_props.rb', line 174

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)


189
190
191
# File 'ek_sv2/nodegroup_props.rb', line 189

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)



198
199
200
# File 'ek_sv2/nodegroup_props.rb', line 198

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:



210
211
212
# File 'ek_sv2/nodegroup_props.rb', line 210

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.



220
221
222
# File 'ek_sv2/nodegroup_props.rb', line 220

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)


229
230
231
# File 'ek_sv2/nodegroup_props.rb', line 229

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:



234
235
236
# File 'ek_sv2/nodegroup_props.rb', line 234

def taints
  @taints
end

Class Method Details

.jsii_propertiesObject



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'ek_sv2/nodegroup_props.rb', line 240

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",
    :cluster => "cluster",
  }
end

Instance Method Details

#to_jsiiObject



267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'ek_sv2/nodegroup_props.rb', line 267

def to_jsii
  result = {}
  result.merge!(super)
  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,
    "cluster" => @cluster,
  })
  result.compact
end