Class ClusterOptions.Builder
java.lang.Object
software.amazon.awscdk.services.eks.ClusterOptions.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<ClusterOptions>
- Enclosing interface:
ClusterOptions
@Stability(Stable)
public static final class ClusterOptions.Builder
extends Object
implements software.amazon.jsii.Builder<ClusterOptions>
A builder for
ClusterOptions
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionalbController
(AlbControllerOptions albController) Sets the value ofClusterOptions.getAlbController()
authenticationMode
(AuthenticationMode authenticationMode) Sets the value ofClusterOptions.getAuthenticationMode()
awscliLayer
(ILayerVersion awscliLayer) Sets the value ofClusterOptions.getAwscliLayer()
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 ofClusterOptions.getClusterLogging()
clusterName
(String clusterName) Sets the value ofCommonClusterOptions.getClusterName()
coreDnsComputeType
(CoreDnsComputeType coreDnsComputeType) Sets the value ofClusterOptions.getCoreDnsComputeType()
endpointAccess
(EndpointAccess endpointAccess) Sets the value ofClusterOptions.getEndpointAccess()
Sets the value ofClusterOptions.getIpFamily()
kubectlEnvironment
(Map<String, String> kubectlEnvironment) Sets the value ofClusterOptions.getKubectlEnvironment()
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()
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
-
albController
Sets the value ofClusterOptions.getAlbController()
- Parameters:
albController
- Install the AWS Load Balancer Controller onto the cluster.- Returns:
this
-
authenticationMode
@Stability(Stable) public ClusterOptions.Builder authenticationMode(AuthenticationMode authenticationMode) Sets the value ofClusterOptions.getAuthenticationMode()
- Parameters:
authenticationMode
- The desired authentication mode for the cluster.- Returns:
this
-
awscliLayer
Sets the value ofClusterOptions.getAwscliLayer()
- Parameters:
awscliLayer
- An AWS Lambda layer that contains theaws
CLI. The handler expects the layer to include the following executables:/opt/awscli/aws
- Returns:
this
-
clusterHandlerEnvironment
@Stability(Stable) public ClusterOptions.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 ClusterOptions.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
-
clusterLogging
@Stability(Stable) public ClusterOptions.Builder clusterLogging(List<? extends ClusterLoggingTypes> clusterLogging) Sets the value ofClusterOptions.getClusterLogging()
- Parameters:
clusterLogging
- The cluster log types which you want to enable.- Returns:
this
-
coreDnsComputeType
@Stability(Stable) public ClusterOptions.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
-
ipFamily
Sets the value ofClusterOptions.getIpFamily()
- Parameters:
ipFamily
- Specify which IP family is used to assign Kubernetes pod and service IP addresses.- Returns:
this
-
kubectlEnvironment
@Stability(Stable) public ClusterOptions.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
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. If you don't supply this valuekubectl
1.20 will be used, but that version is most likely too old.The handler expects the layer to include the following executables:
/opt/helm/helm /opt/kubectl/kubectl
- 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_LATEST)) .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 ClusterOptions.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 ClusterOptions.Builder vpcSubnets(List<? extends SubnetSelection> vpcSubnets) Sets the value ofCommonClusterOptions.getVpcSubnets()
- Parameters:
vpcSubnets
- Where to place EKS Control Plane ENIs. For example, to only select private subnets, supply the following:vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }]
- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<ClusterOptions>
- Returns:
- a new instance of
ClusterOptions
- Throws:
NullPointerException
- if any required attribute was not provided
-