Class: AWSCDK::EKS::AutoScalingGroupOptions

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
eks/auto_scaling_group_options.rb

Overview

Options for adding an AutoScalingGroup as capacity.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bootstrap_enabled: nil, bootstrap_options: nil, machine_image_type: nil, map_role: nil, spot_interrupt_handler: nil) ⇒ AutoScalingGroupOptions

Returns a new instance of AutoScalingGroupOptions.

Parameters:

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

    Configures the EC2 user-data script for instances in this autoscaling group to bootstrap the node (invoke /etc/eks/bootstrap.sh) and associate it with the EKS cluster.

  • bootstrap_options (AWSCDK::EKS::BootstrapOptions, nil) (defaults to: nil)

    Allows options for node bootstrapping through EC2 user data.

  • machine_image_type (AWSCDK::EKS::MachineImageType, nil) (defaults to: nil)

    Allow options to specify different machine image type.

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

    Will automatically update the aws-auth ConfigMap to map the IAM instance role to RBAC.

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

    Installs the AWS spot instance interrupt handler on the cluster if it's not already added.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'eks/auto_scaling_group_options.rb', line 12

def initialize(bootstrap_enabled: nil, bootstrap_options: nil, machine_image_type: nil, map_role: nil, spot_interrupt_handler: nil)
  @bootstrap_enabled = bootstrap_enabled
  Jsii::Type.check_type(@bootstrap_enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "bootstrapEnabled") unless @bootstrap_enabled.nil?
  @bootstrap_options = bootstrap_options.is_a?(Hash) ? ::AWSCDK::EKS::BootstrapOptions.new(**bootstrap_options.transform_keys(&:to_sym)) : bootstrap_options
  Jsii::Type.check_type(@bootstrap_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkJvb3RzdHJhcE9wdGlvbnMifQ==")), "bootstrapOptions") unless @bootstrap_options.nil?
  @machine_image_type = machine_image_type
  Jsii::Type.check_type(@machine_image_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLk1hY2hpbmVJbWFnZVR5cGUifQ==")), "machineImageType") unless @machine_image_type.nil?
  @map_role = map_role
  Jsii::Type.check_type(@map_role, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "mapRole") unless @map_role.nil?
  @spot_interrupt_handler = spot_interrupt_handler
  Jsii::Type.check_type(@spot_interrupt_handler, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "spotInterruptHandler") unless @spot_interrupt_handler.nil?
end

Instance Attribute Details

#bootstrap_enabledBoolean? (readonly)

Note:

Default: true

Configures the EC2 user-data script for instances in this autoscaling group to bootstrap the node (invoke /etc/eks/bootstrap.sh) and associate it with the EKS cluster.

If you wish to provide a custom user data script, set this to false and manually invoke autoscalingGroup.addUserData().

Returns:

  • (Boolean, nil)


32
33
34
# File 'eks/auto_scaling_group_options.rb', line 32

def bootstrap_enabled
  @bootstrap_enabled
end

#bootstrap_optionsAWSCDK::EKS::BootstrapOptions? (readonly)

Note:

Default: - default options

Allows options for node bootstrapping through EC2 user data.



37
38
39
# File 'eks/auto_scaling_group_options.rb', line 37

def bootstrap_options
  @bootstrap_options
end

#machine_image_typeAWSCDK::EKS::MachineImageType? (readonly)

Note:

Default: MachineImageType.AMAZON_LINUX_2

Allow options to specify different machine image type.



42
43
44
# File 'eks/auto_scaling_group_options.rb', line 42

def machine_image_type
  @machine_image_type
end

#map_roleBoolean? (readonly)

Note:

Default: - true if the cluster has kubectl enabled (which is the default).

Will automatically update the aws-auth ConfigMap to map the IAM instance role to RBAC.

This cannot be explicitly set to true if the cluster has kubectl disabled.

Returns:

  • (Boolean, nil)


49
50
51
# File 'eks/auto_scaling_group_options.rb', line 49

def map_role
  @map_role
end

#spot_interrupt_handlerBoolean? (readonly)

Note:

Default: true

Installs the AWS spot instance interrupt handler on the cluster if it's not already added.

Only relevant if spot_price is configured on the auto-scaling group.

Returns:

  • (Boolean, nil)


56
57
58
# File 'eks/auto_scaling_group_options.rb', line 56

def spot_interrupt_handler
  @spot_interrupt_handler
end

Class Method Details

.jsii_propertiesObject



58
59
60
61
62
63
64
65
66
# File 'eks/auto_scaling_group_options.rb', line 58

def self.jsii_properties
  {
    :bootstrap_enabled => "bootstrapEnabled",
    :bootstrap_options => "bootstrapOptions",
    :machine_image_type => "machineImageType",
    :map_role => "mapRole",
    :spot_interrupt_handler => "spotInterruptHandler",
  }
end

Instance Method Details

#to_jsiiObject



68
69
70
71
72
73
74
75
76
77
78
# File 'eks/auto_scaling_group_options.rb', line 68

def to_jsii
  result = {}
  result.merge!({
    "bootstrapEnabled" => @bootstrap_enabled,
    "bootstrapOptions" => @bootstrap_options,
    "machineImageType" => @machine_image_type,
    "mapRole" => @map_role,
    "spotInterruptHandler" => @spot_interrupt_handler,
  })
  result.compact
end