-
Notifications
You must be signed in to change notification settings - Fork 190
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
Existing Cluster Constructs #370
Comments
I will add an example of importing an existing cluster and applying add-ons to them. |
@shapirov103 Is it also possible to provide an example in the documentation on how to use blueprints in combination with existing eks.Cluster constructs? e.g. import { Cluster } from 'aws-cdk-lib/aws-eks';
<...>
export class InfrastructureStack extends Stack {
private cluster: Cluster;
constructor(scope: Construct, id: string, uniqueName: string, owner: nnOwner, featureBranchToggle: boolean, props?: StackProps) {
super(scope, id, props);
this.cluster = new eks.Cluster(this, 'eks', {...});
<...use blueprint 'Construct' ClusterAddOn to build on top...> <....>
const clusterInfo = new blueprints.ClusterInfo(this.cluster, kubernetesVersion);
const postDeploymentSteps = Array<blueprints.ClusterPostDeploy>();
for (const addOn of stackPropsPassedIn.addOns ?? []) {
// eslint-disable-next-line no-console
console.log(`Adding AddOn: ${blueprints.utils.getAddOnNameOrId(addOn)}`);
const result = addOn.deploy(clusterInfo);
if (result) {
const addOnKey = blueprints.utils.getAddOnNameOrId(addOn);
clusterInfo.addScheduledAddOn(addOnKey, result);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const postDeploy: any = addOn;
if ((postDeploy as blueprints.ClusterPostDeploy).postDeploy !== undefined) {
postDeploymentSteps.push(<blueprints.ClusterPostDeploy>postDeploy);
}
}
const scheduledAddOns = clusterInfo.getAllScheduledAddons();
const addOnKeys = [...scheduledAddOns.keys()];
const promises = scheduledAddOns.values();
this.asyncTasks = Promise.all(promises).then((constructs) => {
constructs.forEach((construct, index) => {
clusterInfo.addProvisionedAddOn(addOnKeys[index], construct);
});
for (const step of postDeploymentSteps) {
step.postDeploy(clusterInfo, []);
}
});
this.asyncTasks.catch((err) => {
// eslint-disable-next-line no-console
console.error(err);
throw new Error(err);
}); |
Will add an item to show leveraging existing cluster and add add-ons / teams. |
This issue has been automatically marked as stale because it has been open 60 days |
Issue closed due to inactivity. |
Is the blueprints.ClusterAddOn usable on existing cdk eks.Cluster Constructs / ICluster interfaces? It would be awesome to be able to ship ClusterAddOns to existing clusters deployed using aws-cdk. I'm not sure if that is the point of the blueprints, but it would extend very nicely on top of people who code their own Clusters or have them already running.
The text was updated successfully, but these errors were encountered: