Class ClusterProps.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<ClusterProps>
- Enclosing interface:
ClusterProps
ClusterProps
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionalbController
(AlbControllerOptions albController) Sets the value ofClusterOptions.getAlbController()
build()
Builds the configured instance.clusterHandlerEnvironment
(Map<String, String> clusterHandlerEnvironment) Sets the value ofClusterOptions.getClusterHandlerEnvironment()
clusterHandlerSecurityGroup
(ISecurityGroup clusterHandlerSecurityGroup) Sets the value ofClusterOptions.getClusterHandlerSecurityGroup()
clusterLogging
(List<? extends ClusterLoggingTypes> clusterLogging) Sets the value ofClusterProps.getClusterLogging()
clusterName
(String clusterName) Sets the value ofCommonClusterOptions.getClusterName()
coreDnsComputeType
(CoreDnsComputeType coreDnsComputeType) Sets the value ofClusterOptions.getCoreDnsComputeType()
defaultCapacity
(Number defaultCapacity) Sets the value ofClusterProps.getDefaultCapacity()
defaultCapacityInstance
(InstanceType defaultCapacityInstance) Sets the value ofClusterProps.getDefaultCapacityInstance()
defaultCapacityType
(DefaultCapacityType defaultCapacityType) Sets the value ofClusterProps.getDefaultCapacityType()
endpointAccess
(EndpointAccess endpointAccess) Sets the value ofClusterOptions.getEndpointAccess()
kubectlEnvironment
(Map<String, String> kubectlEnvironment) Sets the value ofClusterOptions.getKubectlEnvironment()
kubectlLambdaRole
(IRole kubectlLambdaRole) Sets the value ofClusterProps.getKubectlLambdaRole()
kubectlLayer
(ILayerVersion kubectlLayer) Sets the value ofClusterOptions.getKubectlLayer()
kubectlMemory
(Size kubectlMemory) Sets the value ofClusterOptions.getKubectlMemory()
mastersRole
(IRole mastersRole) Sets the value ofClusterOptions.getMastersRole()
onEventLayer
(ILayerVersion onEventLayer) Sets the value ofClusterOptions.getOnEventLayer()
outputClusterName
(Boolean outputClusterName) Sets the value ofCommonClusterOptions.getOutputClusterName()
outputConfigCommand
(Boolean outputConfigCommand) Sets the value ofCommonClusterOptions.getOutputConfigCommand()
outputMastersRoleArn
(Boolean outputMastersRoleArn) Sets the value ofClusterOptions.getOutputMastersRoleArn()
placeClusterHandlerInVpc
(Boolean placeClusterHandlerInVpc) Sets the value ofClusterOptions.getPlaceClusterHandlerInVpc()
Sets the value ofClusterOptions.getPrune()
Sets the value ofCommonClusterOptions.getRole()
secretsEncryptionKey
(IKey secretsEncryptionKey) Sets the value ofClusterOptions.getSecretsEncryptionKey()
securityGroup
(ISecurityGroup securityGroup) Sets the value ofCommonClusterOptions.getSecurityGroup()
serviceIpv4Cidr
(String serviceIpv4Cidr) Sets the value ofClusterOptions.getServiceIpv4Cidr()
Sets the value ofClusterProps.getTags()
version
(KubernetesVersion version) Sets the value ofCommonClusterOptions.getVersion()
Sets the value ofCommonClusterOptions.getVpc()
vpcSubnets
(List<? extends SubnetSelection> vpcSubnets) Sets the value ofCommonClusterOptions.getVpcSubnets()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
clusterLogging
@Stability(Stable) public ClusterProps.Builder clusterLogging(List<? extends ClusterLoggingTypes> clusterLogging) Sets the value ofClusterProps.getClusterLogging()
- Parameters:
clusterLogging
- The cluster log types which you want to enable.- Returns:
this
-
defaultCapacity
Sets the value ofClusterProps.getDefaultCapacity()
- Parameters:
defaultCapacity
- Number of instances to allocate as an initial capacity for this cluster. Instance type can be configured throughdefaultCapacityInstanceType
, which defaults tom5.large
.Use
cluster.addAutoScalingGroupCapacity
to add additional customized capacity. Set this to0
is you wish to avoid the initial capacity allocation.- Returns:
this
-
defaultCapacityInstance
@Stability(Stable) public ClusterProps.Builder defaultCapacityInstance(InstanceType defaultCapacityInstance) Sets the value ofClusterProps.getDefaultCapacityInstance()
- Parameters:
defaultCapacityInstance
- The instance type to use for the default capacity. This will only be taken into account ifdefaultCapacity
is > 0.- Returns:
this
-
defaultCapacityType
@Stability(Stable) public ClusterProps.Builder defaultCapacityType(DefaultCapacityType defaultCapacityType) Sets the value ofClusterProps.getDefaultCapacityType()
- Parameters:
defaultCapacityType
- The default capacity type for the cluster.- Returns:
this
-
kubectlLambdaRole
Sets the value ofClusterProps.getKubectlLambdaRole()
- Parameters:
kubectlLambdaRole
- The IAM role to pass to the Kubectl Lambda Handler.- Returns:
this
-
tags
Sets the value ofClusterProps.getTags()
- Parameters:
tags
- The tags assigned to the EKS cluster.- Returns:
this
-
albController
Sets the value ofClusterOptions.getAlbController()
- Parameters:
albController
- Install the AWS Load Balancer Controller onto the cluster.- Returns:
this
-
clusterHandlerEnvironment
@Stability(Stable) public ClusterProps.Builder clusterHandlerEnvironment(Map<String, String> clusterHandlerEnvironment) Sets the value ofClusterOptions.getClusterHandlerEnvironment()
- Parameters:
clusterHandlerEnvironment
- Custom environment variables when interacting with the EKS endpoint to manage the cluster lifecycle.- Returns:
this
-
clusterHandlerSecurityGroup
@Stability(Stable) public ClusterProps.Builder clusterHandlerSecurityGroup(ISecurityGroup clusterHandlerSecurityGroup) Sets the value ofClusterOptions.getClusterHandlerSecurityGroup()
- Parameters:
clusterHandlerSecurityGroup
- 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
placeClusterHandlerInVpc
to be set to true.- Returns:
this
-
coreDnsComputeType
@Stability(Stable) public ClusterProps.Builder coreDnsComputeType(CoreDnsComputeType coreDnsComputeType) Sets the value ofClusterOptions.getCoreDnsComputeType()
- Parameters:
coreDnsComputeType
- Controls the "eks.amazonaws.com/compute-type" annotation in the CoreDNS configuration on your cluster to determine which compute type to use for CoreDNS.- Returns:
this
-
endpointAccess
Sets the value ofClusterOptions.getEndpointAccess()
- Parameters:
endpointAccess
- Configure access to the Kubernetes API server endpoint..- Returns:
this
-
kubectlEnvironment
@Stability(Stable) public ClusterProps.Builder kubectlEnvironment(Map<String, String> kubectlEnvironment) Sets the value ofClusterOptions.getKubectlEnvironment()
- Parameters:
kubectlEnvironment
- Environment variables for the kubectl execution. Only relevant for kubectl enabled clusters.- Returns:
this
-
kubectlLayer
Sets the value ofClusterOptions.getKubectlLayer()
- Parameters:
kubectlLayer
- An AWS Lambda Layer which includeskubectl
, Helm and the AWS CLI. By default, the provider will use the layer included in the "aws-lambda-layer-kubectl" SAR application which is available in all commercial regions.To deploy the layer locally, visit https://github.com/aws-samples/aws-lambda-layer-kubectl/blob/master/cdk/README.md for instructions on how to prepare the .zip file and then define it in your app as follows:
LayerVersion layer = LayerVersion.Builder.create(this, "kubectl-layer") .code(Code.fromAsset(String.format("%s/layer.zip", __dirname))) .compatibleRuntimes(List.of(Runtime.PROVIDED)) .build();
- Returns:
this
-
kubectlMemory
Sets the value ofClusterOptions.getKubectlMemory()
- Parameters:
kubectlMemory
- Amount of memory to allocate to the provider's lambda function.- Returns:
this
-
mastersRole
Sets the value ofClusterOptions.getMastersRole()
- Parameters:
mastersRole
- An IAM role that will be added to thesystem:masters
Kubernetes RBAC group.- Returns:
this
-
onEventLayer
Sets the value ofClusterOptions.getOnEventLayer()
- Parameters:
onEventLayer
- An AWS Lambda Layer which includes the NPM dependencyproxy-agent
. This layer is used by the onEvent handler to route AWS SDK requests through a proxy.By default, the provider will use the layer included in the "aws-lambda-layer-node-proxy-agent" SAR application which is available in all commercial regions.
To deploy the layer locally define it in your app as follows:
LayerVersion layer = LayerVersion.Builder.create(this, "proxy-agent-layer") .code(Code.fromAsset(String.format("%s/layer.zip", __dirname))) .compatibleRuntimes(List.of(Runtime.NODEJS_14_X)) .build();
- Returns:
this
-
outputMastersRoleArn
Sets the value ofClusterOptions.getOutputMastersRoleArn()
- Parameters:
outputMastersRoleArn
- Determines whether a CloudFormation output with the ARN of the "masters" IAM role will be synthesized (ifmastersRole
is specified).- Returns:
this
-
placeClusterHandlerInVpc
@Stability(Stable) public ClusterProps.Builder placeClusterHandlerInVpc(Boolean placeClusterHandlerInVpc) Sets the value ofClusterOptions.getPlaceClusterHandlerInVpc()
- Parameters:
placeClusterHandlerInVpc
- If set to true, the cluster handler functions will be placed in the private subnets of the cluster vpc, subject to thevpcSubnets
selection strategy.- Returns:
this
-
prune
Sets the value ofClusterOptions.getPrune()
- Parameters:
prune
- Indicates whether Kubernetes resources added throughaddManifest()
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 thekubectl apply
operation with the--prune
switch.- Returns:
this
-
secretsEncryptionKey
Sets the value ofClusterOptions.getSecretsEncryptionKey()
- Parameters:
secretsEncryptionKey
- KMS secret for envelope encryption for Kubernetes secrets.- Returns:
this
-
serviceIpv4Cidr
Sets the value ofClusterOptions.getServiceIpv4Cidr()
- Parameters:
serviceIpv4Cidr
- The CIDR block to assign Kubernetes service IP addresses from.- Returns:
this
-
version
Sets the value ofCommonClusterOptions.getVersion()
- Parameters:
version
- The Kubernetes version to run in the cluster. This parameter is required.- Returns:
this
-
clusterName
Sets the value ofCommonClusterOptions.getClusterName()
- Parameters:
clusterName
- Name for the cluster.- Returns:
this
-
outputClusterName
Sets the value ofCommonClusterOptions.getOutputClusterName()
- Parameters:
outputClusterName
- Determines whether a CloudFormation output with the name of the cluster will be synthesized.- Returns:
this
-
outputConfigCommand
Sets the value ofCommonClusterOptions.getOutputConfigCommand()
- Parameters:
outputConfigCommand
- Determines whether a CloudFormation output with theaws eks update-kubeconfig
command will be synthesized. This command will include the cluster name and, if applicable, the ARN of the masters IAM role.- Returns:
this
-
role
Sets the value ofCommonClusterOptions.getRole()
- Parameters:
role
- Role that provides permissions for the Kubernetes control plane to make calls to AWS API operations on your behalf.- Returns:
this
-
securityGroup
Sets the value ofCommonClusterOptions.getSecurityGroup()
- Parameters:
securityGroup
- Security Group to use for Control Plane ENIs.- Returns:
this
-
vpc
Sets the value ofCommonClusterOptions.getVpc()
- Parameters:
vpc
- The VPC in which to create the Cluster.- Returns:
this
-
vpcSubnets
@Stability(Stable) public ClusterProps.Builder vpcSubnets(List<? extends SubnetSelection> vpcSubnets) Sets the value ofCommonClusterOptions.getVpcSubnets()
- Parameters:
vpcSubnets
- Where to place EKS Control Plane ENIs. If you want to create public load balancers, this must include public subnets.For example, to only select private subnets, supply the following:
vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_NAT }]
- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<ClusterProps>
- Returns:
- a new instance of
ClusterProps
- Throws:
NullPointerException
- if any required attribute was not provided
-