Skip to content

Commit 899f9e3

Browse files
authored
Feature/peer dependency (#946)
* upgraded CDK to 2.132 and added peer dependency * Fix for #944, CDK dependency is set as peer and docs updated * updating md link * Fix for karpenter failure or delete, k8s moved to 1.29 for e2e and removed flux example as it was failing to compile * fixed typo
1 parent 247aaf2 commit 899f9e3

File tree

10 files changed

+54
-34
lines changed

10 files changed

+54
-34
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ aws --version
4444
Install CDK matching the current version of the Blueprints QuickStart (which can be found in package.json).
4545

4646
```bash
47-
npm install -g aws-cdk@2.131.0
47+
npm install -g aws-cdk@2.132.0
4848
```
4949

5050
Verify the installation.
5151

5252
```bash
5353
cdk --version
54-
# must output 2.131.0
54+
# must output 2.132.0
5555
```
5656

5757
Create a new CDK project. We use `typescript` for this example.

docs/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ aws --version
4444
Install CDK matching the current version of the Blueprints QuickStart (which can be found in package.json).
4545

4646
```bash
47-
npm install -g aws-cdk@2.131.0
47+
npm install -g aws-cdk@2.132.0
4848
```
4949

5050
Verify the installation.
5151

5252
```bash
5353
cdk --version
54-
# must output 2.131.0
54+
# must output 2.132.0
5555
```
5656

5757
Create a new CDK project. We use `typescript` for this example.

docs/addons/gmaestro.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# gMaestro add-on for Amazon EKS Blueprints
22

3-
This add-on deploys the [gMaestro Agent](https://gmaestro.gitbook.io/gmaestro-docs/) on Amazon EKS using the [eks-blueprints](https://github.com/aws-quickstart/cdk-eks-blueprints) [CDK](https://aws.amazon.com/cdk/) construct.
3+
This add-on deploys the [gMaestro Agent](https://app.granulate.io/gMaestroSignup) on Amazon EKS using the [eks-blueprints](https://github.com/aws-quickstart/cdk-eks-blueprints) [CDK](https://aws.amazon.com/cdk/) construct.
44

55
gMaestro is a Kubernetes cost optimization solution that helps companies reduce spending on un-utilized resources by up to 60%. With gMaestro, you gain full visibility into K8s clusters, seamlessly interact with HPA scaling policies, and achieve your cost-performance goals by applying custom rightsizing recommendations based on actual usage in production.
66

docs/getting-started.md

+38-5
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,52 @@ Create a directory that represents you project (e.g. `my-blueprints`) and then c
2626
```bash
2727
npm install -g n # may require sudo
2828
n stable # may require sudo
29-
npm install -g aws-cdk@2.131.0 # may require sudo (Ubuntu) depending on configuration
30-
cdk --version # must produce 2.131.0
29+
npm install -g aws-cdk@2.132.0 # may require sudo (Ubuntu) depending on configuration
30+
cdk --version # must produce 2.132.0
3131
mkdir my-blueprints
3232
cd my-blueprints
3333
cdk init app --language typescript
3434
```
3535

36-
## Configure and Deploy EKS Clusters
37-
Install the `eks-blueprints` NPM package via the following.
36+
## Configure Your Project
37+
38+
Install the `eks-blueprints` NPM package (keep reading if you get an error or warning message):
3839

3940
```bash
4041
npm i @aws-quickstart/eks-blueprints
4142
```
4243

43-
Replace the contents of `bin/<your-main-file>.ts` (where `your-main-file` by default is the name of the root project directory) with the following code. This code will deploy a new EKS Cluster and install the `ArgoCD` addon.
44+
CDK version of the EKS Blueprints is pinned as [`peerDependencies`](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#peerdependencies) to the version that we tested against to minimize the risk of incompatibilities and/or broken functionality. When running the install command, NPM will detect any mismatch in the version and issue an error. For example:
45+
46+
```
47+
npm ERR! code ERESOLVE
48+
npm ERR! ERESOLVE unable to resolve dependency tree
49+
npm ERR!
50+
npm ERR! While resolving: [email protected]
51+
npm ERR! Found: [email protected]
52+
npm ERR! node_modules/aws-cdk-lib
53+
npm ERR! aws-cdk-lib@"2.130.0" from the root project
54+
npm ERR!
55+
npm ERR! Could not resolve dependency:
56+
npm ERR! peer bundled aws-cdk-lib@"2.132.0" from @aws-quickstart/[email protected]
57+
npm ERR! node_modules/@aws-quickstart/eks-blueprint
58+
```
59+
60+
This message means that the version of CDK that the customer is using is different from the version of CDK used in EKS Blueprints. Locate the line `peer bundled` and check the expected version of the CDK. Make sure that in your `package.json` the version is set to the expected. In this example, `package.json` contained `"aws-cdk-lib": "2.130.0"`, while the expected version was `2.132.0`.
61+
62+
**Note**: after the initial installation, upgrading the version of CDK to an incompatible higher/lower version will produce a warning, but will succeed. For community support (submitting GitHub issues) please make sure you have a matching version configured.
63+
64+
Example warning:
65+
66+
```
67+
npm WARN
68+
npm WARN Could not resolve dependency:
69+
npm WARN peer bundled aws-cdk-lib@"2.132.0" from @aws-quickstart/[email protected]
70+
```
71+
72+
## Deploy EKS Clusters
73+
74+
Replace the contents of `bin/<your-main-file>.ts` (where `your-main-file` by default is the name of the root project directory) with the following code. This code will deploy a new EKS Cluster and install a number of addons.
4475

4576
```typescript
4677
import * as cdk from 'aws-cdk-lib';
@@ -51,6 +82,8 @@ const account = 'XXXXXXXXXXXXX';
5182
const region = 'us-east-2';
5283
const version = 'auto';
5384

85+
blueprints.HelmAddOn.validateHelmVersions = true; // optional if you would like to check for newer versions
86+
5487
const addOns: Array<blueprints.ClusterAddOn> = [
5588
new blueprints.addons.ArgoCDAddOn(),
5689
new blueprints.addons.CalicoOperatorAddOn(),

docs/internal/ci.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ cd cdk-eks-blueprints
1919
Install CDK (please review and install any missing [pre-requisites](https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html) for your environment)
2020

2121
```sh
22-
npm install -g aws-cdk@2.131.0
22+
npm install -g aws-cdk@2.132.0
2323
```
2424

2525
Install the dependencies for this project.

examples/blueprint-construct/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export default class BlueprintConstruct {
243243
});
244244

245245
const clusterProvider = new blueprints.GenericClusterProvider({
246-
version: KubernetesVersion.V1_28,
246+
version: KubernetesVersion.V1_29,
247247
tags: {
248248
"Name": "blueprints-example-cluster",
249249
"Type": "generic-cluster"

examples/examples.ts

-19
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ builder()
4646
.addOns(buildArgoBootstrap())
4747
.build(app, 'argo-blueprint1');
4848

49-
builder()
50-
.clusterProvider(new bp.MngClusterProvider(publicCluster))
51-
.addOns(buildFluxBootstrap())
52-
.build(app, 'flux-blueprint');
5349

5450

5551
function buildArgoBootstrap() {
@@ -87,18 +83,3 @@ function buildArgoBootstrap() {
8783
}
8884
});
8985
}
90-
91-
function buildFluxBootstrap() {
92-
return new bp.addons.FluxCDAddOn({
93-
bootstrapRepo : {
94-
repoUrl: 'https://github.com/stefanprodan/podinfo',
95-
name: "podinfo",
96-
targetRevision: "master",
97-
path: "./kustomize",
98-
},
99-
bootstrapValues: {
100-
"region": "us-east-1"
101-
},
102-
});
103-
}
104-

lib/addons/karpenter/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,10 @@ export class KarpenterAddOn extends HelmAddOn {
469469

470470
karpenterChart.node.addDependency(ns);
471471

472+
if(clusterInfo.nodeGroups) {
473+
clusterInfo.nodeGroups.forEach(n => karpenterChart.node.addDependency(n));
474+
}
475+
472476
// Deploy Provisioner (Alpha) or NodePool (Beta) CRD based on the Karpenter Version
473477
if (this.options.nodePoolSpec){
474478
let pool;

lib/pipelines/code-pipeline.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ class CodePipeline {
457457
primaryOutputDirectory: `${path}/cdk.out`,
458458
installCommands: [
459459
'n stable',
460-
'npm install -g aws-cdk@2.131.0',
460+
'npm install -g aws-cdk@2.132.0',
461461
`cd $CODEBUILD_SRC_DIR/${path} && npm install`
462462
],
463463
commands: [`cd $CODEBUILD_SRC_DIR/${path}`, 'npm run build', 'npx cdk synth ' + app]

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"@types/uuid": "^9.0.7",
2727
"@typescript-eslint/eslint-plugin": "^7.1.1",
2828
"@typescript-eslint/parser": "^7.1.1",
29-
"aws-cdk": "2.131.0",
3029
"copyfiles": "^2.4.1",
3130
"eslint": "^8.55.0",
3231
"jest": "^29.7.0",
@@ -47,7 +46,6 @@
4746
"@types/bcrypt": "^5.0.2",
4847
"@types/lodash.clonedeep": "^4.5.9",
4948
"@types/uuid": "^9.0.7",
50-
"aws-cdk-lib": "2.131.0",
5149
"bcrypt": "^5.1.1",
5250
"constructs": "^10.3.0",
5351
"dot-object": "^2.1.4",
@@ -72,5 +70,9 @@
7270
},
7371
"overrides": {
7472
"semver": "^7.6.0"
73+
},
74+
"peerDependencies": {
75+
"aws-cdk-lib": "2.132.0",
76+
"aws-cdk": "2.132.0"
7577
}
7678
}

0 commit comments

Comments
 (0)