Class: AWSCDK::EKS::ClusterAttributes

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

Overview

Attributes for EKS clusters.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cluster_name:, awscli_layer: nil, cluster_certificate_authority_data: nil, cluster_encryption_config_key_arn: nil, cluster_endpoint: nil, cluster_handler_security_group_id: nil, cluster_security_group_id: nil, ip_family: nil, kubectl_environment: nil, kubectl_lambda_role: nil, kubectl_layer: nil, kubectl_memory: nil, kubectl_private_subnet_ids: nil, kubectl_provider: nil, kubectl_role_arn: nil, kubectl_security_group_id: nil, on_event_layer: nil, open_id_connect_provider: nil, prune: nil, security_group_ids: nil, vpc: nil) ⇒ ClusterAttributes

Returns a new instance of ClusterAttributes.

Parameters:

  • cluster_name (String)

    The physical name of the Cluster.

  • awscli_layer (AWSCDK::Lambda::ILayerVersion, nil) (defaults to: nil)

    An AWS Lambda layer that contains the aws CLI.

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

    The certificate-authority-data for your cluster.

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

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

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

    The API Server endpoint URL.

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

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

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

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

  • ip_family (AWSCDK::EKS::IPFamily, nil) (defaults to: nil)

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

  • kubectl_environment (Hash{String => String}, nil) (defaults to: nil)

    Environment variables to use when running kubectl against this cluster.

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

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

  • kubectl_layer (AWSCDK::Lambda::ILayerVersion, nil) (defaults to: nil)

    An AWS Lambda Layer which includes kubectl and Helm.

  • kubectl_memory (AWSCDK::Size, nil) (defaults to: nil)

    Amount of memory to allocate to the provider's lambda function.

  • kubectl_private_subnet_ids (Array<String>, nil) (defaults to: nil)

    Subnets to host the kubectl compute resources.

  • kubectl_provider (AWSCDK::EKS::IKubectlProvider, nil) (defaults to: nil)

    KubectlProvider for issuing kubectl commands.

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

    An IAM role with cluster administrator and "system:masters" permissions.

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

    A security group to use for kubectl execution.

  • on_event_layer (AWSCDK::Lambda::ILayerVersion, nil) (defaults to: nil)

    An AWS Lambda Layer which includes the NPM dependency proxy-agent.

  • open_id_connect_provider (AWSCDK::IAM::IOpenIdConnectProvider, nil) (defaults to: nil)

    An Open ID Connect provider for this cluster that can be used to configure service accounts.

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

    Indicates whether Kubernetes resources added through addManifest() can be automatically pruned.

  • security_group_ids (Array<String>, nil) (defaults to: nil)

    Additional security groups associated with this cluster.

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

    The VPC in which this Cluster was created.



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 'eks/cluster_attributes.rb', line 28

