aws-quickstart / cdk-eks-blueprints

AWS Quick Start Team
Apache License 2.0
424 stars 188 forks source link

Handler creation fails for python version support removed #964

Open akshayvadher opened 2 months ago

akshayvadher commented 2 months ago

Describe the bug

We have been using the AWS CDK EKS blueprint for the past year and created a cluster about a year ago. I added all the versions in the description below.

We want to test some behavior and add extra things to the pipeline. So, we first tried to create a new cluster in our testing account before tweaking it to prod.

Expected Behavior

The same deployment should work without upgrading any versionThe same

Current Behavior

It started failing without any code change. Upon investigation, we discovered that it creates a nested stack and lambda handlers.

AWS discontinued support for Python 3.7, but the Blueprint statically provides that in the lambda. So now the cluster creation is stuck. We will have to upgrade the CDK (that has another risk of some more version incompatibility that is hard to describe in this issue)

Reproduction Steps

Create a cluster using the code provided below. (you might need to disable the logging if cluster is not created, that is another issue. I will may be create another issue).

Creation will throw following error for the nested (deleted) stack

Resource handler returned message: "The runtime parameter of python3.7 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (python3.12) while creating or updating functions. (Service: Lambda, Status Code: 400, Request ID: 9f0a2ef8-a702-48ec-9169-4eb9a728e3a3)" (RequestToken: 9d6b604d-3091-dc7c-f179-7725e386a1c1, HandlerErrorCode: InvalidRequest)

Possible Solution

Additional Information/Context

Adding package.json's relavant information

"dependencies": {
    "@aws-quickstart/eks-blueprints": "1.14.0",
    "aws-cdk": "2.133.0",
    "aws-cdk-lib": "2.133.0",
    "constructs": "^10.3.0",
    "source-map-support": "^0.5.21"
  },
  "overrides": {
    "@aws-quickstart/eks-blueprints": {
      "aws-cdk-lib": "$aws-cdk-lib",
      "aws-cdk": "$aws-cdk"
    }
  }

Code to create cluster

  const clusterProvider = new FargateClusterProvider({
      fargateProfiles,
      version: KubernetesVersion.V1_27,
      tags: props.tags,
    });

this.eksBlueprintStack = EksBlueprint.builder()
      .account(props.account)
      .region(props.region)
      .addOns(
        ...[
          new addons.AwsLoadBalancerControllerAddOn({ version: "1.6.1" }), // the version represents the helm chart version
          new addons.VpcCniAddOn({ version: "v1.15.0-eksbuild.2" }),
          new addons.CoreDnsAddOn("v1.10.1-eksbuild.4"),
          new addons.KubeProxyAddOn("v1.27.4-eksbuild.2"),
          new addons.FluxCDAddOn({
            version: "2.9.0",
            values: {
              sourceController: {
                extraEnv: [
                  { name: "AWS_DEFAULT_REGION", value: DEFAULT_REGION },
                  { name: "AWS_REGION", value: DEFAULT_REGION },
                ],
              },
              imageAutomationController: {
                create: false,
              },
              imageReflectionController: {
                create: false,
              },
              kustomizeController: {
                create: false,
              },
              notificationController: {
                create: false,
              },
            },
          }),
        ],
      )
      .clusterProvider(clusterProvider)
      .resourceProvider(GlobalResources.Vpc, new DirectVpcProvider(vpc))
      .useDefaultSecretEncryption(true)
      .enableControlPlaneLogTypes(
        ControlPlaneLogType.API,
        ControlPlaneLogType.AUDIT,
        ControlPlaneLogType.AUTHENTICATOR,
        ControlPlaneLogType.CONTROLLER_MANAGER,
        ControlPlaneLogType.SCHEDULER,
      )
      .name(stackName)
      .build(this, `${props.name}-${props.environment}-${props.role}-cluster`, {
        stackName,
      });

CDK CLI Version

2.133.0

EKS Blueprints Version

1.14.0

Node.js Version

20

Environment details (OS name and version, etc.)

Linux (AWS Pipeline)

Other information

No response