Class ClusterProps.Builder

java.lang.Object
software.amazon.awscdk.services.eks.ClusterProps.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<ClusterProps>
Enclosing interface:
ClusterProps

@Stability(Stable) public static final class ClusterProps.Builder extends Object implements software.amazon.jsii.Builder<ClusterProps>
A builder for ClusterProps
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • bootstrapClusterCreatorAdminPermissions

      @Stability(Stable) public ClusterProps.Builder bootstrapClusterCreatorAdminPermissions(Boolean bootstrapClusterCreatorAdminPermissions)
      Parameters:
      bootstrapClusterCreatorAdminPermissions - Whether or not IAM principal of the cluster creator was set as a cluster admin access entry during cluster creation time. Changing this value after the cluster has been created will result in the cluster being replaced.
      Returns:
      this
    • defaultCapacity

      @Stability(Stable) public ClusterProps.Builder defaultCapacity(Number defaultCapacity)
      Parameters:
      defaultCapacity - Number of instances to allocate as an initial capacity for this cluster. Instance type can be configured through defaultCapacityInstanceType, which defaults to m5.large.

      Use cluster.addAutoScalingGroupCapacity to add additional customized capacity. Set this to 0 is you wish to avoid the initial capacity allocation.

      Returns:
      this
    • defaultCapacityInstance

      @Stability(Stable) public ClusterProps.Builder defaultCapacityInstance(InstanceType defaultCapacityInstance)
      Parameters:
      defaultCapacityInstance - The instance type to use for the default capacity. This will only be taken into account if defaultCapacity is > 0.
      Returns:
      this
    • defaultCapacityType

      @Stability(Stable) public ClusterProps.Builder defaultCapacityType(DefaultCapacityType defaultCapacityType)
      Parameters:
      defaultCapacityType - The default capacity type for the cluster.
      Returns:
      this
    • kubectlLambdaRole

      @Stability(Stable) public ClusterProps.Builder kubectlLambdaRole(IRole kubectlLambdaRole)
      Parameters:
      kubectlLambdaRole - The IAM role to pass to the Kubectl Lambda Handler.
      Returns:
      this
    • tags

      @Stability(Stable) public ClusterProps.Builder tags(Map<String,String> tags)
      Sets the value of ClusterProps.getTags()
      Parameters:
      tags - The tags assigned to the EKS cluster.
      Returns:
      this
    • albController

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

      @Stability(Stable) public ClusterProps.Builder authenticationMode(AuthenticationMode authenticationMode)
      Parameters:
      authenticationMode - The desired authentication mode for the cluster.
      Returns:
      this
    • awscliLayer

      @Stability(Stable) public ClusterProps.Builder awscliLayer(ILayerVersion awscliLayer)
      Parameters:
      awscliLayer - An AWS Lambda layer that contains the aws CLI. The handler expects the layer to include the following executables:

                          /opt/awscli/aws
                          
      Returns:
      this
    • clusterHandlerEnvironment

      @Stability(Stable) public ClusterProps.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 ClusterProps.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
    • clusterLogging

      @Stability(Stable) public ClusterProps.Builder clusterLogging(List<? extends ClusterLoggingTypes> clusterLogging)
      Parameters:
      clusterLogging - The cluster log types which you want to enable.
      Returns:
      this
    • coreDnsComputeType

      @Stability(Stable) public ClusterProps.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 ClusterProps.Builder endpointAccess(EndpointAccess endpointAccess)
      Parameters:
      endpointAccess - Configure access to the Kubernetes API server endpoint..
      Returns:
      this
    • ipFamily

      @Stability(Stable) public ClusterProps.Builder ipFamily(IpFamily ipFamily)
      Parameters:
      ipFamily - Specify which IP family is used to assign Kubernetes pod and service IP addresses.
      Returns:
      this
    • kubectlEnvironment

      @Stability(Stable) public ClusterProps.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 ClusterProps.Builder kubectlLayer(ILayerVersion kubectlLayer)
      Parameters:
      kubectlLayer - 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. If you don't supply this value kubectl 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

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

      @Stability(Stable) public ClusterProps.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 ClusterProps.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_LATEST))
                                   .build();
                           
      Returns:
      this
    • outputMastersRoleArn

      @Stability(Stable) public ClusterProps.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 ClusterProps.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 ClusterProps.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 ClusterProps.Builder secretsEncryptionKey(IKey secretsEncryptionKey)
      Parameters:
      secretsEncryptionKey - KMS secret for envelope encryption for Kubernetes secrets.
      Returns:
      this
    • serviceIpv4Cidr

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

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

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

      @Stability(Stable) public ClusterProps.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 ClusterProps.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 ClusterProps.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 ClusterProps.Builder securityGroup(ISecurityGroup securityGroup)
      Parameters:
      securityGroup - Security Group to use for Control Plane ENIs.
      Returns:
      this
    • vpc

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

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

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