def initialize(cluster_name:, awscli_layer: nil, cluster_certificate_authority_data: nil, cluster_encryption_config_key_arn: nil, cluster_endpoint: nil, cluster_handler_security_group_id: nil, cluster_security_group_id: nil, ip_family: nil, kubectl_environment: nil, kubectl_lambda_role: nil, kubectl_layer: nil, kubectl_memory: nil, kubectl_private_subnet_ids: nil, kubectl_provider: nil, kubectl_role_arn: nil, kubectl_security_group_id: nil, on_event_layer: nil, open_id_connect_provider: nil, prune: nil, security_group_ids: nil, vpc: nil)
  @cluster_name = cluster_name
  Jsii::Type.check_type(@cluster_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "clusterName")
  @awscli_layer = awscli_layer
  Jsii::Type.check_type(@awscli_layer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklMYXllclZlcnNpb24ifQ==")), "awscliLayer") unless @awscli_layer.nil?
  @cluster_certificate_authority_data = cluster_certificate_authority_data
  Jsii::Type.check_type(@cluster_certificate_authority_data, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "clusterCertificateAuthorityData") unless @cluster_certificate_authority_data.nil?
  @cluster_encryption_config_key_arn = cluster_encryption_config_key_arn
  Jsii::Type.check_type(@cluster_encryption_config_key_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "clusterEncryptionConfigKeyArn") unless @cluster_encryption_config_key_arn.nil?
  @cluster_endpoint = cluster_endpoint
  Jsii::Type.check_type(@cluster_endpoint, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "clusterEndpoint") unless @cluster_endpoint.nil?
  @cluster_handler_security_group_id = cluster_handler_security_group_id
  Jsii::Type.check_type(@cluster_handler_security_group_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "clusterHandlerSecurityGroupId") unless @cluster_handler_security_group_id.nil?
  @cluster_security_group_id = cluster_security_group_id
  Jsii::Type.check_type(@cluster_security_group_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "clusterSecurityGroupId") unless @cluster_security_group_id.nil?
  @ip_family = ip_family
  Jsii::Type.check_type(@ip_family, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLklwRmFtaWx5In0=")), "ipFamily") unless @ip_family.nil?
  @kubectl_environment = kubectl_environment
  Jsii::Type.check_type(@kubectl_environment, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "kubectlEnvironment") unless @kubectl_environment.nil?
  @kubectl_lambda_role = kubectl_lambda_role
  Jsii::Type.check_type(@kubectl_lambda_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "kubectlLambdaRole") unless @kubectl_lambda_role.nil?
  @kubectl_layer = kubectl_layer
  Jsii::Type.check_type(@kubectl_layer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklMYXllclZlcnNpb24ifQ==")), "kubectlLayer") unless @kubectl_layer.nil?
  @kubectl_memory = kubectl_memory
  Jsii::Type.check_type(@kubectl_memory, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplIn0=")), "kubectlMemory") unless @kubectl_memory.nil?
  @kubectl_private_subnet_ids = kubectl_private_subnet_ids
  Jsii::Type.check_type(@kubectl_private_subnet_ids, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "kubectlPrivateSubnetIds") unless @kubectl_private_subnet_ids.nil?
  @kubectl_provider = kubectl_provider
  Jsii::Type.check_type(@kubectl_provider, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLklLdWJlY3RsUHJvdmlkZXIifQ==")), "kubectlProvider") unless @kubectl_provider.nil?
  @kubectl_role_arn = kubectl_role_arn
  Jsii::Type.check_type(@kubectl_role_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "kubectlRoleArn") unless @kubectl_role_arn.nil?
  @kubectl_security_group_id = kubectl_security_group_id
  Jsii::Type.check_type(@kubectl_security_group_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "kubectlSecurityGroupId") unless @kubectl_security_group_id.nil?
  @on_event_layer = on_event_layer
  Jsii::Type.check_type(@on_event_layer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklMYXllclZlcnNpb24ifQ==")), "onEventLayer") unless @on_event_layer.nil?
  @open_id_connect_provider = open_id_connect_provider
  Jsii::Type.check_type(@open_id_connect_provider, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklPcGVuSWRDb25uZWN0UHJvdmlkZXIifQ==")), "openIdConnectProvider") unless @open_id_connect_provider.nil?
  @prune = prune
  Jsii::Type.check_type(@prune, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "prune") unless @prune.nil?
  @security_group_ids = security_group_ids
  Jsii::Type.check_type(@security_group_ids, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "securityGroupIds") unless @security_group_ids.nil?
  @vpc = vpc
  Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") unless @vpc.nil?
end

Instance Attribute Details

#awscli_layerAWSCDK::Lambda::ILayerVersion? (readonly)

Note:

Default: - a default layer with the AWS CLI 1.x

An AWS Lambda layer that contains the aws CLI.

The handler expects the layer to include the following executables:

/opt/awscli/aws


87
88
89
# File 'eks/cluster_attributes.rb', line 87

def awscli_layer
  @awscli_layer
end

#cluster_certificate_authority_dataString? (readonly)

Note:

Default: - if not specified cluster.clusterCertificateAuthorityData will throw an error

The certificate-authority-data for your cluster.

Returns:

  • (String, nil)


92
93
94
# File 'eks/cluster_attributes.rb', line 92

def cluster_certificate_authority_data
  @cluster_certificate_authority_data
end

#cluster_encryption_config_key_arnString? (readonly)

Note:

Default: - if not specified cluster.clusterEncryptionConfigKeyArn will throw an error

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

Returns:

  • (String, nil)


97
98
99
# File 'eks/cluster_attributes.rb', line 97

def cluster_encryption_config_key_arn
  @cluster_encryption_config_key_arn
end

#cluster_endpointString? (readonly)

Note:

Default: - if not specified cluster.clusterEndpoint will throw an error.

The API Server endpoint URL.

Returns:

  • (String, nil)


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

def cluster_endpoint
  @cluster_endpoint
end

#cluster_handler_security_group_idString? (readonly)

Note:

Default: - No security group.

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

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

Returns:

  • (String, nil)


109
110
111
# File 'eks/cluster_attributes.rb', line 109

def cluster_handler_security_group_id
  @cluster_handler_security_group_id
end

#cluster_nameString (readonly)

The physical name of the Cluster.

Returns:

  • (String)


76
77
78
# File 'eks/cluster_attributes.rb', line 76

def cluster_name
  @cluster_name
end

#cluster_security_group_idString? (readonly)

Note:

Default: - if not specified cluster.clusterSecurityGroupId will throw an error

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

Returns:

  • (String, nil)


114
115
116
# File 'eks/cluster_attributes.rb', line 114

def cluster_security_group_id
  @cluster_security_group_id
end

#ip_familyAWSCDK::EKS::IPFamily? (readonly)

Note:

Default: - IpFamily.IP_V4

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



120
121
122
# File 'eks/cluster_attributes.rb', line 120

def ip_family
  @ip_family
end

#kubectl_environmentHash{String => String}? (readonly)

Note:

Default: - no additional variables

Environment variables to use when running kubectl against this cluster.

Returns:

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


125
126
127
# File 'eks/cluster_attributes.rb', line 125

def kubectl_environment
  @kubectl_environment
end

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

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:



135
136
137
# File 'eks/cluster_attributes.rb', line 135

def kubectl_lambda_role
  @kubectl_lambda_role
end

#kubectl_layerAWSCDK::Lambda::ILayerVersion? (readonly)

Note:

Default: - No default layer will be provided

An AWS Lambda Layer which includes kubectl and Helm.

This layer is used by the kubectl handler to apply manifests and install helm charts. You must pick an appropriate releases of one of the @aws-cdk/layer-kubectl-vXX packages, that works with the version of Kubernetes you have chosen.

The handler expects the layer to include the following executables:

/opt/helm/helm
/opt/kubectl/kubectl


152
153
154
# File 'eks/cluster_attributes.rb', line 152

def kubectl_layer
  @kubectl_layer
end

#kubectl_memoryAWSCDK::Size? (readonly)

Note:

Default: Size.gibibytes(1)

Amount of memory to allocate to the provider's lambda function.

Returns:



157
158
159
# File 'eks/cluster_attributes.rb', line 157

def kubectl_memory
  @kubectl_memory
end

#kubectl_private_subnet_idsArray<String>? (readonly)

Note:

Default: - k8s endpoint is expected to be accessible publicly

Subnets to host the kubectl compute resources.

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

Returns:

  • (Array<String>, nil)


165
166
167
# File 'eks/cluster_attributes.rb', line 165

def kubectl_private_subnet_ids
  @kubectl_private_subnet_ids
end

#kubectl_providerAWSCDK::EKS::IKubectlProvider? (readonly)

Note:

Default: - Default CDK provider

KubectlProvider for issuing kubectl commands.



170
171
172
# File 'eks/cluster_attributes.rb', line 170

def kubectl_provider
  @kubectl_provider
end

#kubectl_role_arnString? (readonly)

Note:

Default: - if not specified, it not be possible to issue kubectl commands against an imported cluster.

An IAM role with cluster administrator and "system:masters" permissions.

Returns:

  • (String, nil)


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

def kubectl_role_arn
  @kubectl_role_arn
end

#kubectl_security_group_idString? (readonly)

Note:

Default: - k8s endpoint is expected to be accessible publicly

A security group to use for kubectl execution.

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

Returns:

  • (String, nil)


183
184
185
# File 'eks/cluster_attributes.rb', line 183

def kubectl_security_group_id
  @kubectl_security_group_id
end

#on_event_layerAWSCDK::Lambda::ILayerVersion? (readonly)

Note:

Default: - a layer bundled with this module.

An AWS Lambda Layer which includes the NPM dependency proxy-agent.

This layer is used by the onEvent handler to route AWS SDK requests through a proxy.

The handler expects the layer to include the following node_modules:

proxy-agent



195
196
197
# File 'eks/cluster_attributes.rb', line 195

def on_event_layer
  @on_event_layer
end

#open_id_connect_providerAWSCDK::IAM::IOpenIdConnectProvider? (readonly)

Note:

Default: - if not specified cluster.openIdConnectProvider and cluster.addServiceAccount will throw an error.

An Open ID Connect provider for this cluster that can be used to configure service accounts.

You can either import an existing provider using iam.OpenIdConnectProvider.fromProviderArn, or create a new provider using new eks.OpenIdConnectProvider



203
204
205
# File 'eks/cluster_attributes.rb', line 203

def open_id_connect_provider
  @open_id_connect_provider
end

#pruneBoolean? (readonly)

Note:

Default: true

Indicates whether Kubernetes resources added through addManifest() 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, nil)


212
213
214
# File 'eks/cluster_attributes.rb', line 212

def prune
  @prune
end

#security_group_idsArray<String>? (readonly)

Note:

Default: - if not specified, no additional security groups will be considered in cluster.connections.

Additional security groups associated with this cluster.

Returns:

  • (Array<String>, nil)


217
218
219
# File 'eks/cluster_attributes.rb', line 217

def security_group_ids
  @security_group_ids
end

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

Note:

Default: - if not specified cluster.vpc will throw an error

The VPC in which this Cluster was created.

Returns:



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

def vpc
  @vpc
end

Class Method Details

.jsii_propertiesObject



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'eks/cluster_attributes.rb', line 224

def self.jsii_properties
  {
    :cluster_name => "clusterName",
    :awscli_layer => "awscliLayer",
    :cluster_certificate_authority_data => "clusterCertificateAuthorityData",
    :cluster_encryption_config_key_arn => "clusterEncryptionConfigKeyArn",
    :cluster_endpoint => "clusterEndpoint",
    :cluster_handler_security_group_id => "clusterHandlerSecurityGroupId",
    :cluster_security_group_id => "clusterSecurityGroupId",
    :ip_family => "ipFamily",
    :kubectl_environment => "kubectlEnvironment",
    :kubectl_lambda_role => "kubectlLambdaRole",
    :kubectl_layer => "kubectlLayer",
    :kubectl_memory => "kubectlMemory",
    :kubectl_private_subnet_ids => "kubectlPrivateSubnetIds",
    :kubectl_provider => "kubectlProvider",
    :kubectl_role_arn => "kubectlRoleArn",
    :kubectl_security_group_id => "kubectlSecurityGroupId",
    :on_event_layer => "onEventLayer",
    :open_id_connect_provider => "openIdConnectProvider",
    :prune => "prune",
    :security_group_ids => "securityGroupIds",
    :vpc => "vpc",
  }
end

Instance Method Details

#to_jsiiObject



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'eks/cluster_attributes.rb', line 250

def to_jsii
  result = {}
  result.merge!({
    "clusterName" => @cluster_name,
    "awscliLayer" => @awscli_layer,
    "clusterCertificateAuthorityData" => @cluster_certificate_authority_data,
    "clusterEncryptionConfigKeyArn" => @cluster_encryption_config_key_arn,
    "clusterEndpoint" => @cluster_endpoint,
    "clusterHandlerSecurityGroupId" => @cluster_handler_security_group_id,
    "clusterSecurityGroupId" => @cluster_security_group_id,
    "ipFamily" => @ip_family,
    "kubectlEnvironment" => @kubectl_environment,
    "kubectlLambdaRole" => @kubectl_lambda_role,
    "kubectlLayer" => @kubectl_layer,
    "kubectlMemory" => @kubectl_memory,
    "kubectlPrivateSubnetIds" => @kubectl_private_subnet_ids,
    "kubectlProvider" => @kubectl_provider,
    "kubectlRoleArn" => @kubectl_role_arn,
    "kubectlSecurityGroupId" => @kubectl_security_group_id,
    "onEventLayer" => @on_event_layer,
    "openIdConnectProvider" => @open_id_connect_provider,
    "prune" => @prune,
    "securityGroupIds" => @security_group_ids,
    "vpc" => @vpc,
  })
  result.compact
end