Class: AWSCDK::EKS::FargateProfileProps

Inherits:
FargateProfileOptions
  • Object
show all
Defined in:
eks/fargate_profile_props.rb

Overview

Configuration props for EKS Fargate Profiles.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(selectors:, fargate_profile_name: nil, pod_execution_role: nil, removal_policy: nil, subnet_selection: nil, vpc: nil, cluster:) ⇒ FargateProfileProps

Returns a new instance of FargateProfileProps.

Parameters:

  • selectors (Array<AWSCDK::EKS::Selector>)

    The selectors to match for pods to use this Fargate profile.

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

    The name of the Fargate profile.

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

    The pod execution role to use for pods that match the selectors in the Fargate profile.

  • removal_policy (AWSCDK::RemovalPolicy, nil) (defaults to: nil)

    The removal policy applied to the custom resource that manages the Fargate profile.

  • subnet_selection (AWSCDK::EC2::SubnetSelection, nil) (defaults to: nil)

    Select which subnets to launch your pods into.

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

    The VPC from which to select subnets to launch your pods into.

  • cluster (AWSCDK::EKS::Cluster)

    The EKS cluster to apply the Fargate profile to.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'eks/fargate_profile_props.rb', line 14

def initialize(selectors:, fargate_profile_name: nil, pod_execution_role: nil, removal_policy: nil, subnet_selection: nil, vpc: nil, cluster:)
  @selectors = selectors.is_a?(Array) ? selectors.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::EKS::Selector.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : selectors
  Jsii::Type.check_type(@selectors, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19la3MuU2VsZWN0b3IifSwia2luZCI6ImFycmF5In19")), "selectors")
  @fargate_profile_name = fargate_profile_name
  Jsii::Type.check_type(@fargate_profile_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "fargateProfileName") unless @fargate_profile_name.nil?
  @pod_execution_role = pod_execution_role
  Jsii::Type.check_type(@pod_execution_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "podExecutionRole") unless @pod_execution_role.nil?
  @removal_policy = removal_policy
  Jsii::Type.check_type(@removal_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "removalPolicy") unless @removal_policy.nil?
  @subnet_selection = subnet_selection.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**subnet_selection.transform_keys(&:to_sym)) : subnet_selection
  Jsii::Type.check_type(@subnet_selection, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "subnetSelection") unless @subnet_selection.nil?
  @vpc = vpc
  Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") unless @vpc.nil?
  @cluster = cluster
  Jsii::Type.check_type(@cluster, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkNsdXN0ZXIifQ==")), "cluster")
end

Instance Attribute Details

#clusterAWSCDK::EKS::Cluster (readonly)

The EKS cluster to apply the Fargate profile to.

[disable-awslint:ref-via-interface]



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

def cluster
  @cluster
end

#fargate_profile_nameString? (readonly)

Note:

Default: - generated

The name of the Fargate profile.

Returns:

  • (String, nil)


45
46
47
# File 'eks/fargate_profile_props.rb', line 45

def fargate_profile_name
  @fargate_profile_name
end

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

Note:

Default: - a role will be automatically created

The pod execution role to use for pods that match the selectors in the Fargate profile.

The pod execution role allows Fargate infrastructure to register with your cluster as a node, and it provides read access to Amazon ECR image repositories.



55
56
57
# File 'eks/fargate_profile_props.rb', line 55

def pod_execution_role
  @pod_execution_role
end

#removal_policyAWSCDK::RemovalPolicy? (readonly)

Note:

Default: RemovalPolicy.DESTROY

The removal policy applied to the custom resource that manages the Fargate profile.

The removal policy controls what happens to the resource if it stops being managed by CloudFormation. This can happen in one of three situations:

  • The resource is removed from the template, so CloudFormation stops managing it
  • A change to the resource is made that requires it to be replaced, so CloudFormation stops managing it
  • The stack is deleted, so CloudFormation stops managing all resources in it

Returns:



67
68
69
# File 'eks/fargate_profile_props.rb', line 67

def removal_policy
  @removal_policy
end

#selectorsArray<AWSCDK::EKS::Selector> (readonly)

The selectors to match for pods to use this Fargate profile.

Each selector must have an associated namespace. Optionally, you can also specify labels for a namespace.

At least one selector is required and you may specify up to five selectors.

Returns:



40
41
42
# File 'eks/fargate_profile_props.rb', line 40

def selectors
  @selectors
end

#subnet_selectionAWSCDK::EC2::SubnetSelection? (readonly)

Note:

Default: - all private subnets of the VPC are selected.

Select which subnets to launch your pods into.

At this time, pods running on Fargate are not assigned public IP addresses, so only private subnets (with no direct route to an Internet Gateway) are allowed.

You must specify the VPC to customize the subnet selection



78
79
80
# File 'eks/fargate_profile_props.rb', line 78

def subnet_selection
  @subnet_selection
end

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

Note:

Default: - all private subnets used by the EKS cluster

The VPC from which to select subnets to launch your pods into.

By default, all private subnets are selected. You can customize this using subnet_selection.

Returns:



86
87
88
# File 'eks/fargate_profile_props.rb', line 86

def vpc
  @vpc
end

Class Method Details

.jsii_propertiesObject



94
95
96
97
98
99
100
101
102
103
104
# File 'eks/fargate_profile_props.rb', line 94

def self.jsii_properties
  {
    :selectors => "selectors",
    :fargate_profile_name => "fargateProfileName",
    :pod_execution_role => "podExecutionRole",
    :removal_policy => "removalPolicy",
    :subnet_selection => "subnetSelection",
    :vpc => "vpc",
    :cluster => "cluster",
  }
end

Instance Method Details

#to_jsiiObject



106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'eks/fargate_profile_props.rb', line 106

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "selectors" => @selectors,
    "fargateProfileName" => @fargate_profile_name,
    "podExecutionRole" => @pod_execution_role,
    "removalPolicy" => @removal_policy,
    "subnetSelection" => @subnet_selection,
    "vpc" => @vpc,
    "cluster" => @cluster,
  })
  result.compact
end