Class: AWSCDK::EKS::CommonClusterOptions

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

Overview

Options for configuring an EKS cluster.

Direct Known Subclasses

ClusterOptions

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version:, cluster_name: nil, output_cluster_name: nil, output_config_command: nil, role: nil, security_group: nil, vpc: nil, vpc_subnets: nil) ⇒ CommonClusterOptions

Returns a new instance of CommonClusterOptions.

Parameters:

  • version (AWSCDK::EKS::KubernetesVersion)

    The Kubernetes version to run in the cluster.

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

    Name for the cluster.

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

    Determines whether a CloudFormation output with the name of the cluster will be synthesized.

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

    Determines whether a CloudFormation output with the aws eks update-kubeconfig command will be synthesized.

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

    Role that provides permissions for the Kubernetes control plane to make calls to AWS API operations on your behalf.

  • security_group (AWSCDK::EC2::ISecurityGroup, nil) (defaults to: nil)

    Security Group to use for Control Plane ENIs.

  • vpc (AWSCDK::EC2::IVPC, nil) (defaults to: nil)

    The VPC in which to create the Cluster.

  • vpc_subnets (Array<AWSCDK::EC2::SubnetSelection>, nil) (defaults to: nil)

    Where to place EKS Control Plane ENIs.



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

def initialize(version:, cluster_name: nil, output_cluster_name: nil, output_config_command: nil, role: nil, security_group: nil, vpc: nil, vpc_subnets: nil)
  @version = version
  Jsii::Type.check_type(@version, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkt1YmVybmV0ZXNWZXJzaW9uIn0=")), "version")
  @cluster_name = cluster_name
  Jsii::Type.check_type(@cluster_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "clusterName") unless @cluster_name.nil?
  @output_cluster_name = output_cluster_name
  Jsii::Type.check_type(@output_cluster_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "outputClusterName") unless @output_cluster_name.nil?
  @output_config_command = output_config_command
  Jsii::Type.check_type(@output_config_command, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "outputConfigCommand") unless @output_config_command.nil?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil?
  @security_group = security_group
  Jsii::Type.check_type(@security_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklTZWN1cml0eUdyb3VwIn0=")), "securityGroup") unless @security_group.nil?
  @vpc = vpc
  Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") unless @vpc.nil?
  @vpc_subnets = vpc_subnets.is_a?(Array) ? vpc_subnets.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : vpc_subnets
  Jsii::Type.check_type(@vpc_subnets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuU3VibmV0U2VsZWN0aW9uIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "vpcSubnets") unless @vpc_subnets.nil?
end

Instance Attribute Details

#cluster_nameString? (readonly)

Note:

Default: - Automatically generated name

Name for the cluster.

Returns:

  • (String, nil)


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

def cluster_name
  @cluster_name
end

#output_cluster_nameBoolean? (readonly)

Note:

Default: false

Determines whether a CloudFormation output with the name of the cluster will be synthesized.

Returns:

  • (Boolean, nil)


47
48
49
# File 'eks/common_cluster_options.rb', line 47

def output_cluster_name
  @output_cluster_name
end

#output_config_commandBoolean? (readonly)

Note:

Default: true

Determines whether a CloudFormation output with the aws eks update-kubeconfig command will be synthesized.

This command will include the cluster name and the ARN of the masters IAM role.

Note: If mastersRole is not specified, this property will be ignored and no config command will be emitted.



58
59
60
# File 'eks/common_cluster_options.rb', line 58

def output_config_command
  @output_config_command
end

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

Note:

Default: - A role is automatically created for you

Role that provides permissions for the Kubernetes control plane to make calls to AWS API operations on your behalf.

Returns:



63
64
65
# File 'eks/common_cluster_options.rb', line 63

def role
  @role
end

#security_groupAWSCDK::EC2::ISecurityGroup? (readonly)

Note:

Default: - A security group is automatically created

Security Group to use for Control Plane ENIs.

Returns:



68
69
70
# File 'eks/common_cluster_options.rb', line 68

def security_group
  @security_group
end

#versionAWSCDK::EKS::KubernetesVersion (readonly)

The Kubernetes version to run in the cluster.



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

def version
  @version
end

#vpcAWSCDK::EC2::IVPC? (readonly)

Note:

Default: - a VPC with default configuration will be created and can be accessed through cluster.vpc.

The VPC in which to create the Cluster.

Returns:



73
74
75
# File 'eks/common_cluster_options.rb', line 73

def vpc
  @vpc
end

#vpc_subnetsArray<AWSCDK::EC2::SubnetSelection>? (readonly)

Note:

Default: - All public and private subnets

Where to place EKS Control Plane ENIs.

For example, to only select private subnets, supply the following:

vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }]

Returns:



82
83
84
# File 'eks/common_cluster_options.rb', line 82

def vpc_subnets
  @vpc_subnets
end

Class Method Details

.jsii_propertiesObject



84
85
86
87
88
89
90
91
92
93
94
95
# File 'eks/common_cluster_options.rb', line 84

def self.jsii_properties
  {
    :version => "version",
    :cluster_name => "clusterName",
    :output_cluster_name => "outputClusterName",
    :output_config_command => "outputConfigCommand",
    :role => "role",
    :security_group => "securityGroup",
    :vpc => "vpc",
    :vpc_subnets => "vpcSubnets",
  }
end

Instance Method Details

#to_jsiiObject



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'eks/common_cluster_options.rb', line 97

def to_jsii
  result = {}
  result.merge!({
    "version" => @version,
    "clusterName" => @cluster_name,
    "outputClusterName" => @output_cluster_name,
    "outputConfigCommand" => @output_config_command,
    "role" => @role,
    "securityGroup" => @security_group,
    "vpc" => @vpc,
    "vpcSubnets" => @vpc_subnets,
  })
  result.compact
end