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

feat(eks): alb controller include versions 2.4.2 - 2.5.1 #25330

Merged
merged 26 commits into from
May 15, 2023

Conversation

colifran
Copy link
Contributor

@colifran colifran commented Apr 27, 2023

Motivation:

We should provide users with all available ALB controller versions for use with aws-eks. This change does not prohibit users from using previous ALB controller versions. Instead, this adds support for versions 2.4.2 - 2.5.1. Previous ALB controller versions can be specified by using the static "of" method as part of the AlbControllerVersion class, e.g., AlbControllerVersion.of().

Testing:

Updated existing ALB controller integrity test to use ALB controller version 2.5.1.

Closes #25307


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

Francis added 6 commits April 26, 2023 08:56
Signed-off-by: Francis <colifran@3c22fbbba690.ant.amazon.com>
Signed-off-by: Francis <colifran@3c22fbbba690.ant.amazon.com>
Signed-off-by: Francis <colifran@3c22fbbba690.ant.amazon.com>
…nstead of v2.4.4

Signed-off-by: Francis <colifran@3c22fbbba690.ant.amazon.com>
…ion and updated snapshots from integ testing

Signed-off-by: Francis <colifran@3c22fbbba690.ant.amazon.com>
Signed-off-by: Francis <colifran@3c22fbbba690.ant.amazon.com>
@gitpod-io
Copy link

gitpod-io bot commented Apr 27, 2023

@aws-cdk-automation aws-cdk-automation requested a review from a team April 27, 2023 01:06
@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 labels Apr 27, 2023
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Apr 27, 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.

Signed-off-by: Francis <colifran@3c22fbbba690.ant.amazon.com>
@colifran colifran changed the title Updated alb controller versions to include versions 2.4.2 - 2.5.1 chore(aws-eks): Updated alb controller versions to include versions 2.4.2 - 2.5.1 Apr 27, 2023
@colifran colifran changed the title chore(aws-eks): Updated alb controller versions to include versions 2.4.2 - 2.5.1 feat(aws-eks): Updated alb controller versions to include versions 2.4.2 - 2.5.1 Apr 27, 2023
@colifran colifran changed the title feat(aws-eks): Updated alb controller versions to include versions 2.4.2 - 2.5.1 feat(eks): Updated alb controller versions to include versions 2.4.2 - 2.5.1 Apr 27, 2023
@aws-cdk-automation aws-cdk-automation dismissed their stale review April 27, 2023 01:18

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

Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

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

I have some minor thoughts but other than that this looks good!

Signed-off-by: Francis <colifran@amazon.com>
@kaizencc kaizencc changed the title feat(eks): Updated alb controller versions to include versions 2.4.2 - 2.5.1 feat(eks): alb controller include versions 2.4.2 - 2.5.1 Apr 28, 2023
Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

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

Lets give until Monday for @iliapolo to take a look, because I do find it weird to have a different policy per version and I didn't have time to investigate further.

In the meantime, I think the PR description could use an update (and note that users could specify these versions on their own via the AlbControllerVersion.of() method so we're not actually denying any uses these versions atm.

Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

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

Looks good!

@mergify
Copy link
Contributor

mergify bot commented May 4, 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).

Copy link

@djnalluri djnalluri left a comment

Choose a reason for hiding this comment

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

These changes may not be enough to support version 2.5.0 and above. The release notes mention incompatibilities with deployment manifests from previous versions.

/**
* v2.5.1
*/
public static readonly V2_5_1 = new AlbControllerVersion('v2.5.1', false);

Choose a reason for hiding this comment

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

I have tried using .of('v2.5.1') with a custom policy. It is able to deploy, however, the pods cannot start up because they don't have the required permissions for the K8s Lease API that were added in version 1.5.0 of the helm chart. I would suggest adding an extra constructor parameter for the chart version. The appropriate chart can then be picked per ALB version instead of the hardcoded 1.4.1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this! I will work on addressing it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Because of this, it's not good enough to default helm version to 1.4.1 everywhere. That would mean that if someone wanted to do this:

new AlbController(this, 'blah', {
  version: AlbControllerVersion.V2_5_1,
});

Somewhere along the line it would fail because it's not compatible with helm 1.4.1. So we'd force the user to have to do something like:

new AlbController(this, 'blah', {
  version: AlbControllerVersion.V2_5_1,
  helmChart: HelmChartVersion.V1_5_0,
});

Even though we know what helm chart version would be compatible. So we should be able to add the default in for the user.

In practice that means that we add a prop to the constructor of AlbControllerVersion called helmChartVersion.

class AlbControllerVersion {
  public static readonly V2_5_1 = new AlbControllerVersion('v2.5.1', HelmChartVersion.V1.5.0, false);
  private constructor(public readonly version: string, public readonly helmChart, public readonly custom: boolean) {}
}

