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

AddOn - AWS Secrets Manager and Config Provider for Secret Store CSI Driver #471

Merged
merged 27 commits into from
Jun 29, 2022

Conversation

anshrma
Copy link
Contributor

@anshrma anshrma commented Apr 25, 2022

What does this PR do?

This PR adds two Kubernetes add-on , (1) AWS Secrets Manager and Config Provider for Secret Store CSI Driver (2) Secrets Store CSI Driver

Motivation

AWS partner needing this add on to complete their development work.
Closes #435

More

  • [ Y] Yes, I have tested the PR using my local account setup (Provide any test evidence report under Additional Notes)
  • [ Y ] Yes, I have added a new example under examples to support my PR
  • [ NA ] Yes, I have created another PR for add-ons under add-ons repo (if applicable)
  • [ Y] Yes, I have updated the docs for this feature
  • Yes, I ran pre-commit run -a with this PR

Note: Not all the PRs required examples and docs except a new pattern or add-on added.

For Moderators

  • E2E Test successfully complete before merge?

Additional Notes

Copy link
Contributor

@vara-bonthu vara-bonthu left a comment

Choose a reason for hiding this comment

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

Great work @anshrma ! LGTM 👍🏼

Few minor changes requested. We just need to run some E2E tests before merging the PR

@anshrma
Copy link
Contributor Author

anshrma commented Apr 26, 2022

Great work @anshrma ! LGTM 👍🏼

Few minor changes requested. We just need to run some E2E tests before merging the PR

Thanks @vara-bonthu - Addressed your feedbacks.

Copy link
Contributor

@naris-silpakit naris-silpakit left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@bryantbiggs bryantbiggs left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Please update your branch with the latest on main as there have been a number of changes to the examples/ format

@@ -0,0 +1,131 @@
# EKS Cluster Deployment with new VPC
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of creating a whole new example just for these two addons, instead can we just add their implementation into the https://github.com/aws-ia/terraform-aws-eks-blueprints/tree/main/examples/complete-kubernetes-addons

Copy link
Contributor

Choose a reason for hiding this comment

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

@askulkarni2 / @kcoleman731 what are your thoughts on this as we continue to expand the number of addons?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @bryantbiggs . We should start moving the individual Add-on examples to [complete-kubernetes-addons](https://github.com/aws-ia/terraform-aws-eks-blueprints/tree/main/examples/complete-kubernetes-addons) . This will help us to manage limited exmaples

Copy link
Contributor

Choose a reason for hiding this comment

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

We can add some more details to docs .md files as well. New users should be able to goto docs to findout the usage of this Add-on.

@@ -0,0 +1,11 @@
data "aws_iam_policy_document" "secrets_management_policy" {
Copy link
Contributor

Choose a reason for hiding this comment

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

when you move this over to the complete-kubernetes-addons example, no need to put this in a separate file. Instead, locate it next to where it is used. Here that would be either before or after https://github.com/aws-ia/terraform-aws-eks-blueprints/pull/471/files#diff-6355537d0664dc024a0086c9581f3a707332dd67c563f98cbe5ee18d4fd0e44bR164

modules/kubernetes-addons/secrets-store-csi-driver/main.tf Outdated Show resolved Hide resolved
Copy link
Contributor

@askulkarni2 askulkarni2 left a comment

Choose a reason for hiding this comment

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

First of all thanks so much for this PR! The PR is looking good. There is one main outstanding design item. We probably want to keep the secrets provisioning design similar to how we do in CDK (if possible). Refer to https://github.com/aws-quickstart/cdk-eks-blueprints/blob/main/docs/extensibility.md#passing-secrets-to-add-ons.

docs/add-ons/csi-secrets-store-provider-aws.md Outdated Show resolved Hide resolved
docs/add-ons/csi-secrets-store-provider-aws.md Outdated Show resolved Hide resolved
docs/add-ons/csi-secrets-store-provider-aws.md Outdated Show resolved Hide resolved
# Creating IAM Role for Service Account
#---------------------------------------------------------------

module "iam_role_service_account" {
Copy link
Contributor

Choose a reason for hiding this comment

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

So, the problem here is that the addon itself has no clue what secrets are being retrieved. The way it works, secrets are retrieved by the AWS provider when a pod needing those secrets is started and removed afterwords. The service-account associated with the respective pods needs to have the needed IRSA config. These policies cannot be added to the addon. In CDK, we do this when the Team or AddOn secrets are defined. The same thing needs to happen here. That is to say, in order to consume secrets, there are two paths:

  1. You need to define your secrets via Teams configuration (similar to how we do labels and quotas today and we will have to update the Teams module for this). We need to add the required policies to the IRSA config we define for the Team.
  2. For add-ons, this will be a parameter for the add-on in which case we will add the required policies to the addons IRSA config.

CC: @kcaws @shapirov103 I am assuming we want to keep the design for secrets somewhat similar between the two projects.

modules/kubernetes-addons/secrets-store-csi-driver/main.tf Outdated Show resolved Hide resolved
@anshrma anshrma requested a review from Zvikan as a code owner May 24, 2022 21:46
Copy link
Contributor

@askulkarni2 askulkarni2 left a comment

Choose a reason for hiding this comment

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

@anshrma looking good, just one final change for using namespace resource instead of irsa module as suggested by Vara. Also please address the CI failures. Running pre-commit run -a should fix most of them.

@anshrma
Copy link
Contributor Author

anshrma commented Jun 14, 2022

@anshrma looking good, just one final change for using namespace resource instead of irsa module as suggested by Vara. Also please address the CI failures. Running pre-commit run -a should fix most of them.

Thanks @askulkarni2 . Done with the changes requested and addressed the CI failures. Please let me know, if any other changes required.

@BlZvi
Copy link

BlZvi commented Jun 28, 2022

Hey @anshrma, @askulkarni2 and @bryantbiggs, Whaat is missing in this PR to go forward?

@askulkarni2 askulkarni2 temporarily deployed to EKS Blueprints Test June 28, 2022 22:34 Inactive
@askulkarni2 askulkarni2 temporarily deployed to EKS Blueprints Test June 29, 2022 05:07 Inactive
Copy link
Contributor

@askulkarni2 askulkarni2 left a comment

Choose a reason for hiding this comment

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

Updated, tested and approved!

@askulkarni2 askulkarni2 temporarily deployed to EKS Blueprints Test June 29, 2022 05:12 Inactive
@askulkarni2 askulkarni2 temporarily deployed to EKS Blueprints Test June 29, 2022 18:28 Inactive
@askulkarni2 askulkarni2 temporarily deployed to EKS Blueprints Test June 29, 2022 20:40 Inactive
@askulkarni2 askulkarni2 temporarily deployed to EKS Blueprints Test June 29, 2022 20:57 Inactive
@askulkarni2 askulkarni2 merged commit 472de70 into aws-ia:main Jun 29, 2022
allamand pushed a commit to allamand/terraform-aws-eks-blueprints that referenced this pull request Dec 15, 2022
…Driver (aws-ia#471)

Co-authored-by: Bryant Biggs <bryantbiggs@gmail.com>
Co-authored-by: Apoorva Kulkarni <kuapoorv@amazon.com>
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.

[ADDON] - AWS Secrets Manager
6 participants