Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-eks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ const cluster = new eks.FargateCluster(this, 'MyCluster', {
});
```

`FargateCluster` will create a default `FargateProfile` which can be accessed via the cluster's `defaultProfile` property. The created profile can also be customized by passing options as with `addFargateProfile`.

**NOTE**: Classic Load Balancers and Network Load Balancers are not supported on
pods running on Fargate. For ingress, we recommend that you use the [ALB Ingress
Controller](https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html)
Expand Down
9 changes: 7 additions & 2 deletions packages/@aws-cdk/aws-eks/lib/fargate-cluster.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Construct } from 'constructs';
import { Cluster, ClusterOptions, CoreDnsComputeType } from './cluster';
import { FargateProfileOptions } from './fargate-profile';
import { FargateProfile, FargateProfileOptions } from './fargate-profile';

/**
* Configuration props for EKS Fargate.
Expand All @@ -23,6 +23,11 @@ export interface FargateClusterProps extends ClusterOptions {
* `addFargateProfile`.
*/
export class FargateCluster extends Cluster {
/**
* Fargate Profile that was created with the cluster.
*/
public readonly defaultProfile: FargateProfile;

constructor(scope: Construct, id: string, props: FargateClusterProps) {
super(scope, id, {
...props,
Expand All @@ -31,7 +36,7 @@ export class FargateCluster extends Cluster {
version: props.version,
});

this.addFargateProfile(
this.defaultProfile = this.addFargateProfile(
props.defaultProfile?.fargateProfileName ?? (props.defaultProfile ? 'custom' : 'default'),
props.defaultProfile ?? {
selectors: [
Expand Down