Module: AWSCDK::EKS::ICluster
- Includes:
- AWSCDK::EC2::IConnectable, IResource, Interfaces::AWSEKS::IClusterRef
- Included in:
- Cluster
- Defined in:
- eks/i_cluster.rb
Overview
An EKS cluster.
Class Method Summary collapse
Instance Method Summary collapse
-
#add_cdk8s_chart(id, chart, options = nil) ⇒ AWSCDK::EKS::KubernetesManifest
Defines a CDK8s chart in this cluster.
-
#add_helm_chart(id, options) ⇒ AWSCDK::EKS::HelmChart
Defines a Helm chart in this cluster.
-
#add_manifest(id, *manifest) ⇒ AWSCDK::EKS::KubernetesManifest
Defines a Kubernetes resource in this cluster.
-
#add_service_account(id, options = nil) ⇒ AWSCDK::EKS::ServiceAccount
Creates a new service account with corresponding IAM Role (IRSA).
-
#apply_removal_policy(policy) ⇒ void
Apply the given removal policy to this resource.
-
#authentication_mode ⇒ AWSCDK::EKS::AuthenticationMode?
The authentication mode for the cluster.
-
#awscli_layer ⇒ AWSCDK::Lambda::ILayerVersion?
An AWS Lambda layer that contains the
awsCLI. -
#cluster_arn ⇒ String
The unique ARN assigned to the service by AWS in the form of arn:aws:eks:.
-
#cluster_certificate_authority_data ⇒ String
The certificate-authority-data for your cluster.
-
#cluster_encryption_config_key_arn ⇒ String
Amazon Resource Name (ARN) or alias of the customer master key (CMK).
-
#cluster_endpoint ⇒ String
The API Server endpoint URL.
-
#cluster_handler_security_group ⇒ AWSCDK::EC2::ISecurityGroup?
A security group to associate with the Cluster Handler's Lambdas.
-
#cluster_name ⇒ String
The physical name of the Cluster.
-
#cluster_ref ⇒ AWSCDK::Interfaces::AWSEKS::ClusterReference
A reference to a Cluster resource.
-
#cluster_security_group ⇒ AWSCDK::EC2::ISecurityGroup
The cluster security group that was created by Amazon EKS for the cluster.
-
#cluster_security_group_id ⇒ String
The id of the cluster security group that was created by Amazon EKS for the cluster.
-
#connect_auto_scaling_group_capacity(auto_scaling_group, options) ⇒ void
Connect capacity in the form of an existing AutoScalingGroup to the EKS cluster.
-
#connections ⇒ AWSCDK::EC2::Connections
The network connections associated with this resource.
-
#eks_pod_identity_agent ⇒ AWSCDK::EKS::IAddon?
The EKS Pod Identity Agent addon for the EKS cluster.
-
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
-
#ip_family ⇒ AWSCDK::EKS::IPFamily?
Specify which IP family is used to assign Kubernetes pod and service IP addresses.
-
#kubectl_environment ⇒ Hash{String => String}?
Custom environment variables when running
kubectlagainst this cluster. -
#kubectl_lambda_role ⇒ AWSCDK::IAM::IRole?
An IAM role that can perform kubectl operations against this cluster.
-
#kubectl_layer ⇒ AWSCDK::Lambda::ILayerVersion?
An AWS Lambda layer that includes
kubectlandhelm. -
#kubectl_memory ⇒ AWSCDK::Size?
Amount of memory to allocate to the provider's lambda function.
-
#kubectl_private_subnets ⇒ Array<AWSCDK::EC2::ISubnet>?
Subnets to host the
kubectlcompute resources. -
#kubectl_provider ⇒ AWSCDK::EKS::IKubectlProvider?
Kubectl Provider for issuing kubectl commands against it.
-
#kubectl_role ⇒ AWSCDK::IAM::IRole?
An IAM role that can perform kubectl operations against this cluster.
-
#kubectl_security_group ⇒ AWSCDK::EC2::ISecurityGroup?
A security group to use for
kubectlexecution. -
#node ⇒ Constructs::Node
The tree node.
-
#on_event_layer ⇒ AWSCDK::Lambda::ILayerVersion?
An AWS Lambda layer that includes the NPM dependency
proxy-agent. -
#open_id_connect_provider ⇒ AWSCDK::IAM::IOpenIdConnectProvider
The Open ID Connect Provider of the cluster used to configure Service Accounts.
-
#prune ⇒ Boolean
Indicates whether Kubernetes resources can be automatically pruned.
-
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
-
#vpc ⇒ AWSCDK::EC2::IVPC
The VPC in which this Cluster was created.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Class Method Details
.jsii_overridable_methods ⇒ Object
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
# File 'eks/i_cluster.rb', line 370 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 }, :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 }, :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_provider => { kind: :property, name: "kubectlProvider", 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 }, :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::EKS::KubernetesManifest
Defines a CDK8s chart in this cluster.
297 298 299 300 301 302 303 |
# File 'eks/i_cluster.rb', line 297 def add_cdk8s_chart(id, chart, = 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") = .is_a?(Hash) ? ::AWSCDK::EKS::KubernetesManifestOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkt1YmVybmV0ZXNNYW5pZmVzdE9wdGlvbnMifQ==")), "options") unless .nil? jsii_call_method("addCdk8sChart", [id, chart, ]) end |
#add_helm_chart(id, options) ⇒ AWSCDK::EKS::HelmChart
Defines a Helm chart in this cluster.
310 311 312 313 314 315 |
# File 'eks/i_cluster.rb', line 310 def add_helm_chart(id, ) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::EKS::HelmChartOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkhlbG1DaGFydE9wdGlvbnMifQ==")), "options") jsii_call_method("addHelmChart", [id, ]) 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.
324 325 326 327 328 329 330 |
# File 'eks/i_cluster.rb', line 324 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::EKS::ServiceAccount
Creates a new service account with corresponding IAM Role (IRSA).
337 338 339 340 341 342 |
# File 'eks/i_cluster.rb', line 337 def add_service_account(id, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::EKS::ServiceAccountOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLlNlcnZpY2VBY2NvdW50T3B0aW9ucyJ9")), "options") unless .nil? jsii_call_method("addServiceAccount", [id, ]) 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).
286 287 288 289 |
# File 'eks/i_cluster.rb', line 286 def apply_removal_policy(policy) Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy") jsii_call_method("applyRemovalPolicy", [policy]) end |
#authentication_mode ⇒ AWSCDK::EKS::AuthenticationMode?
Default: AuthenticationMode.CONFIG_MAP
The authentication mode for the cluster.
131 132 133 |
# File 'eks/i_cluster.rb', line 131 def authentication_mode() jsii_get_property("authenticationMode") end |
#awscli_layer ⇒ AWSCDK::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.
140 141 142 |
# File 'eks/i_cluster.rb', line 140 def awscli_layer() jsii_get_property("awscliLayer") end |
#cluster_arn ⇒ String
The unique ARN assigned to the service by AWS in the form of arn:aws:eks:.
56 57 58 |
# File 'eks/i_cluster.rb', line 56 def cluster_arn() jsii_get_property("clusterArn") end |
#cluster_certificate_authority_data ⇒ String
The certificate-authority-data for your cluster.
63 64 65 |
# File 'eks/i_cluster.rb', line 63 def () jsii_get_property("clusterCertificateAuthorityData") end |
#cluster_encryption_config_key_arn ⇒ String
Amazon Resource Name (ARN) or alias of the customer master key (CMK).
70 71 72 |
# File 'eks/i_cluster.rb', line 70 def cluster_encryption_config_key_arn() jsii_get_property("clusterEncryptionConfigKeyArn") end |
#cluster_endpoint ⇒ String
The API Server endpoint URL.
77 78 79 |
# File 'eks/i_cluster.rb', line 77 def cluster_endpoint() jsii_get_property("clusterEndpoint") end |
#cluster_handler_security_group ⇒ AWSCDK::EC2::ISecurityGroup?
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.
152 153 154 |
# File 'eks/i_cluster.rb', line 152 def cluster_handler_security_group() jsii_get_property("clusterHandlerSecurityGroup") end |
#cluster_name ⇒ String
The physical name of the Cluster.
84 85 86 |
# File 'eks/i_cluster.rb', line 84 def cluster_name() jsii_get_property("clusterName") end |
#cluster_ref ⇒ AWSCDK::Interfaces::AWSEKS::ClusterReference
A reference to a Cluster resource.
49 50 51 |
# File 'eks/i_cluster.rb', line 49 def cluster_ref() jsii_get_property("clusterRef") end |
#cluster_security_group ⇒ AWSCDK::EC2::ISecurityGroup
The cluster security group that was created by Amazon EKS for the cluster.
91 92 93 |
# File 'eks/i_cluster.rb', line 91 def cluster_security_group() jsii_get_property("clusterSecurityGroup") end |
#cluster_security_group_id ⇒ String
The id of the cluster security group that was created by Amazon EKS for the cluster.
98 99 100 |
# File 'eks/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.
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.
363 364 365 366 367 368 |
# File 'eks/i_cluster.rb', line 363 def connect_auto_scaling_group_capacity(auto_scaling_group, ) Jsii::Type.check_type(auto_scaling_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQXV0b1NjYWxpbmdHcm91cCJ9")), "autoScalingGroup") = .is_a?(Hash) ? ::AWSCDK::EKS::AutoScalingGroupOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkF1dG9TY2FsaW5nR3JvdXBPcHRpb25zIn0=")), "options") jsii_call_method("connectAutoScalingGroupCapacity", [auto_scaling_group, ]) end |
#connections ⇒ AWSCDK::EC2::Connections
The network connections associated with this resource.
42 43 44 |
# File 'eks/i_cluster.rb', line 42 def connections() jsii_get_property("connections") end |
#eks_pod_identity_agent ⇒ AWSCDK::EKS::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.
168 169 170 |
# File 'eks/i_cluster.rb', line 168 def eks_pod_identity_agent() jsii_get_property("eksPodIdentityAgent") end |
#env ⇒ AWSCDK::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 'eks/i_cluster.rb', line 28 def env() jsii_get_property("env") end |
#ip_family ⇒ AWSCDK::EKS::IPFamily?
Default: - IpFamily.IP_V4
Specify which IP family is used to assign Kubernetes pod and service IP addresses.
177 178 179 |
# File 'eks/i_cluster.rb', line 177 def ip_family() jsii_get_property("ipFamily") end |
#kubectl_environment ⇒ Hash{String => String}?
Custom environment variables when running kubectl against this cluster.
184 185 186 |
# File 'eks/i_cluster.rb', line 184 def kubectl_environment() jsii_get_property("kubectlEnvironment") end |
#kubectl_lambda_role ⇒ AWSCDK::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.
This role is directly passed to the lambda handler that sends Kube Ctl commands to the cluster.
195 196 197 |
# File 'eks/i_cluster.rb', line 195 def kubectl_lambda_role() jsii_get_property("kubectlLambdaRole") end |
#kubectl_layer ⇒ AWSCDK::Lambda::ILayerVersion?
An AWS Lambda layer that includes kubectl and helm.
202 203 204 |
# File 'eks/i_cluster.rb', line 202 def kubectl_layer() jsii_get_property("kubectlLayer") end |
#kubectl_memory ⇒ AWSCDK::Size?
Amount of memory to allocate to the provider's lambda function.
209 210 211 |
# File 'eks/i_cluster.rb', line 209 def kubectl_memory() jsii_get_property("kubectlMemory") end |
#kubectl_private_subnets ⇒ Array<AWSCDK::EC2::ISubnet>?
Subnets to host the kubectl compute resources.
If this is undefined, the k8s endpoint is expected to be accessible publicly.
219 220 221 |
# File 'eks/i_cluster.rb', line 219 def kubectl_private_subnets() jsii_get_property("kubectlPrivateSubnets") end |
#kubectl_provider ⇒ AWSCDK::EKS::IKubectlProvider?
Kubectl Provider for issuing kubectl commands against it.
If not defined, a default provider will be used
228 229 230 |
# File 'eks/i_cluster.rb', line 228 def kubectl_provider() jsii_get_property("kubectlProvider") end |
#kubectl_role ⇒ AWSCDK::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.
237 238 239 |
# File 'eks/i_cluster.rb', line 237 def kubectl_role() jsii_get_property("kubectlRole") end |
#kubectl_security_group ⇒ AWSCDK::EC2::ISecurityGroup?
A security group to use for kubectl execution.
If this is undefined, the k8s endpoint is expected to be accessible publicly.
247 248 249 |
# File 'eks/i_cluster.rb', line 247 def kubectl_security_group() jsii_get_property("kubectlSecurityGroup") end |
#node ⇒ Constructs::Node
The tree node.
13 14 15 |
# File 'eks/i_cluster.rb', line 13 def node() jsii_get_property("node") end |
#on_event_layer ⇒ AWSCDK::Lambda::ILayerVersion?
An AWS Lambda layer that includes the NPM dependency proxy-agent.
If not defined, a default layer will be used.
256 257 258 |
# File 'eks/i_cluster.rb', line 256 def on_event_layer() jsii_get_property("onEventLayer") end |
#open_id_connect_provider ⇒ AWSCDK::IAM::IOpenIdConnectProvider
The Open ID Connect Provider of the cluster used to configure Service Accounts.
105 106 107 |
# File 'eks/i_cluster.rb', line 105 def open_id_connect_provider() jsii_get_property("openIdConnectProvider") end |
#prune ⇒ Boolean
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.
116 117 118 |
# File 'eks/i_cluster.rb', line 116 def prune() jsii_get_property("prune") end |
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
35 36 37 |
# File 'eks/i_cluster.rb', line 35 def stack() jsii_get_property("stack") end |
#vpc ⇒ AWSCDK::EC2::IVPC
The VPC in which this Cluster was created.
123 124 125 |
# File 'eks/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.
267 268 269 270 271 272 |
# File 'eks/i_cluster.rb', line 267 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 |