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

fix(eks): fail to update cluster by disabling logging props #24688

Merged
merged 4 commits into from
Mar 21, 2023

Conversation

pahud
Copy link
Contributor

@pahud pahud commented Mar 19, 2023

When updating the EKS cluster by turning off LogType from clusterLogging, the custom resource of cluster resource handler fails because it does not add LogType with enabled: false in the LogSetup. For example, if we disable the logging like this:

const cluster = new eks.Cluster(this, 'Cluster', {
        vpc,
        version: eks.KubernetesVersion.V1_24,
        kubectlLayer: new KubectlLayer(this, 'KubectlLayer'),
        // clusterLogging: [
        //   eks.ClusterLoggingTypes.AUDIT,
        // ],
      })

The logging of oldProps would be

{logging: { clusterLogging: [  { types: ['audit'] , enabled: 'true' }] }

and the newProps would be

{logging: { }

while the expected argument for the updateClusterConfig should be

{logging: { clusterLogging: [  { types: ['audit'] , enabled: 'false' }] }

Similarly, if we update the clusterLogging from

  clusterLogging: [
     eks.ClusterLoggingTypes.AUDIT,
     eks.ClusterLoggingTypes.API,
   ],

to

  clusterLogging: [
     eks.ClusterLoggingTypes.API,
   ],

The argument should be:

{logging: { clusterLogging: [   { types: ['api'] , enabled: 'true' }, { types: ['audit'] , enabled: 'false' }, ] }

instead of

{logging: { clusterLogging: [   { types: ['api'] , enabled: 'true' } ] }

This PR adds a new compareLoggingProps() function that compares the logging configuration between oldProps and newProps and return an result object that contains LogSetup with enabled: false if any and this fixes the bug that fails to update the cluster with modified cluster logging.

While this PR includes unit tests, I have successfully tested the following use cases manually as well:

  • from no clusterLogging to clusterLogging with API and AUDIT
  • from clusterLogging with API and AUDIT to no clusterLogging
  • from clusterLogging with API and AUDIT to API only
  • from clusterLogging with API and AUDIT to AUTHENTICATE only
  • from clusterLogging with API and AUDIT to AUTHENTICATE and API only

This PR will not have integ tests update as it only happens when we update the stack with clusterLogging changes.

Closes #20779


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team March 19, 2023 13:05
@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p1 labels Mar 19, 2023
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Mar 19, 2023
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@pahud
Copy link
Contributor Author

pahud commented Mar 20, 2023

Exemption Request

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Mar 20, 2023
@MrArnoldPalmer MrArnoldPalmer added pr-linter/exempt-integ-test The PR linter will not require integ test changes and removed pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. labels Mar 20, 2023
@aws-cdk-automation aws-cdk-automation dismissed their stale review March 20, 2023 17:27

✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.

Copy link
Contributor

@MrArnoldPalmer MrArnoldPalmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @pahud !

@mergify
Copy link
Contributor

mergify bot commented Mar 20, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@madeline-k madeline-k enabled auto-merge (squash) March 21, 2023 16:47
@madeline-k madeline-k merged commit 767cf93 into aws:main Mar 21, 2023
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 90cfba0
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. contribution/core This is a PR that came from AWS. effort/small Small work item – less than a day of effort p1 pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(aws_eks): (EKS cluster_logging property makes cluster unmanageable)
4 participants