Module: AWSCDK::EKSv2::ICluster

Includes:
AWSCDK::EC2::IConnectable, IResource, Interfaces::AWSEKS::IClusterRef
Included in:
Cluster
Defined in:
ek_sv2/i_cluster.rb

Overview

An EKS cluster.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'ek_sv2/i_cluster.rb', line 275

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :connections => { kind: :property, name: "connections", is_optional: false },
    :cluster_ref => { kind: :property, name: "clusterRef", 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_security_group => { kind: :property, name: "clusterSecurityGroup", is_optional: false },
    :cluster_security_group_id => { kind: :property, name: "clusterSecurityGroupId", is_optional: false },
    :open_id_connect_provider => { kind: :property, name: "openIdConnectProvider", is_optional: false },
    :prune => { kind: :property, name: "prune", is_optional: false },
    :vpc => { kind: :property, name: "vpc", is_optional: false },
    :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 },
    :kubectl_provider_options => { kind: :property, name: "kubectlProviderOptions", is_optional: true },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :add_cdk8s_chart => { kind: :method, name: "addCdk8sChart", is_optional: false },
    :add_helm_chart => { kind: :method, name: "addHelmChart", is_optional: false },
    :add_manifest => { kind: :method, name: "addManifest", 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 },
  }
end

Instance Method Details

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

Defines a CDK8s chart in this cluster.

Parameters:

Returns:



208
209
210
211
212
213
214
# File 'ek_sv2/i_cluster.rb', line 208

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_helm_chart(id, options) ⇒ AWSCDK::EKSv2::HelmChart

Defines a Helm chart in this cluster.

Parameters:

Returns:



221
222
223
224
225
226
# File 'ek_sv2/i_cluster.rb', line 221

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:



235
236
237
238
239
240
241
# File 'ek_sv2/i_cluster.rb', line 235

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_service_account(id, options = nil) ⇒ AWSCDK::EKSv2::ServiceAccount

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

Parameters:

Returns:



248
249
250
251
252
253
# File 'ek_sv2/i_cluster.rb', line 248

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

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



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

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 unique ARN assigned to the service by AWS in the form of arn:aws:eks:.

Returns:

  • (String)


56
57
58
# File 'ek_sv2/i_cluster.rb', line 56

def cluster_arn()
  jsii_get_property("clusterArn")
end

#cluster_certificate_authority_dataString

The certificate-authority-data for your cluster.

Returns:

  • (String)


63
64
65
# File 'ek_sv2/i_cluster.rb', line 63

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)


70
71
72
# File 'ek_sv2/i_cluster.rb', line 70

def cluster_encryption_config_key_arn()
  jsii_get_property("clusterEncryptionConfigKeyArn")
end

#cluster_endpointString

The API Server endpoint URL.

Returns:

  • (String)


77
78
79
# File 'ek_sv2/i_cluster.rb', line 77

def cluster_endpoint()
  jsii_get_property("clusterEndpoint")
end

#cluster_nameString

The physical name of the Cluster.

Returns:

  • (String)


84
85
86
# File 'ek_sv2/i_cluster.rb', line 84

def cluster_name()
  jsii_get_property("clusterName")
end

#cluster_refAWSCDK::Interfaces::AWSEKS::ClusterReference

A reference to a Cluster resource.



49
50
51
# File 'ek_sv2/i_cluster.rb', line 49

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.



91
92
93
# File 'ek_sv2/i_cluster.rb', line 91

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)


98
99
100
# File 'ek_sv2/i_cluster.rb', line 98

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:



268
269
270
271
272
273
# File 'ek_sv2/i_cluster.rb', line 268

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

The network connections associated with this resource.



42
43
44
# File 'ek_sv2/i_cluster.rb', line 42

def connections()
  jsii_get_property("connections")
end

#eks_pod_identity_agentAWSCDK::EKSv2::IAddon?

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.

This property returns the CfnAddon resource representing the EKS Pod Identity Agent addon. If the addon has not been created yet, it will be created and returned.

Returns:



139
140
141
# File 'ek_sv2/i_cluster.rb', line 139

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.



28
29
30
# File 'ek_sv2/i_cluster.rb', line 28

def env()
  jsii_get_property("env")
end

#ip_familyAWSCDK::EKSv2::IPFamily?

Note:

Default: - IpFamily.IP_V4

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



148
149
150
# File 'ek_sv2/i_cluster.rb', line 148

def ip_family()
  jsii_get_property("ipFamily")
end

#kubectl_providerAWSCDK::EKSv2::IKubectlProvider?

Kubectl Provider for issuing kubectl commands against it.

If not defined, a default provider will be used



157
158
159
# File 'ek_sv2/i_cluster.rb', line 157

def kubectl_provider()
  jsii_get_property("kubectlProvider")
end

#kubectl_provider_optionsAWSCDK::EKSv2::KubectlProviderOptions?

Note:

Default: - kubectl provider will not be created

Options for creating the kubectl provider - a lambda function that executes kubectl and helm against the cluster.

If defined, kubectl_layer is a required property.



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

def kubectl_provider_options()
  jsii_get_property("kubectlProviderOptions")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


13
14
15
# File 'ek_sv2/i_cluster.rb', line 13

def node()
  jsii_get_property("node")
end

#open_id_connect_providerAWSCDK::IAM::IOpenIdConnectProvider

The Open ID Connect Provider of the cluster used to configure Service Accounts.



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

def open_id_connect_provider()
  jsii_get_property("openIdConnectProvider")
end

#pruneBoolean

Indicates whether Kubernetes resources can be automatically pruned.

When this is enabled (default), prune labels will be allocated and injected to each resource. These labels will then be used when issuing the kubectl apply operation with the --prune switch.

Returns:

  • (Boolean)


116
117
118
# File 'ek_sv2/i_cluster.rb', line 116

def prune()
  jsii_get_property("prune")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



35
36
37
# File 'ek_sv2/i_cluster.rb', line 35

def stack()
  jsii_get_property("stack")
end

#vpcAWSCDK::EC2::IVPC

The VPC in which this Cluster was created.

Returns:



123
124
125
# File 'ek_sv2/i_cluster.rb', line 123

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.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



178
179
180
181
182
183
# File 'ek_sv2/i_cluster.rb', line 178

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