Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws-eks: Recent change breaks update of existing clusters #21436

Closed
resnikb opened this issue Aug 3, 2022 · 1 comment · Fixed by #21463
Closed

aws-eks: Recent change breaks update of existing clusters #21436

resnikb opened this issue Aug 3, 2022 · 1 comment · Fixed by #21463
Assignees
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug. p1

Comments

@resnikb
Copy link

resnikb commented Aug 3, 2022

Describe the bug

The recent change made in PR #21185 to support logging changes, breaks updates of existing clusters.

Our EKS cluster was created with v2.27 of aws-cdk, and has the following in CF template:

 "logging": {
      "clusterLogging": [
       {
        "enabled": true,
        "types": [
         "api",
         "audit",
         "authenticator",
         "controllerManager",
         "scheduler"
        ]
       }

The PR assumes that there are two elements inside clusterLogging array.

Expected Behavior

The cluster update works without failing.

Current Behavior

Upgrading to CDK 2.35 fails with an error:

Received response status [FAILED] from custom resource. Message returned: Cannot read property 'enabled' of undefined 
Logs: /aws/lambda/XXXX-OnEventHandler42BEBAE0-vzZCvYNs29A1 
    at parseProps (/var/task/cluster.js:1:6085) 
    at new ClusterResourceHandler (/var/task/cluster.js:1:368) 
    at createResourceHandler (/var/task/index.js:1:1642) 
    at Runtime.onEvent [as handler] (/var/task/index.js:1:1361) 
    at Runtime.handleOnceNonStreaming (/var/runtime/Runtime.js:73:25)

Reproduction Steps

To reproduce the bug, create the following cluster with 2.27, deploy, and upgrade CDK to 2.35:

   new Cluster(stack, 'Cluster', {
      clusterName: 'MyCluster',
      version: KubernetesVersion.V1_21,
      vpc,
      clusterLogging: [
        ClusterLoggingTypes.API,
        ClusterLoggingTypes.AUDIT,
        ClusterLoggingTypes.AUTHENTICATOR,
        ClusterLoggingTypes.CONTROLLER_MANAGER,
        ClusterLoggingTypes.SCHEDULER,
      ],
    });

Possible Solution

The resource handler code should check the size of the clusterLogging array before accessing the new element.

Additionally, although this may be a separate bug, the line 294 from the PR looks suspicious:

parsed.logging.clusterLogging[1].enabled = parsed.logging.clusterLogging[1].enabled === 'false';

It seems that enabled will be set to true only if it is "false" in the template?

This should also possible change to

parsed.logging.clusterLogging[1].enabled = parsed.logging.clusterLogging[1].enabled === 'true';

Additional Information/Context

No response

CDK CLI Version

2.35.0 (build 5c23578)

Framework Version

No response

Node.js Version

v16.16.0

OS

Linux

Language

Typescript

Language Version

No response

Other information

No response

@resnikb resnikb added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 3, 2022
@github-actions github-actions bot added the @aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service label Aug 3, 2022
guessi added a commit to guessi/aws-cdk that referenced this issue Aug 3, 2022
guessi added a commit to guessi/aws-cdk that referenced this issue Aug 4, 2022
@TheRealAmazonKendra TheRealAmazonKendra added p1 and removed needs-triage This issue or PR still needs to be triaged. labels Aug 4, 2022
@mergify mergify bot closed this as completed in #21463 Aug 4, 2022
mergify bot pushed a commit that referenced this issue Aug 4, 2022
…#21463)

introduced by #21185

Fixes: #21436

----

### All Submissions:

* [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [X] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [X] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [X] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Aug 4, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

josephedward pushed a commit to josephedward/aws-cdk that referenced this issue Aug 30, 2022
…aws#21463)

introduced by aws#21185

Fixes: aws#21436

----

### All Submissions:

* [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [X] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [X] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [X] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants