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 Details

    • Builder

      public Builder()
  • Method Details

    • albController

      @Stability(Stable) public ClusterOptions.Builder albController(AlbControllerOptions albController)
      Parameters:
      albController - Install the AWS Load Balancer Controller onto the cluster.
      Returns:
      this
    • clusterHandlerEnvironment

      @Stability(Stable) public ClusterOptions.Builder clusterHandlerEnvironment(Map<String,String> clusterHandlerEnvironment)
      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)
      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 ClusterOptions.Builder coreDnsComputeType(CoreDnsComputeType coreDnsComputeType)
      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

      @Stability(Stable) public ClusterOptions.Builder endpointAccess(EndpointAccess endpointAccess)
      Parameters:
      endpointAccess - Configure access to the Kubernetes API server endpoint..
      Returns:
      this
    • kubectlEnvironment

      @Stability(Stable) public ClusterOptions.Builder kubectlEnvironment(Map<String,String> kubectlEnvironment)
      Parameters:
      kubectlEnvironment - Environment variables for the kubectl execution. Only relevant for kubectl enabled clusters.
      Returns:
      this
    • kubectlLayer

      @Stability(Stable) public ClusterOptions.Builder kubectlLayer(ILayerVersion kubectlLayer)
      Parameters:
      kubectlLayer - An AWS Lambda Layer which includes kubectl, 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

      @Stability(Stable) public ClusterOptions.Builder kubectlMemory(Size kubectlMemory)
      Parameters:
      kubectlMemory - Amount of memory to allocate to the provider's lambda function.
      Returns:
      this
    • mastersRole

      @Stability(Stable) public ClusterOptions.Builder mastersRole(IRole mastersRole)
      Parameters:
      mastersRole - An IAM role that will be added to the system:masters Kubernetes RBAC group.
      Returns:
      this
    • onEventLayer

      @Stability(Stable) public ClusterOptions.Builder onEventLayer(ILayerVersion onEventLayer)
      Parameters:
      onEventLayer - 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.

      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

      @Stability(Stable) public ClusterOptions.Builder outputMastersRoleArn(Boolean outputMastersRoleArn)
      Parameters:
      outputMastersRoleArn - Determines whether a CloudFormation output with the ARN of the "masters" IAM role will be synthesized (if mastersRole is specified).
      Returns:
      this
    • placeClusterHandlerInVpc

      @Stability(Stable) public ClusterOptions.Builder placeClusterHandlerInVpc(Boolean placeClusterHandlerInVpc)
      Parameters:
      placeClusterHandlerInVpc - If set to true, the cluster handler functions will be placed in the private subnets of the cluster vpc, subject to the vpcSubnets selection strategy.
      Returns:
      this
    • prune

      @Stability(Stable) public ClusterOptions.Builder prune(Boolean prune)
      Sets the value of ClusterOptions.getPrune()
      Parameters:
      prune - 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:
      this
    • secretsEncryptionKey

      @Stability(Stable) public ClusterOptions.Builder secretsEncryptionKey(IKey secretsEncryptionKey)
      Parameters:
      secretsEncryptionKey - KMS secret for envelope encryption for Kubernetes secrets.
      Returns:
      this
    • serviceIpv4Cidr

      @Stability(Stable) public ClusterOptions.Builder serviceIpv4Cidr(String serviceIpv4Cidr)
      Parameters:
      serviceIpv4Cidr - The CIDR block to assign Kubernetes service IP addresses from.
      Returns:
      this
    • version

      @Stability(Stable) public ClusterOptions.Builder version(KubernetesVersion version)
      Parameters:
      version - The Kubernetes version to run in the cluster. This parameter is required.
      Returns:
      this
    • clusterName

      @Stability(Stable) public ClusterOptions.Builder clusterName(String clusterName)
      Parameters:
      clusterName - Name for the cluster.
      Returns:
      this
    • outputClusterName

      @Stability(Stable) public ClusterOptions.Builder outputClusterName(Boolean outputClusterName)
      Parameters:
      outputClusterName - Determines whether a CloudFormation output with the name of the cluster will be synthesized.
      Returns:
      this
    • outputConfigCommand

      @Stability(Stable) public ClusterOptions.Builder outputConfigCommand(Boolean outputConfigCommand)
      Parameters:
      outputConfigCommand - Determines whether a CloudFormation output with the aws 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

      @Stability(Stable) public ClusterOptions.Builder role(IRole role)
      Parameters:
      role - Role that provides permissions for the Kubernetes control plane to make calls to AWS API operations on your behalf.
      Returns:
      this
    • securityGroup

      @Stability(Stable) public ClusterOptions.Builder securityGroup(ISecurityGroup securityGroup)
      Parameters:
      securityGroup - Security Group to use for Control Plane ENIs.
      Returns:
      this
    • vpc

      @Stability(Stable) public ClusterOptions.Builder vpc(IVpc vpc)
      Parameters:
      vpc - The VPC in which to create the Cluster.
      Returns:
      this
    • vpcSubnets

      @Stability(Stable) public ClusterOptions.Builder vpcSubnets(List<? extends SubnetSelection> vpcSubnets)
      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

      @Stability(Stable) public ClusterOptions build()
      Builds the configured instance.
      Specified by:
      build in interface software.amazon.jsii.Builder<ClusterOptions>
      Returns:
      a new instance of ClusterOptions
      Throws:
      NullPointerException - if any required attribute was not provided