Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(eks): added support for bootstrapSelfManagedAddons #30804

Closed
wants to merge 14 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ export class ClusterResourceHandler extends ResourceHandler {
// if there is an update that requires replacement, go ahead and just create
// a new cluster with the new config. The old cluster will automatically be
// deleted by cloudformation upon success.
if (updates.replaceName || updates.replaceRole || updates.updateBootstrapClusterCreatorAdminPermissions ) {
if (updates.replaceName || updates.replaceRole ||
updates.updateBootstrapClusterCreatorAdminPermissions || updates.updateBootstrapSelfManagedAddons ) {
// if we are replacing this cluster and the cluster has an explicit
// physical name, the creation of the new cluster will fail with "there is
// already a cluster with that name". this is a common behavior for
Expand Down Expand Up @@ -412,6 +413,7 @@ interface UpdateMap {
updateBootstrapClusterCreatorAdminPermissions: boolean; // accessConfig.bootstrapClusterCreatorAdminPermissions
updateVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds
updateTags: boolean; // tags
updateBootstrapSelfManagedAddons: boolean; // cluster with default networking add-ons
}

function analyzeUpdate(oldProps: Partial<EKS.CreateClusterCommandInput>, newProps: EKS.CreateClusterCommandInput): UpdateMap {
Expand Down Expand Up @@ -445,6 +447,7 @@ function analyzeUpdate(oldProps: Partial<EKS.CreateClusterCommandInput>, newProp
updateBootstrapClusterCreatorAdminPermissions: JSON.stringify(newAccessConfig.bootstrapClusterCreatorAdminPermissions) !==
JSON.stringify(oldAccessConfig.bootstrapClusterCreatorAdminPermissions),
updateTags: JSON.stringify(newProps.tags) !== JSON.stringify(oldProps.tags),
updateBootstrapSelfManagedAddons: newProps.bootstrapSelfManagedAddons !== oldProps.bootstrapSelfManagedAddons,
};
}

Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/custom-resource-handlers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@aws-sdk/client-route-53": "3.421.0",
"@aws-sdk/client-cloudwatch-logs": "3.421.0",
"@aws-sdk/client-dynamodb": "3.421.0",
"@aws-sdk/client-eks": "3.476.0",
"@aws-sdk/client-eks": "3.609.0",
"@aws-sdk/client-sts": "3.421.0",
"@aws-sdk/node-http-handler": "^3.370.0",
"@smithy/util-stream": "^2.2.0",
Expand Down
4 changes: 3 additions & 1 deletion packages/aws-cdk-lib/aws-eks/lib/cluster-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface ClusterResourceProps {
readonly tags?: { [key: string]: string };
readonly logging?: { [key: string]: [ { [key: string]: any } ] };
readonly accessconfig?: CfnCluster.AccessConfigProperty;
readonly bootstrapSelfManagedAddons?: boolean;
}

/**
Expand Down Expand Up @@ -90,6 +91,7 @@ export class ClusterResource extends Construct {
tags: props.tags,
logging: props.logging,
accessConfig: props.accessconfig,
bootstrapSelfManagedAddons: props.bootstrapSelfManagedAddons,
},
AssumeRoleArn: this.adminRole.roleArn,

Expand All @@ -98,7 +100,7 @@ export class ClusterResource extends Construct {
// doesn't contain XXX key in object" (see #8276) by incrementing this
// number, you will effectively cause a "no-op update" to the cluster
// which will return the new set of attribute.
AttributesRevision: 3,
AttributesRevision: 4,
},
});

Expand Down
12 changes: 12 additions & 0 deletions packages/aws-cdk-lib/aws-eks/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,17 @@ export interface ClusterProps extends ClusterOptions {
*/
readonly bootstrapClusterCreatorAdminPermissions?: boolean;

/**
* If you set this value to False when creating a cluster, the default networking add-ons will not be installed.
* The default networking addons include vpc-cni, coredns, and kube-proxy.
* Use this option when you plan to install third-party alternative add-ons or self-manage the default networking add-ons.
*
* Changing this value after the cluster has been created will result in the cluster being replaced.
*
* @default true
*/
readonly bootstrapSelfManagedAddons?: boolean;

/**
* The tags assigned to the EKS cluster
*
Expand Down Expand Up @@ -1696,6 +1707,7 @@ export class Cluster extends ClusterBase {
onEventLayer: this.onEventLayer,
tags: props.tags,
logging: this.logging,
bootstrapSelfManagedAddons: props.bootstrapSelfManagedAddons,
});

if (this.endpointAccess._config.privateAccess && privateSubnets.length !== 0) {
Expand Down
Loading
Loading