Class: AWSCDK::EKS::Cluster

Inherits:
Resource
  • Object
show all
Includes:
ICluster
Defined in:
eks/cluster.rb

Overview

A Cluster represents a managed Kubernetes Service (EKS).

This is a fully managed cluster of API Servers (control-plane) The user is still required to create the worker nodes.

Direct Known Subclasses

FargateCluster

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props) ⇒ Cluster

Initiates an EKS Cluster with the supplied arguments.

Parameters:

  • scope (Constructs::Construct)

    a Construct, most likely a cdk.Stack created.

  • id (String)

    the id of the Construct to create.

  • props (AWSCDK::EKS::ClusterProps)

    properties in the IClusterProps interface.



17
18
19
20
21
22
23
# File 'eks/cluster.rb', line 17

def initialize(scope, id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::EKS::ClusterProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkNsdXN0ZXJQcm9wcyJ9")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.from_cluster_attributes(scope, id, attrs) ⇒ AWSCDK::EKS::ICluster

Import an existing cluster.

Parameters:

  • scope (Constructs::Construct)

    the construct scope, in most cases 'this'.

  • id (String)

    the id or name to import as.

  • attrs (AWSCDK::EKS::ClusterAttributes)

    the cluster properties to use for importing information.

Returns:



91
92
93
94
95
96
97
# File 'eks/cluster.rb', line 91

def self.from_cluster_attributes(scope, id, attrs)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  attrs = attrs.is_a?(Hash) ? ::AWSCDK::EKS::ClusterAttributes.new(**attrs.transform_keys(&:to_sym)) : attrs
  Jsii::Type.check_type(attrs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkNsdXN0ZXJBdHRyaWJ1dGVzIn0=")), "attrs")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_eks.Cluster", "fromClusterAttributes", [scope, id, attrs])
end

.jsii_overridable_methodsObject



25
26
27
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
72
73
74
75
76
77
78
79
80
81
82
83
# File 'eks/cluster.rb', line 25

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :physical_name => { kind: :property, name: "physicalName", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :admin_role => { kind: :property, name: "adminRole", is_optional: false },
    :aws_auth => { kind: :property, name: "awsAuth", is_optional: false },
    :cluster_arn => { kind: :property, name: "clusterArn", is_optional: false },
    :cluster_certificate_authority_data => { kind: :property, name: "clusterCertificateAuthorityData", is_optional: false },
    :cluster_encryption_config_key_arn => { kind: :property, name: "clusterEncryptionConfigKeyArn", is_optional: false },
    :cluster_endpoint => { kind: :property, name: "clusterEndpoint", is_optional: false },
    :cluster_name => { kind: :property, name: "clusterName", is_optional: false },
    :cluster_open_id_connect_issuer => { kind: :property, name: "clusterOpenIdConnectIssuer", is_optional: false },
    :cluster_open_id_connect_issuer_url => { kind: :property, name: "clusterOpenIdConnectIssuerUrl", is_optional: false },
    :cluster_ref => { kind: :property, name: "clusterRef", is_optional: false },
    :cluster_security_group => { kind: :property, name: "clusterSecurityGroup", is_optional: false },
    :cluster_security_group_id => { kind: :property, name: "clusterSecurityGroupId", is_optional: false },
    :connections => { kind: :property, name: "connections", is_optional: false },
    :open_id_connect_provider => { kind: :property, name: "openIdConnectProvider", is_optional: false },
    :prune => { kind: :property, name: "prune", is_optional: false },
    :role => { kind: :property, name: "role", is_optional: false },
    :vpc => { kind: :property, name: "vpc", is_optional: false },
    :alb_controller => { kind: :property, name: "albController", is_optional: true },
    :authentication_mode => { kind: :property, name: "authenticationMode", is_optional: true },
    :awscli_layer => { kind: :property, name: "awscliLayer", is_optional: true },
    :cluster_handler_security_group => { kind: :property, name: "clusterHandlerSecurityGroup", is_optional: true },
    :default_capacity => { kind: :property, name: "defaultCapacity", is_optional: true },
    :default_nodegroup => { kind: :property, name: "defaultNodegroup", is_optional: true },
    :eks_pod_identity_agent => { kind: :property, name: "eksPodIdentityAgent", is_optional: true },
    :ip_family => { kind: :property, name: "ipFamily", is_optional: true },
    :kubectl_environment => { kind: :property, name: "kubectlEnvironment", is_optional: true },
    :kubectl_lambda_role => { kind: :property, name: "kubectlLambdaRole", is_optional: true },
    :kubectl_layer => { kind: :property, name: "kubectlLayer", is_optional: true },
    :kubectl_memory => { kind: :property, name: "kubectlMemory", is_optional: true },
    :kubectl_private_subnets => { kind: :property, name: "kubectlPrivateSubnets", is_optional: true },
    :kubectl_role => { kind: :property, name: "kubectlRole", is_optional: true },
    :kubectl_security_group => { kind: :property, name: "kubectlSecurityGroup", is_optional: true },
    :on_event_layer => { kind: :property, name: "onEventLayer", is_optional: true },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_cross_stack_reference_strength => { kind: :method, name: "applyCrossStackReferenceStrength", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :generate_physical_name => { kind: :method, name: "generatePhysicalName", is_optional: false },
    :get_resource_arn_attribute => { kind: :method, name: "getResourceArnAttribute", is_optional: false },
    :get_resource_name_attribute => { kind: :method, name: "getResourceNameAttribute", is_optional: false },
    :add_auto_scaling_group_capacity => { kind: :method, name: "addAutoScalingGroupCapacity", is_optional: false },
    :add_cdk8s_chart => { kind: :method, name: "addCdk8sChart", is_optional: false },
    :add_fargate_profile => { kind: :method, name: "addFargateProfile", is_optional: false },
    :add_helm_chart => { kind: :method, name: "addHelmChart", is_optional: false },
    :add_manifest => { kind: :method, name: "addManifest", is_optional: false },
    :add_nodegroup_capacity => { kind: :method, name: "addNodegroupCapacity", is_optional: false },
    :add_service_account => { kind: :method, name: "addServiceAccount", is_optional: false },
    :connect_auto_scaling_group_capacity => { kind: :method, name: "connectAutoScalingGroupCapacity", is_optional: false },
    :get_ingress_load_balancer_address => { kind: :method, name: "getIngressLoadBalancerAddress", is_optional: false },
    :get_service_load_balancer_address => { kind: :method, name: "getServiceLoadBalancerAddress", is_optional: false },
    :grant_access => { kind: :method, name: "grantAccess", is_optional: false },
  }
end

.PROPERTY_INJECTION_IDString

Uniquely identifies this class.

Returns:

  • (String)


145
146
147
# File 'eks/cluster.rb', line 145

def self.PROPERTY_INJECTION_ID()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_eks.Cluster", "PROPERTY_INJECTION_ID")
end

Instance Method Details

#add_auto_scaling_group_capacity(id, options) ⇒ AWSCDK::Autoscaling::AutoScalingGroup

Add nodes to this EKS cluster.

The nodes will automatically be configured with the right VPC and AMI for the instance type and Kubernetes version.

Note that if you specify updateType: RollingUpdate or updateType: ReplacingUpdate, your nodes might be replaced at deploy time without notice in case the recommended AMI for your machine image type has been updated by AWS. The default behavior for update_type is None, which means only new instances will be launched using the new AMI.

Spot instances will be labeled lifecycle=Ec2Spot and tainted with PreferNoSchedule. In addition, the spot interrupt handler daemon will be installed on all spot instances to handle EC2 Spot Instance Termination Notices.



540
541
542
543
544
545
# File 'eks/cluster.rb', line 540

def add_auto_scaling_group_capacity(id, options)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  options = options.is_a?(Hash) ? ::AWSCDK::EKS::AutoScalingGroupCapacityOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkF1dG9TY2FsaW5nR3JvdXBDYXBhY2l0eU9wdGlvbnMifQ==")), "options")
  jsii_call_method("addAutoScalingGroupCapacity", [id, options])
end

#add_cdk8s_chart(id, chart, options = nil) ⇒ AWSCDK::EKS::KubernetesManifest

Defines a CDK8s chart in this cluster.

Parameters:

Returns:



553
554
555
556
557
558
559
# File 'eks/cluster.rb', line 553

def add_cdk8s_chart(id, chart, options = nil)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(chart, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "chart")
  options = options.is_a?(Hash) ? ::AWSCDK::EKS::KubernetesManifestOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkt1YmVybmV0ZXNNYW5pZmVzdE9wdGlvbnMifQ==")), "options") unless options.nil?
  jsii_call_method("addCdk8sChart", [id, chart, options])
end

#add_fargate_profile(id, options) ⇒ AWSCDK::EKS::FargateProfile

Adds a Fargate profile to this cluster.

Parameters:

Returns:

See Also:



567
568
569
570
571
572
# File 'eks/cluster.rb', line 567

def add_fargate_profile(id, options)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  options = options.is_a?(Hash) ? ::AWSCDK::EKS::FargateProfileOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkZhcmdhdGVQcm9maWxlT3B0aW9ucyJ9")), "options")
  jsii_call_method("addFargateProfile", [id, options])
end

#add_helm_chart(id, options) ⇒ AWSCDK::EKS::HelmChart

Defines a Helm chart in this cluster.

Parameters:

Returns:



579
580
581
582
583
584
# File 'eks/cluster.rb', line 579

def add_helm_chart(id, options)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  options = options.is_a?(Hash) ? ::AWSCDK::EKS::HelmChartOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkhlbG1DaGFydE9wdGlvbnMifQ==")), "options")
  jsii_call_method("addHelmChart", [id, options])
end

#add_manifest(id, *manifest) ⇒ AWSCDK::EKS::KubernetesManifest

Defines a Kubernetes resource in this cluster.

The manifest will be applied/deleted using kubectl as needed.

Parameters:

  • id (String)

    logical id of this manifest.

  • manifest (Array<Hash{String => Object}>)

    a list of Kubernetes resource specifications.

Returns:



593
594
595
596
597
598
599
# File 'eks/cluster.rb', line 593

def add_manifest(id, *manifest)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  manifest.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "manifest[#{index}]")
  end
  jsii_call_method("addManifest", [id, *manifest])
end

#add_nodegroup_capacity(id, options = nil) ⇒ AWSCDK::EKS::Nodegroup

Add managed nodegroup to this Amazon EKS cluster.

This method will create a new managed nodegroup and add into the capacity.

Parameters:

  • id (String)

    The ID of the nodegroup.

  • options (AWSCDK::EKS::NodegroupOptions, nil) (defaults to: nil)

    options for creating a new nodegroup.

Returns:

See Also:



609
610
611
612
613
614
# File 'eks/cluster.rb', line 609

def add_nodegroup_capacity(id, options = nil)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  options = options.is_a?(Hash) ? ::AWSCDK::EKS::NodegroupOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLk5vZGVncm91cE9wdGlvbnMifQ==")), "options") unless options.nil?
  jsii_call_method("addNodegroupCapacity", [id, options])
end

#add_service_account(id, options = nil) ⇒ AWSCDK::EKS::ServiceAccount

Creates a new service account with corresponding IAM Role (IRSA).

Parameters:

Returns:



621
622
623
624
625
626
# File 'eks/cluster.rb', line 621

def (id, options = nil)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  options = options.is_a?(Hash) ? ::AWSCDK::EKS::ServiceAccountOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLlNlcnZpY2VBY2NvdW50T3B0aW9ucyJ9")), "options") unless options.nil?
  jsii_call_method("addServiceAccount", [id, options])
end

#admin_roleAWSCDK::IAM::Role

An IAM role with administrative permissions to create or update the cluster.

This role also has systems:master permissions.

Returns:



154
155
156
# File 'eks/cluster.rb', line 154

def admin_role()
  jsii_get_property("adminRole")
end

#alb_controllerAWSCDK::EKS::ALBController?

The ALB Controller construct defined for this cluster.

Will be undefined if alb_controller wasn't configured.

Returns:



289
290
291
# File 'eks/cluster.rb', line 289

def alb_controller()
  jsii_get_property("albController")
end

#apply_cross_stack_reference_strength(strength) ⇒ void

This method returns an undefined value.

Override the cross-stack reference strength for this resource.

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters:



466
467
468
469
# File 'eks/cluster.rb', line 466

def apply_cross_stack_reference_strength(strength)
  Jsii::Type.check_type(strength, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZWZlcmVuY2VTdHJlbmd0aCJ9")), "strength")
  jsii_call_method("applyCrossStackReferenceStrength", [strength])
end

#apply_removal_policy(policy) ⇒ void

This method returns an undefined value.

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:



483
484
485
486
# File 'eks/cluster.rb', line 483

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
end

#authentication_modeAWSCDK::EKS::AuthenticationMode?

Note:

Default: CONFIG_MAP.

The authentication mode for the Amazon EKS cluster.

The authentication mode determines how users and applications authenticate to the Kubernetes API server.



299
300
301
# File 'eks/cluster.rb', line 299

def authentication_mode()
  jsii_get_property("authenticationMode")
end

#aws_authAWSCDK::EKS::AWSAuth

Lazily creates the AwsAuth resource, which manages AWS authentication mapping.



161
162
163
# File 'eks/cluster.rb', line 161

def aws_auth()
  jsii_get_property("awsAuth")
end

#awscli_layerAWSCDK::Lambda::ILayerVersion?

An AWS Lambda layer that contains the aws CLI.

If not defined, a default layer will be used containing the AWS CLI 1.x.



308
309
310
# File 'eks/cluster.rb', line 308

def awscli_layer()
  jsii_get_property("awscliLayer")
end

#cluster_arnString

The unique ARN assigned to the service by AWS in the form of arn:aws:eks:.

Returns:

  • (String)


168
169
170
# File 'eks/cluster.rb', line 168

def cluster_arn()
  jsii_get_property("clusterArn")
end

#cluster_certificate_authority_dataString

The certificate-authority-data for your cluster.

Returns:

  • (String)


175
176
177
# File 'eks/cluster.rb', line 175

def cluster_certificate_authority_data()
  jsii_get_property("clusterCertificateAuthorityData")
end

#cluster_encryption_config_key_arnString

Amazon Resource Name (ARN) or alias of the customer master key (CMK).

Returns:

  • (String)


182
183
184
# File 'eks/cluster.rb', line 182

def cluster_encryption_config_key_arn()
  jsii_get_property("clusterEncryptionConfigKeyArn")
end

#cluster_endpointString

The endpoint URL for the Cluster.

This is the URL inside the kubeconfig file to use with kubectl

For example, https://5E1D0CEXAMPLEA591B746AFC5AB30262.yl4.us-west-2.eks.amazonaws.com

Returns:

  • (String)


193
194
195
# File 'eks/cluster.rb', line 193

def cluster_endpoint()
  jsii_get_property("clusterEndpoint")
end

#cluster_handler_security_groupAWSCDK::EC2::ISecurityGroup?

Note:

Default: - No security group.

A security group to associate with the Cluster Handler's Lambdas.

The Cluster Handler's Lambdas are responsible for calling AWS's EKS API.

Requires place_cluster_handler_in_vpc to be set to true.

Returns:



320
321
322
# File 'eks/cluster.rb', line 320

def cluster_handler_security_group()
  jsii_get_property("clusterHandlerSecurityGroup")
end

#cluster_nameString

The physical name of the Cluster.

Returns:

  • (String)


200
201
202
# File 'eks/cluster.rb', line 200

def cluster_name()
  jsii_get_property("clusterName")
end

#cluster_open_id_connect_issuerString

If this cluster is kubectl-enabled, returns the OpenID Connect issuer.

This is because the values is only be retrieved by the API and not exposed by CloudFormation. If this cluster is not kubectl-enabled (i.e. uses the stock CfnCluster), this is undefined.

Returns:

  • (String)


211
212
213
# File 'eks/cluster.rb', line 211

def cluster_open_id_connect_issuer()
  jsii_get_property("clusterOpenIdConnectIssuer")
end

#cluster_open_id_connect_issuer_urlString

If this cluster is kubectl-enabled, returns the OpenID Connect issuer url.

This is because the values is only be retrieved by the API and not exposed by CloudFormation. If this cluster is not kubectl-enabled (i.e. uses the stock CfnCluster), this is undefined.

Returns:

  • (String)


222
223
224
# File 'eks/cluster.rb', line 222

def cluster_open_id_connect_issuer_url()
  jsii_get_property("clusterOpenIdConnectIssuerUrl")
end

#cluster_refAWSCDK::Interfaces::AWSEKS::ClusterReference

A reference to a Cluster resource.



229
230
231
# File 'eks/cluster.rb', line 229

def cluster_ref()
  jsii_get_property("clusterRef")
end

#cluster_security_groupAWSCDK::EC2::ISecurityGroup

The cluster security group that was created by Amazon EKS for the cluster.



236
237
238
# File 'eks/cluster.rb', line 236

def cluster_security_group()
  jsii_get_property("clusterSecurityGroup")
end

#cluster_security_group_idString

The id of the cluster security group that was created by Amazon EKS for the cluster.

Returns:

  • (String)


243
244
245
# File 'eks/cluster.rb', line 243

def cluster_security_group_id()
  jsii_get_property("clusterSecurityGroupId")
end

#connect_auto_scaling_group_capacity(auto_scaling_group, options) ⇒ void

This method returns an undefined value.

Connect capacity in the form of an existing AutoScalingGroup to the EKS cluster.

The AutoScalingGroup must be running an EKS-optimized AMI containing the /etc/eks/bootstrap.sh script. This method will configure Security Groups, add the right policies to the instance role, apply the right tags, and add the required user data to the instance's launch configuration.

Spot instances will be labeled lifecycle=Ec2Spot and tainted with PreferNoSchedule. If kubectl is enabled, the spot interrupt handler daemon will be installed on all spot instances to handle EC2 Spot Instance Termination Notices.

Prefer to use add_auto_scaling_group_capacity if possible.

Parameters:

See Also:



647
648
649
650
651
652
# File 'eks/cluster.rb', line 647

def connect_auto_scaling_group_capacity(auto_scaling_group, options)
  Jsii::Type.check_type(auto_scaling_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQXV0b1NjYWxpbmdHcm91cCJ9")), "autoScalingGroup")
  options = options.is_a?(Hash) ? ::AWSCDK::EKS::AutoScalingGroupOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkF1dG9TY2FsaW5nR3JvdXBPcHRpb25zIn0=")), "options")
  jsii_call_method("connectAutoScalingGroupCapacity", [auto_scaling_group, options])
end

#connectionsAWSCDK::EC2::Connections

Manages connection rules (Security Group Rules) for the cluster.



250
251
252
# File 'eks/cluster.rb', line 250

def connections()
  jsii_get_property("connections")
end

#default_capacityAWSCDK::Autoscaling::AutoScalingGroup?

The auto scaling group that hosts the default capacity for this cluster.

This will be undefined if the default_capacity_type is not EC2 or default_capacity_type is EC2 but default capacity is set to 0.



330
331
332
# File 'eks/cluster.rb', line 330

def default_capacity()
  jsii_get_property("defaultCapacity")
end

#default_nodegroupAWSCDK::EKS::Nodegroup?

The node group that hosts the default capacity for this cluster.

This will be undefined if the default_capacity_type is EC2 or default_capacity_type is NODEGROUP but default capacity is set to 0.

Returns:



340
341
342
# File 'eks/cluster.rb', line 340

def default_nodegroup()
  jsii_get_property("defaultNodegroup")
end

#eks_pod_identity_agentAWSCDK::EKS::IAddon?

Retrieves the EKS Pod Identity Agent addon for the EKS cluster.

The EKS Pod Identity Agent is responsible for managing the temporary credentials used by pods in the cluster to access AWS resources. It runs as a DaemonSet on each node and provides the necessary credentials to the pods based on their associated service account.

Returns:



352
353
354
# File 'eks/cluster.rb', line 352

def eks_pod_identity_agent()
  jsii_get_property("eksPodIdentityAgent")
end

#envAWSCDK::Interfaces::ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.



117
118
119
# File 'eks/cluster.rb', line 117

def env()
  jsii_get_property("env")
end

#generate_physical_nameString

Returns:

  • (String)


489
490
491
# File 'eks/cluster.rb', line 489

def generate_physical_name()
  jsii_call_method("generatePhysicalName", [])
end

#get_ingress_load_balancer_address(ingress_name, options = nil) ⇒ String

Fetch the load balancer address of an ingress backed by a load balancer.

Parameters:

Returns:

  • (String)


659
660
661
662
663
664
# File 'eks/cluster.rb', line 659

def get_ingress_load_balancer_address(ingress_name, options = nil)
  Jsii::Type.check_type(ingress_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ingressName")
  options = options.is_a?(Hash) ? ::AWSCDK::EKS::IngressLoadBalancerAddressOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkluZ3Jlc3NMb2FkQmFsYW5jZXJBZGRyZXNzT3B0aW9ucyJ9")), "options") unless options.nil?
  jsii_call_method("getIngressLoadBalancerAddress", [ingress_name, options])
end

#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String

Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).

Normally, this token will resolve to arn_attr, but if the resource is referenced across environments, arn_components will be used to synthesize a concrete ARN with the resource's physical name. Make sure to reference this.physicalName in arn_components.

Parameters:

  • arn_attr (String)

    The CFN attribute which resolves to the ARN of the resource.

  • arn_components (AWSCDK::ARNComponents)

    The format of the ARN of this resource.

Returns:

  • (String)


503
504
505
506
507
508
# File 'eks/cluster.rb', line 503

def get_resource_arn_attribute(arn_attr, arn_components)
  Jsii::Type.check_type(arn_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "arnAttr")
  arn_components = arn_components.is_a?(Hash) ? ::AWSCDK::ARNComponents.new(**arn_components.transform_keys(&:to_sym)) : arn_components
  Jsii::Type.check_type(arn_components, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bcm5Db21wb25lbnRzIn0=")), "arnComponents")
  jsii_call_method("getResourceArnAttribute", [arn_attr, arn_components])
end

#get_resource_name_attribute(name_attr) ⇒ String

Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).

Normally, this token will resolve to name_attr, but if the resource is referenced across environments, it will be resolved to this.physicalName, which will be a concrete name.

Parameters:

  • name_attr (String)

    The CFN attribute which resolves to the resource's name.

Returns:

  • (String)


518
519
520
521
# File 'eks/cluster.rb', line 518

def get_resource_name_attribute(name_attr)
  Jsii::Type.check_type(name_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nameAttr")
  jsii_call_method("getResourceNameAttribute", [name_attr])
end

#get_service_load_balancer_address(service_name, options = nil) ⇒ String

Fetch the load balancer address of a service of type 'LoadBalancer'.

Parameters:

Returns:

  • (String)


671
672
673
674
675
676
# File 'eks/cluster.rb', line 671

def get_service_load_balancer_address(service_name, options = nil)
  Jsii::Type.check_type(service_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "serviceName")
  options = options.is_a?(Hash) ? ::AWSCDK::EKS::ServiceLoadBalancerAddressOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLlNlcnZpY2VMb2FkQmFsYW5jZXJBZGRyZXNzT3B0aW9ucyJ9")), "options") unless options.nil?
  jsii_call_method("getServiceLoadBalancerAddress", [service_name, options])
end

#grant_access(id, principal, access_policies, options = nil) ⇒ void

This method returns an undefined value.

Grants the specified IAM principal access to the EKS cluster based on the provided access policies.

This method creates an AccessEntry construct that grants the specified IAM principal the access permissions defined by the provided IAccessPolicy array. This allows the IAM principal to perform the actions permitted by the access policies within the EKS cluster.

Parameters:

  • id (String)
    • The ID of the AccessEntry construct to be created.
  • principal (String)
    • The IAM principal (role or user) to be granted access to the EKS cluster.
  • access_policies (Array<AWSCDK::EKS::IAccessPolicy>)
    • An array of IAccessPolicy objects that define the access permissions to be granted to the IAM principal.
  • options (AWSCDK::EKS::GrantAccessOptions, nil) (defaults to: nil)
    • Additional options for granting access.


689
690
691
692
693
694
695
696
# File 'eks/cluster.rb', line 689

def grant_access(id, principal, access_policies, options = nil)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(principal, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "principal")
  Jsii::Type.check_type(access_policies, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19la3MuSUFjY2Vzc1BvbGljeSJ9LCJraW5kIjoiYXJyYXkifX0=")), "accessPolicies")
  options = options.is_a?(Hash) ? ::AWSCDK::EKS::GrantAccessOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkdyYW50QWNjZXNzT3B0aW9ucyJ9")), "options") unless options.nil?
  jsii_call_method("grantAccess", [id, principal, access_policies, options])
end

#ip_familyAWSCDK::EKS::IPFamily?

Note:

Default: - IpFamily.IP_V4

Specify which IP family is used to assign Kubernetes pod and service IP addresses.



361
362
363
# File 'eks/cluster.rb', line 361

def ip_family()
  jsii_get_property("ipFamily")
end

#kubectl_environmentHash{String => String}?

Custom environment variables when running kubectl against this cluster.

Returns:

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


368
369
370
# File 'eks/cluster.rb', line 368

def kubectl_environment()
  jsii_get_property("kubectlEnvironment")
end

#kubectl_lambda_roleAWSCDK::IAM::IRole?

Note:

Default: - if not specified, the default role created by a lambda function will be used.

An IAM role that can perform kubectl operations against this cluster.

The role should be mapped to the system:masters Kubernetes RBAC role.

This role is directly passed to the lambda handler that sends Kube Ctl commands to the cluster.

Returns:



380
381
382
# File 'eks/cluster.rb', line 380

def kubectl_lambda_role()
  jsii_get_property("kubectlLambdaRole")
end

#kubectl_layerAWSCDK::Lambda::ILayerVersion?

An AWS Lambda layer that includes kubectl and helm.



387
388
389
# File 'eks/cluster.rb', line 387

def kubectl_layer()
  jsii_get_property("kubectlLayer")
end

#kubectl_memoryAWSCDK::Size?

The amount of memory allocated to the kubectl provider's lambda function.

Returns:



394
395
396
# File 'eks/cluster.rb', line 394

def kubectl_memory()
  jsii_get_property("kubectlMemory")
end

#kubectl_private_subnetsArray<AWSCDK::EC2::ISubnet>?

Note:

Default: - If not specified, the k8s endpoint is expected to be accessible publicly.

Subnets to host the kubectl compute resources.

Returns:



402
403
404
# File 'eks/cluster.rb', line 402

def kubectl_private_subnets()
  jsii_get_property("kubectlPrivateSubnets")
end

#kubectl_roleAWSCDK::IAM::IRole?

An IAM role that can perform kubectl operations against this cluster.

The role should be mapped to the system:masters Kubernetes RBAC role.

Returns:



411
412
413
# File 'eks/cluster.rb', line 411

def kubectl_role()
  jsii_get_property("kubectlRole")
end

#kubectl_security_groupAWSCDK::EC2::ISecurityGroup?

Note:

Default: - If not specified, the k8s endpoint is expected to be accessible publicly.

A security group to use for kubectl execution.

Returns:



419
420
421
# File 'eks/cluster.rb', line 419

def kubectl_security_group()
  jsii_get_property("kubectlSecurityGroup")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


102
103
104
# File 'eks/cluster.rb', line 102

def node()
  jsii_get_property("node")
end

#on_event_layerAWSCDK::Lambda::ILayerVersion?

The AWS Lambda layer that contains the NPM dependency proxy-agent.

If undefined, a SAR app that contains this layer will be used.



429
430
431
# File 'eks/cluster.rb', line 429

def on_event_layer()
  jsii_get_property("onEventLayer")
end

#open_id_connect_providerAWSCDK::IAM::IOpenIdConnectProvider

An OpenIdConnectProvider resource associated with this cluster, and which can be used to link this cluster to AWS IAM.

A provider will only be defined if this property is accessed (lazy initialization).



259
260
261
# File 'eks/cluster.rb', line 259

def open_id_connect_provider()
  jsii_get_property("openIdConnectProvider")
end

#physical_nameString

Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.

This value will resolve to one of the following:

  • a concrete value (e.g. "my-awesome-bucket")
  • undefined, when a name should be generated by CloudFormation
  • a concrete name generated automatically during synthesis, in cross-environment scenarios.

Returns:

  • (String)


131
132
133
# File 'eks/cluster.rb', line 131

def physical_name()
  jsii_get_property("physicalName")
end

#pruneBoolean

Determines if Kubernetes resources can be pruned automatically.

Returns:

  • (Boolean)


266
267
268
# File 'eks/cluster.rb', line 266

def prune()
  jsii_get_property("prune")
end

#roleAWSCDK::IAM::IRole

IAM role assumed by the EKS Control Plane.

Returns:



273
274
275
# File 'eks/cluster.rb', line 273

def role()
  jsii_get_property("role")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



138
139
140
# File 'eks/cluster.rb', line 138

def stack()
  jsii_get_property("stack")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


436
437
438
# File 'eks/cluster.rb', line 436

def to_string()
  jsii_call_method("toString", [])
end

#vpcAWSCDK::EC2::IVPC

The VPC in which this Cluster was created.

Returns:



280
281
282
# File 'eks/cluster.rb', line 280

def vpc()
  jsii_get_property("vpc")
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

  • mixins (Array<Constructs::IMixin>)

Returns:

  • (Constructs::IConstruct)


449
450
451
452
453
454
# File 'eks/cluster.rb', line 449

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end