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: add pattern for ArgoCD workloads in AWS CodeCommit #158

Merged
merged 2 commits into from
Jan 9, 2024

Conversation

ybezsonov
Copy link

Issue #, if available:

Description of changes:

  • add pattern for ArgoCD workloads in AWS CodeCommit
  • setup to trigger ArgoCD projects sync on git push to AWS CodeCommit repository

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ybezsonov
Copy link
Author

ybezsonov commented Jan 5, 2024

@shapirov103 @elamaran11
I closed old PR, reworked the pattern and created new PR. I created documentation and the flow is similar to other patterns.

Copy link
Contributor

@shapirov103 shapirov103 left a comment

Choose a reason for hiding this comment

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

@ybezsonov
Awesome work!

I was able to validate end to end.

I have a couple of minor comments inline with the code/docs.

One thing that I wanted to bring up as a suggestion: for our patterns we follow the rule of "zero trust", meaning customers should not require any mutating access to the cluster (like creation of secrets, etc.), everything is done through IaC.

To align with that, please consider the following refactoring:

  1. Create IAM user using CLI, then generate credentials and store them as a secret (along with username and url).
  2. Pass the secret name with the bootstrapRepo to ArgoCD addon as described in the private repos section.
  3. You can still look up the user in the stack and grant pull permission.

The above is just a suggestion, I will be happy to merge as is, since this functionality is awesome and I can reuse some of it in the workshops now.

@@ -0,0 +1,40 @@
import { Construct } from 'constructs';
Copy link
Contributor

Choose a reason for hiding this comment

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

minor - file names should be lower case, "-" delimited.

Copy link
Author

Choose a reason for hiding this comment

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

fixed.

```bash
pushd ..
git clone https://github.com/aws-samples/eks-blueprints-workloads.git
git clone codecommit::$AWS_REGION://$CC_REPO_NAME
Copy link
Contributor

Choose a reason for hiding this comment

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

let's call out that AWS_REGION env var must be defined (or add a statement to initialize it from local config if not defined).

Copy link
Author

Choose a reason for hiding this comment

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

fixed.

@ybezsonov
Copy link
Author

@shapirov103 Thank you!
I found a solution to create CodeCommit credentials using cdk custom resources and now all the required resources for ArgoCD are created within the stack. Outside of the stack I just clone the repository and create notification trigger from CodeCommit to ArgoCD.
It also gives a possibility to delete all the resources (user, credentials) during the deletion of the stack.

Copy link
Contributor

@shapirov103 shapirov103 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, bar-raising, thank you for this contribution!

(validated e2e with a clean stack, all works).

@shapirov103 shapirov103 merged commit b6ad0ca into aws-samples:main Jan 9, 2024
2 checks passed
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.

2 participants