Class: AWSCDK::EKSv2::Cluster

Inherits:
Resource
  • Object
show all
Includes:
ICluster
Defined in:
ek_sv2/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::EKSv2::ClusterProps)

    properties in the IClusterProps interface.



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

def initialize(scope, id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::EKSv2::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("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLkNsdXN0ZXJQcm9wcyJ9")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.from_cluster_attributes(scope, id, attrs) ⇒ AWSCDK::EKSv2::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::EKSv2::ClusterAttributes)

    the cluster properties to use for importing information.

Returns:



79
80
81
82
83
84
85
# File 'ek_sv2/cluster.rb', line 79

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::EKSv2::ClusterAttributes.new(**attrs.transform_keys(&:to_sym)) : attrs
  Jsii::Type.check_type(attrs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLkNsdXN0ZXJBdHRyaWJ1dGVzIn0=")), "attrs")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_eks_v2.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
# File 'ek_sv2/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 },
    :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_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 },
    :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_provider => { kind: :property, name: "kubectlProvider", 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 },
    :grant_cluster_admin => { kind: :method, name: "grantClusterAdmin", is_optional: false },
  }
end

.PROPERTY_INJECTION_IDString

Uniquely identifies this class.

Returns:

  • (String)


133
134
135
# File 'ek_sv2/cluster.rb', line 133

def self.PROPERTY_INJECTION_ID()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_eks_v2.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.



405
406
407
408
409
410
# File 'ek_sv2/cluster.rb', line 405

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::EKSv2::AutoScalingGroupCapacityOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLkF1dG9TY2FsaW5nR3JvdXBDYXBhY2l0eU9wdGlvbnMifQ==")), "options")
  jsii_call_method("addAutoScalingGroupCapacity", [id, options])
end

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

Defines a CDK8s chart in this cluster.

Parameters:

Returns:



418
419
420
421
422
423
424
# File 'ek_sv2/cluster.rb', line 418

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::EKSv2::KubernetesManifestOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLkt1YmVybmV0ZXNNYW5pZmVzdE9wdGlvbnMifQ==")), "options") unless options.nil?
  jsii_call_method("addCdk8sChart", [id, chart, options])
end

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

Adds a Fargate profile to this cluster.

Parameters:

Returns:

See Also:



432
433
434
435
436
437
# File 'ek_sv2/cluster.rb', line 432

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

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

Defines a Helm chart in this cluster.

Parameters:

Returns:



444
445
446
447
448
449
# File 'ek_sv2/cluster.rb', line 444

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

#add_manifest(id, *manifest) ⇒ AWSCDK::EKSv2::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:



458
459
460
461
462
463
464
# File 'ek_sv2/cluster.rb', line 458

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::EKSv2::Nodegroup

Add managed nodegroup to this Amazon EKS cluster.

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

Parameters:

Returns:

See Also:



474
475
476
477
478
479
# File 'ek_sv2/cluster.rb', line 474

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::EKSv2::NodegroupOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLk5vZGVncm91cE9wdGlvbnMifQ==")), "options") unless options.nil?
  jsii_call_method("addNodegroupCapacity", [id, options])
end

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

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

Parameters:

Returns:



486
487
488
489
490
491
# File 'ek_sv2/cluster.rb', line 486

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

#alb_controllerAWSCDK::EKSv2::ALBController?

The ALB Controller construct defined for this cluster.

Will be undefined if alb_controller wasn't configured.



251
252
253
# File 'ek_sv2/cluster.rb', line 251

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:



336
337
338
339
# File 'ek_sv2/cluster.rb', line 336

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:



353
354
355
356
# File 'ek_sv2/cluster.rb', line 353

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

#cluster_arnString

The AWS generated ARN for the Cluster resource.

For example, arn:aws:eks:us-west-2:666666666666:cluster/prod

Returns:

  • (String)


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

def cluster_arn()
  jsii_get_property("clusterArn")
end

#cluster_certificate_authority_dataString

The certificate-authority-data for your cluster.

Returns:

  • (String)


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

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)


156
157
158
# File 'ek_sv2/cluster.rb', line 156

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)


167
168
169
# File 'ek_sv2/cluster.rb', line 167

def cluster_endpoint()
  jsii_get_property("clusterEndpoint")
end

#cluster_nameString

The Name of the created EKS Cluster.

Returns:

  • (String)


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

def cluster_name()
  jsii_get_property("clusterName")
end

#cluster_open_id_connect_issuer_urlString

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

If this cluster is not kubectl-enabled (i.e. uses the stock CfnCluster), this is undefined.

Returns:

  • (String)


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

def cluster_open_id_connect_issuer_url()
  jsii_get_property("clusterOpenIdConnectIssuerUrl")
end

#cluster_refAWSCDK::Interfaces::AWSEKS::ClusterReference

A reference to a Cluster resource.



191
192
193
# File 'ek_sv2/cluster.rb', line 191

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.



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

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)


205
206
207
# File 'ek_sv2/cluster.rb', line 205

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.

