in lib/stacks/eks-blueprint-stack.ts [158:216]
constructor(scope: cdk.Construct, blueprintProps: EksBlueprintProps, props?: StackProps) {
super(scope, blueprintProps.id, withUsageTracking(EksBlueprint.USAGE_ID, props));
this.validateInput(blueprintProps);
const resourceContext = this.provideNamedResources(blueprintProps);
let vpcResource : IVpc | undefined = resourceContext.get(spi.GlobalResources.Vpc);
if(!vpcResource) {
vpcResource = resourceContext.add(spi.GlobalResources.Vpc, new VpcProvider());
}
const version = blueprintProps.version ?? KubernetesVersion.V1_20;
const clusterProvider = blueprintProps.clusterProvider ?? new MngClusterProvider({ version });
this.clusterInfo = clusterProvider.createCluster(this, vpcResource!);
this.clusterInfo.setResourceContext(resourceContext);
let enableLogTypes : string[] | undefined = blueprintProps.enableControlPlaneLogTypes;
if (enableLogTypes) {
setupClusterLogging(this.clusterInfo.cluster.stack, this.clusterInfo.cluster, enableLogTypes);
}
const postDeploymentSteps = Array<spi.ClusterPostDeploy>();
for (let addOn of (blueprintProps.addOns ?? [])) { // must iterate in the strict order
const result = addOn.deploy(this.clusterInfo);
if (result) {
const addOnKey = getAddOnNameOrId(addOn);
this.clusterInfo.addScheduledAddOn(addOnKey, result);
}
const postDeploy: any = addOn;
if ((postDeploy as spi.ClusterPostDeploy).postDeploy !== undefined) {
postDeploymentSteps.push(<spi.ClusterPostDeploy>postDeploy);
}
}
const scheduledAddOns = this.clusterInfo.getAllScheduledAddons();
const addOnKeys = [...scheduledAddOns.keys()];
const promises = scheduledAddOns.values();
this.asyncTasks = Promise.all(promises).then((constructs) => {
constructs.forEach((construct, index) => {
this.clusterInfo.addProvisionedAddOn(addOnKeys[index], construct);
});
if (blueprintProps.teams != null) {
for (let team of blueprintProps.teams) {
team.setup(this.clusterInfo);
}
}
for (let step of postDeploymentSteps) {
step.postDeploy(this.clusterInfo, blueprintProps.teams ?? []);
}
});
this.asyncTasks.catch(err => { throw new Error(err); });
}