Skip to content

Commit e461601

Browse files
authored
feat(eks): expose FargateCluster's defaultProfile (#17130)
Expose FargateCluster's defaultProfile. Fixes #16149 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent b240201 commit e461601

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/@aws-cdk/aws-eks/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ const cluster = new eks.FargateCluster(this, 'MyCluster', {
342342
});
343343
```
344344

345+
`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`.
346+
345347
**NOTE**: Classic Load Balancers and Network Load Balancers are not supported on
346348
pods running on Fargate. For ingress, we recommend that you use the [ALB Ingress
347349
Controller](https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html)

packages/@aws-cdk/aws-eks/lib/fargate-cluster.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Construct } from 'constructs';
22
import { Cluster, ClusterOptions, CoreDnsComputeType } from './cluster';
3-
import { FargateProfileOptions } from './fargate-profile';
3+
import { FargateProfile, FargateProfileOptions } from './fargate-profile';
44

55
/**
66
* Configuration props for EKS Fargate.
@@ -23,6 +23,11 @@ export interface FargateClusterProps extends ClusterOptions {
2323
* `addFargateProfile`.
2424
*/
2525
export class FargateCluster extends Cluster {
26+
/**
27+
* Fargate Profile that was created with the cluster.
28+
*/
29+
public readonly defaultProfile: FargateProfile;
30+
2631
constructor(scope: Construct, id: string, props: FargateClusterProps) {
2732
super(scope, id, {
2833
...props,
@@ -31,7 +36,7 @@ export class FargateCluster extends Cluster {
3136
version: props.version,
3237
});
3338

34-
this.addFargateProfile(
39+
this.defaultProfile = this.addFargateProfile(
3540
props.defaultProfile?.fargateProfileName ?? (props.defaultProfile ? 'custom' : 'default'),
3641
props.defaultProfile ?? {
3742
selectors: [

0 commit comments

Comments
 (0)