cdk-eks-blueprints icon indicating copy to clipboard operation
cdk-eks-blueprints copied to clipboard

FargateClusterProvide: eks and blueprint FargateProfileOptions non compatible

Open martin-dominguez opened this issue 3 years ago • 1 comments

Describe the bug

Following the docs to create a Fargate EKS Cluster generates a compatibility error between aws-lib-ckd/aws-eks FargateProfileOptions type and its equivalent in @aws-quickstart/eks-blueprints package.

Expected Behavior

The Fargate profile and EKS Cluster are created

Current Behavior

I got this error:

Type 'Map<string, import("...../node_modules/aws-cdk-lib/aws-eks/lib/fargate-profile").FargateProfileOptions>' is not assignable to type 'Map<string, import("...../node_modules/@aws-quickstart/eks-blueprints/node_modules/aws-cdk-lib/aws-eks/lib/fargate-profile").FargateProfileOptions>'.
  Type 'import("...../node_modules/aws-cdk-lib/aws-eks/lib/fargate-profile").FargateProfileOptions' is not assignable to type 'import("...../node_modules/@aws-quickstart/eks-blueprints/node_modules/aws-cdk-lib/aws-eks/lib/fargate-profile").FargateProfileOptions'.
    Types of property 'podExecutionRole' are incompatible.
      Type 'import("...../node_modules/aws-cdk-lib/aws-iam/lib/role").IRole | undefined' is not assignable to type 'import("...../node_modules/@aws-quickstart/eks-blueprints/node_modules/aws-cdk-lib/aws-iam/lib/role").IRole | undefined'.
        Type 'import("...../node_modules/aws-cdk-lib/aws-iam/lib/role").IRole' is not assignable to type 'import("...../node_modules/@aws-quickstart/eks-blueprints/node_modules/aws-cdk-lib/aws-iam/lib/role").IRole'.
          Types of property 'grant' are incompatible.
            Type '(grantee: import("...../node_modules/aws-cdk-lib/aws-iam/lib/principals").IPrincipal, ...actions: string[]) => import("...../node_modules/aws-cdk-lib/aws-iam/lib/grant").Grant' is not assignable to type '(grantee: import("...../node_modules/@aws-quickstart/eks-blueprints/node_modules/aws-cdk-lib/aws-iam/lib/principals").IPrincipal, ...actions: string[]) => import("...../node_modules/@aws-quickstart/eks-bluep...'.
              Types of parameters 'grantee' and 'grantee' are incompatible.
                Type 'import("...../node_modules/@aws-quickstart/eks-blueprints/node_modules/aws-cdk-lib/aws-iam/lib/principals").IPrincipal' is not assignable to type 'import("...../node_modules/aws-cdk-lib/aws-iam/lib/principals").IPrincipal'.
                  Types of property 'addToPrincipalPolicy' are incompatible.
                    Type '(statement: import("...../node_modules/@aws-quickstart/eks-blueprints/node_modules/aws-cdk-lib/aws-iam/lib/policy-statement").PolicyStatement) => import("...../node_modules/@aws-quickstart/eks-blueprints/nod...' is not assignable to type '(statement: import("...../node_modules/aws-cdk-lib/aws-iam/lib/policy-statement").PolicyStatement) => import("...../node_modules/aws-cdk-lib/aws-iam/lib/principals").AddToPrincipalPolicyResult'.
                      Types of parameters 'statement' and 'statement' are incompatible.
                        Type 'import("...../node_modules/aws-cdk-lib/aws-iam/lib/policy-statement").PolicyStatement' is not assignable to type 'import("...../node_modules/@aws-quickstart/eks-blueprints/node_modules/aws-cdk-lib/aws-iam/lib/policy-statement").PolicyStatement'.
                          Types have separate declarations of a private property '_action'.

16   fargateProfiles,
     ~~~~~~~~~~~~~~~

Reproduction Steps

This is the code used:

const fargateProfiles: Map<string, eks.FargateProfileOptions> = new Map([
    ["dynatrace", { selectors: [{ namespace: "dynatrace" }] }]
]);

const clusterProvider = new blueprints.FargateClusterProvider({ fargateProfiles });
new blueprints.EksBlueprint(scope, { id: 'blueprint', [], [], clusterProvider });

These are the versions that I'm using:

$ node -v
v16.13.1
$ aws --version
aws-cli/2.4.7 Python/3.8.8 Darwin/21.5.0 exe/x86_64 prompt/off
$ cdk --version
2.37.1 (build f15dee0)

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.37.1 (build f15dee0)

EKS Blueprints Version

1.1.0

Node.js Version

v16.13.1

Environment details (OS name and version, etc.)

MacOs Monterey 12.4

Other information

aws --version
aws-cli/2.4.7 Python/3.8.8 Darwin/21.5.0 exe/x86_64 prompt/off

martin-dominguez avatar Aug 11 '22 06:08 martin-dominguez

This issue indicates a mismatch between the CDK version used in the blueprints (2.33) and the CDK version that you used in your project (appears to be 2.37). There are a couple of ways to fix.

1/ Use CDK 2.33 - it is the one that we tested with. We also state it in the getting started guide here. 2/ Override the CDK version as described in this comment.

I personally don't use globally installed CDK. You can just set the CDK version in your project to 2.33 and run npx cdk instead of cdk or just create an alias cdk="npx cdk"

shapirov103 avatar Aug 11 '22 14:08 shapirov103

@martin-dominguez Do you see this issue still with latest release. If you dont, Please close the ticket.

elamaran11 avatar Mar 02 '23 16:03 elamaran11

Closing the ticket as we didnt hear back.

elamaran11 avatar Oct 12 '23 12:10 elamaran11