// where we need it, we can do
props.albControllerVersion.helmChart;

None of this should be a breaking change since the constructor for AlbContrllerVersion is private

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, Kaizen. This makes sense. I've what I think are the necessary updates for the AlbControllerVersion class to support the addition of helmChartVersion in the constructor

@kaizencc kaizencc added the pr/do-not-merge This PR should not be merged at this time. label May 4, 2023
… AlbControllerProps interface

Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
…and updated associated code - added helmChartVersion to alb-controller unit test

Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
@kaizencc kaizencc self-requested a review May 10, 2023 21:39
@kaizencc kaizencc force-pushed the colifran/alb-controller-versions branch from 6389e5b to 9506b6f Compare May 10, 2023 21:40
Signed-off-by: Francis <colifran@amazon.com>
Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

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

A couple more comments :)

/**
* The version of the helm chart to use.
*/
readonly helmChartVersion: HelmChartVersion;
Copy link
Contributor

Choose a reason for hiding this comment

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

adding this is a breaking change. It should be optional and default to 1.4.1 so that we dont break people

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this - I've removed this and added it to the AlbControllerVersion constructor to allow this to support current users.

@@ -67,5 +69,6 @@ test('throws when a policy is not defined for a custom version', () => {
expect(() => AlbController.create(stack, {
cluster,
version: AlbControllerVersion.of('custom'),
helmChartVersion: HelmChartVersion.V1_4_1,
Copy link
Contributor

Choose a reason for hiding this comment

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

having to add these here is the breaking change. once you make it optional, be sure to remove these

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

/**
* v1.4.0
*/
V1_4_0 = '1.4.0',
Copy link
Contributor

Choose a reason for hiding this comment

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

Anyone using these old versions of helm? I think we can get by with an enum-like class here too:

class HelmChartVersion {
  public static V1_4_1 = new HelmChartVersion('1.4.1');
  public static V1_5_1 = new HelmChartVersion('1.5.1');

  public constructor(public version: string) {}
}

Let people just specify their other versions I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I opted against using an enum-like class here though. I'm wondering if this would be too much abstraction for what would essentially just be a string? Instead, I decided to hard code the helm chart version for the static alb controller versions that create instances of the alb controller class similar to the already hard coded alb controller version that is passed to the constructor.

/**
* v2.5.1
*/
public static readonly V2_5_1 = new AlbControllerVersion('v2.5.1', false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Because of this, it's not good enough to default helm version to 1.4.1 everywhere. That would mean that if someone wanted to do this:

new AlbController(this, 'blah', {
  version: AlbControllerVersion.V2_5_1,
});

Somewhere along the line it would fail because it's not compatible with helm 1.4.1. So we'd force the user to have to do something like:

new AlbController(this, 'blah', {
  version: AlbControllerVersion.V2_5_1,
  helmChart: HelmChartVersion.V1_5_0,
});

Even though we know what helm chart version would be compatible. So we should be able to add the default in for the user.

In practice that means that we add a prop to the constructor of AlbControllerVersion called helmChartVersion.

class AlbControllerVersion {
  public static readonly V2_5_1 = new AlbControllerVersion('v2.5.1', HelmChartVersion.V1.5.0, false);
  private constructor(public readonly version: string, public readonly helmChart, public readonly custom: boolean) {}
}

// where we need it, we can do
props.albControllerVersion.helmChart;

None of this should be a breaking change since the constructor for AlbContrllerVersion is private

…ue based on alb controller version - added helm chart version with 1.4.1 as default to static of method - reverted changes made to unit tests

Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
…ion class

Signed-off-by: Francis <colifran@amazon.com>
Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

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

@colifran one last thing. i think we need to add a unit test that tests that when you specify AlbControllerVersion.V2_5_1 you get the corresponding helm chart 1.5.2. That should be doable by looking through the properties of Custom::AWSCDK-EKS-HelmChart in the template.

You're doing this already in the integ test so its not like I think it won't succeed. I just think it's important to have a unit test for this actually new functionality you are adding.

…te based on selected alb controller version

Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
@kaizencc kaizencc removed the pr/do-not-merge This PR should not be merged at this time. label May 15, 2023
@mergify
Copy link
Contributor

mergify bot commented May 15, 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).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify mergify bot merged commit 83c4c36 into main May 15, 2023
7 checks passed
@mergify mergify bot deleted the colifran/alb-controller-versions branch May 15, 2023 21:59
@mergify
Copy link
Contributor

mergify bot commented May 15, 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

eks: Update AlbControllerVersions to add missing versions between 2.4.1 and 2.5.x
4 participants