Prefer to use add_auto_scaling_group_capacity if possible.

Parameters:

See Also:



506
507
508
509
510
511
# File 'ek_sv2/cluster.rb', line 506

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::EKSv2::AutoScalingGroupOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLkF1dG9TY2FsaW5nR3JvdXBPcHRpb25zIn0=")), "options")
  jsii_call_method("connectAutoScalingGroupCapacity", [auto_scaling_group, options])
end

#connectionsAWSCDK::EC2::Connections

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



212
213
214
# File 'ek_sv2/cluster.rb', line 212

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.



261
262
263
# File 'ek_sv2/cluster.rb', line 261

def default_capacity()
  jsii_get_property("defaultCapacity")
end

#default_nodegroupAWSCDK::EKSv2::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:



271
272
273
# File 'ek_sv2/cluster.rb', line 271

def default_nodegroup()
  jsii_get_property("defaultNodegroup")
end

#eks_pod_identity_agentAWSCDK::EKSv2::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:



283
284
285
# File 'ek_sv2/cluster.rb', line 283

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.



105
106
107
# File 'ek_sv2/cluster.rb', line 105

def env()
  jsii_get_property("env")
end

#generate_physical_nameString

Returns:

  • (String)


359
360
361
# File 'ek_sv2/cluster.rb', line 359

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)


518
519
520
521
522
523
# File 'ek_sv2/cluster.rb', line 518

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::EKSv2::IngressLoadBalancerAddressOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLkluZ3Jlc3NMb2FkQmFsYW5jZXJBZGRyZXNzT3B0aW9ucyJ9")), "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)


373
374
375
376
377
378
# File 'ek_sv2/cluster.rb', line 373

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)


388
389
390
391
# File 'ek_sv2/cluster.rb', line 388

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)


530
531
532
533
534
535
# File 'ek_sv2/cluster.rb', line 530

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::EKSv2::ServiceLoadBalancerAddressOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLlNlcnZpY2VMb2FkQmFsYW5jZXJBZGRyZXNzT3B0aW9ucyJ9")), "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. [disable-awslint:no-grants]

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::EKSv2::IAccessPolicy>)
    • An array of IAccessPolicy objects that define the access permissions to be granted to the IAM principal.
  • options (AWSCDK::EKSv2::GrantAccessOptions, nil) (defaults to: nil)
    • Additional options for granting access.


549
550
551
552
553
554
555
556
# File 'ek_sv2/cluster.rb', line 549

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("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19la3NfdjIuSUFjY2Vzc1BvbGljeSJ9LCJraW5kIjoiYXJyYXkifX0=")), "accessPolicies")
  options = options.is_a?(Hash) ? ::AWSCDK::EKSv2::GrantAccessOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLkdyYW50QWNjZXNzT3B0aW9ucyJ9")), "options") unless options.nil?
  jsii_call_method("grantAccess", [id, principal, access_policies, options])
end

#grant_cluster_admin(id, principal) ⇒ AWSCDK::EKSv2::AccessEntry

Grants the specified IAM principal cluster admin access to the EKS cluster.

This method creates an AccessEntry construct that grants the specified IAM principal the cluster admin access permissions. This allows the IAM principal to perform the actions permitted by the cluster admin access. [disable-awslint:no-grants]

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.

Returns:



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

def grant_cluster_admin(id, principal)
  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_call_method("grantClusterAdmin", [id, principal])
end

#ip_familyAWSCDK::EKSv2::IPFamily?

Note:

Default: IpFamily.IP_V4

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



292
293
294
# File 'ek_sv2/cluster.rb', line 292

def ip_family()
  jsii_get_property("ipFamily")
end

#kubectl_providerAWSCDK::EKSv2::IKubectlProvider?

KubectlProvider for issuing kubectl commands.



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

def kubectl_provider()
  jsii_get_property("kubectlProvider")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


90
91
92
# File 'ek_sv2/cluster.rb', line 90

def node()
  jsii_get_property("node")
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).



221
222
223
# File 'ek_sv2/cluster.rb', line 221

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)


119
120
121
# File 'ek_sv2/cluster.rb', line 119

def physical_name()
  jsii_get_property("physicalName")
end

#pruneBoolean

Determines if Kubernetes resources can be pruned automatically.

Returns:

  • (Boolean)


228
229
230
# File 'ek_sv2/cluster.rb', line 228

def prune()
  jsii_get_property("prune")
end

#roleAWSCDK::IAM::IRole

IAM role assumed by the EKS Control Plane.

Returns:



235
236
237
# File 'ek_sv2/cluster.rb', line 235

def role()
  jsii_get_property("role")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



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

def stack()
  jsii_get_property("stack")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


306
307
308
# File 'ek_sv2/cluster.rb', line 306

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

#vpcAWSCDK::EC2::IVPC

The VPC in which this Cluster was created.

Returns:



242
243
244
# File 'ek_sv2/cluster.rb', line 242

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)


319
320
321
322
323
324
# File 'ek_sv2/cluster.rb', line 319

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