aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

aws-cdk/lambda-layer-kubectl-v27: Found CDK v1 deps in your project, even though your "cdkVersion" is 2.x.

Open lmouhib opened this issue 2 years ago • 4 comments

Describe the bug

When using kubectl layers for newer version, CDK complain that the layer still uses CDK V1.

Expected Behavior

CDk should not complain and the lambda layer library should use CDK v2

Current Behavior

CDk should not complain and the lambda layer library seems to use CDK v1.

👾 default | ts-node --skip-project .projenrc.ts
👾 WARNING: Found CDK v1 deps in your project, even though your "cdkVersion" is 2.x: [@aws-cdk/lambda-layer-kubectl-v27]. Check out https://docs.aws.amazon.com/cdk/v2/guide/migrating-v2.html for more information about using CDK v2 dependencies.
👾 Installing dependencies...
👾 install | yarn install --check-files

Reproduction Steps

Create an EKS cluster with L2 module and pass the lambda layer of any EKS after 1.21.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.118.0

Framework Version

No response

Node.js Version

v18.18.0

OS

macOS

Language

TypeScript

Language Version

4.9.4

Other information

No response

lmouhib avatar Jan 09 '24 11:01 lmouhib

According to this the v27 module should depends on cdkVersion 2.28.0

https://github.com/cdklabs/awscdk-asset-kubectl/blob/193965eb3a3cd604ad27c79b159a9b4d5b87213b/.projenrc.ts#L14

Are you running projen in your current project with your own .projenrc.ts? I am not sure if this warning is coming from the layer. What is the cdkVersion in your .projenrc.ts ?

pahud avatar Jan 09 '24 16:01 pahud

@pahud here is the .projenrc.ts link.

We also get the warning if we run a cdk deploy, without using any projen helpers.

lmouhib avatar Jan 10 '24 21:01 lmouhib

We have this same issue within our internal CDK library as well whenever we are compiling the project, an older version of kubectl layer, but we also did run into the same issue of it complaining about v27, and v28 if those are added as well.

👾 build » default | node .projenrc.js
👾 WARNING: Found CDK v1 deps in your project, even though your "cdkVersion" is 2.x: [@aws-cdk/lambda-layer-kubectl-v26]. Check out https://docs.aws.amazon.com/cdk/v2/guide/migrating-v2.html for more information about using CDK v2 dependencies.
👾 build » compile | jsii --silence-warnings=reserved-word

Snippet of our projenrc file with its CDK dependencies:

    cdkVersion: '2.113.0',
    version: '0.1.0',
    gitignore: [
        'test-reports/*',
    ],
    prettier: false,

    /* JsiiProjectOptions */
    authorOrganization: true, /* undefined */
    compat: true, /* Automatically run API compatibility test against the latest version published to npm after compilation. */
    docgen: false, /* Automatically generate API.md from jsii. */
    docsDirectory: 'docs',
    compileBeforeTest: true,
    eslint: true, /* Install eslint. */
    eslintOptions: {
        dirs: ['src', 'test'],
        fileExtensions: ['.ts'],
        tsconfigPath: './tsconfig.dev.json',
        noUnusedLocals: false,
        ignorePatterns: ['.js', '.d.ts', 'node_modules/', '*.generated.ts', 'coverage', '.json', 'src/*/tsconfig.json'],
    },
    jest: true, /* Use jest for unit tests. */

    /* NodeProjectCommonOptions */
    antitamper: false, /* Checks that after build there are no modified files on git. */
    buildWorkflow: true, /* Define a GitHub workflow for building PRs. */
    defaultReleaseBranch: 'main', /* The name of the main release branch. */
    majorVersion: 4,
    // cdkDependenciesAsDeps: false, not used with cdk 2.x
    peerDeps: [
        'aws-cdk-lib@^2.113.0',
        'constructs@^10.0.0',
        '@aws-cdk/lambda-layer-kubectl-v26@^2.0.1',
    ],
    devDeps: [
        '@types/jest',
        'aws-cdk-lib@^2.113.0',
        'constructs@^10.0.0',
        'typescript@~3.9.0',
        'cdk@^2.113.0',
        'typedoc@^0.23',
    ],

kaprah avatar Mar 04 '24 16:03 kaprah

Just want to +1 that I also get this warning in cdk version 2.238.0:

devDeps: [
    '@aws-cdk/[email protected]',
  ],

hakenmt avatar Feb 20 '26 01:02 hakenmt