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

Add Addon resource to EKS provider #1153

Merged
merged 7 commits into from
Jun 5, 2024
Merged

Conversation

rquitales
Copy link
Member

Proposed Changes

In late 2020, AWS introduced EKS managed addons, which allow AWS to handle the management of cluster addons as part of the EKS lifecycle. This pull request integrates the upstream aws.eks.addon resource into our EKS provider, enhancing visibility and management of this resource.

By incorporating this resource, users will be able to manage addons such as coredns and kube-proxy, along with other supported addons. We chose not to create specific Pulumi resources for each addon, as doing so and exposing schema configurations as resource properties could be fragile with future schema changes. Additionally, user requests to create CoreDNS and kube-proxy resources were proposed before AWS managed addons were available, when self-management was necessary to keep these components up to date. VpcCni is another example of an addon that we also intend to transition to AWS management.

Testing:

  • Conducted manual testing to verify the successful installation and upgrade of new addons within a cluster
  • Updated existing TypeScript and MLC (Python) tests to include the installation of coredns as an addon

Related issues (optional)

Closes: #587
Closes: #253

@rquitales rquitales requested review from flostadler and a team May 16, 2024 23:51
@pulumi pulumi deleted a comment from github-actions bot May 17, 2024
@rquitales rquitales requested review from t0yv0 and blampe May 17, 2024 19:36
@pulumi pulumi deleted a comment from github-actions bot May 17, 2024
@pulumi pulumi deleted a comment from github-actions bot May 17, 2024
@pulumi pulumi deleted a comment from github-actions bot May 17, 2024
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.

New resources:

  • index.Addon

@rquitales
Copy link
Member Author

Tests are failing due to orphaned AWS resources. Will need to run the cleanup script before re-running the test suite.

examples/cluster-py/__main__.py Outdated Show resolved Hide resolved
nodejs/eks/addon.ts Show resolved Hide resolved
},
"configurationValues": {
TypeSpec: schema.TypeSpec{Type: "string"},
Description: "Custom configuration values for addons with single JSON string. This JSON string value must match the JSON schema derived from describe-addon-configuration.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don’t we change this to a map and serialize it for users?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated this to be a map and added additional integration tests for this.

constructor(name: string, args: AddonOptions, opts?: pulumi.CustomResourceOptions) {
const cluster = args.cluster;

super("eks:index:Addon", name, args, {
Copy link
Contributor

Choose a reason for hiding this comment

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

What’s the reason for making addons their own component vs making that an input to the eks cluster component?

This one is mostly wrapping the aws classic addon resource right now. Including it in the EKS component would make discoverability easier

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought some more about this and actually prefer this approach. The cluster resource is already quite overloaded with parameters and the addon is very self-contained.

Copy link

github-actions bot commented Jun 3, 2024

Does the PR have any schema changes?

Looking good! No breaking changes found.

New resources:

  • index.Addon

@pulumi pulumi deleted a comment from github-actions bot Jun 4, 2024
@t0yv0
Copy link
Member

t0yv0 commented Jun 4, 2024

Quick question about these addons.

We have some related code in pulumi-aws:

pulumi/pulumi-aws#3009
pulumi/pulumi-aws#2720
pulumi/pulumi-aws#2732

Does this change look good in light of this code? Does it interact with defaultAddonsToRemove or should it? Thanks.

name,
{
...args,
clusterName: cluster.core.cluster.name,
Copy link
Member

Choose a reason for hiding this comment

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

So, question, genuinely curious what's the benefit of wrapping aws.eks.Addon in a component Addon?

Can users use a vanilla aws.eks.Addon right now already without this helper?

Perhaps we have some more functionality we expect to land in this wrapper?

Is this automatically setting parent? Or removing deprecated properties? Or is it automatic JSON.stringify?

Can we bake any of this directly in AWS Addon or a bad idea?

Copy link
Member Author

Choose a reason for hiding this comment

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

The main reason to expose aws.eks.Addon within this EKS provider is for visibility that users can use AWS managed addons with EKS. This also means that users won't need to have fragmented code that uses resources from both the AWS or EKS providers. Initially, the ask was for us to provide wrappers over the CoreDNS and kube-proxy addons. We decided against that since it would be a maintenance burden to keep up with any schema changes that newer versions of these addons might incur, while also maintaining support of the older addon versions.

This PR already introduces some additional functionality, such as automatic JSON.stringify as well.

clusterName: cluster.core.cluster.name,
configurationValues: JSON.stringify(args.configurationValues),
},
{ parent: this, provider: opts?.provider },
Copy link
Member

Choose a reason for hiding this comment

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

What if we have provders: {"aws": awsProv}? I think actually this might work already and provider:* might be redundant as it will inherit via parent: this, we were investigating resetting AWS versions underneath the awsx provider and https://github.com/pulumi/pulumi-awsx?tab=readme-ov-file#custom-aws-provider-versions it works fine while all the provider does is setting {parent: this}.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good to know! I was mostly following the existing pattern we have for other resources that we wrap. Since the outcome is the same, I'll keep it as is for now to maintain consistency in the codebase.

@t0yv0 t0yv0 self-requested a review June 4, 2024 17:55
Copy link
Member

@t0yv0 t0yv0 left a comment

Choose a reason for hiding this comment

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

The PR Looks great, thank you, learned a few TypeScript tricks here.

One higher level question I have is why we decided to wrap aws.eks.Addon in the first place, perhaps we can document internally for posterity, it looks like some thought was put into it though. I'd just appreciate reading into it more to inform future decisions of this sort.

Copy link

github-actions bot commented Jun 4, 2024

Does the PR have any schema changes?

Looking good! No breaking changes found.

New resources:

  • index.Addon

@rquitales rquitales merged commit e2cff0f into master Jun 5, 2024
42 checks passed
@rquitales rquitales deleted the rquitales/managed-addons branch June 5, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EKS Add-on support (coredns, etc) Support CoreDNS and KubeProxy updates
4 participants