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: Example of AWS CodeCommit as a repository for ArgoCD workloads #1509

Closed
wants to merge 10 commits into from

Conversation

ybezsonov
Copy link

@ybezsonov ybezsonov commented Mar 24, 2023

What does this PR do?

Create AWS Codecommit repository
Copy sample workloads repository from Github and push to AWS Codecommit
Create AWS Codecommit credentials and configure ArgoCD to use them via Secret to access AWS Codecommit repository
Create AWS Codecommit trigger to execute AWS Lambda function to call ArgoCD webhook

Motivation

More

  • Yes, I have tested the PR using my local account setup (Provide any test evidence report under Additional Notes)
  • Yes, I have updated the docs for this feature
  • Yes, I ran pre-commit run -a with this PR

For Moderators

  • E2E Test successfully complete before merge?

Additional Notes

@ybezsonov ybezsonov requested a review from a team as a code owner March 24, 2023 15:51
@ybezsonov ybezsonov changed the title Example of AWS CodeCommit as a repository for ArgoCD workloads [feat] Example of AWS CodeCommit as a repository for ArgoCD workloads Mar 24, 2023
@ybezsonov ybezsonov changed the title [feat] Example of AWS CodeCommit as a repository for ArgoCD workloads feat: Example of AWS CodeCommit as a repository for ArgoCD workloads Mar 24, 2023
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.

Good start, see the feedback provided

@@ -0,0 +1,170 @@
# EKS Cluster with ArgoCD and Workloads in private AWS CodeCommit repository

This example shows how to provision an EKS cluster with:
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets add in why this pattern is useful to users - what would be the primary motivation to use CodeCommit, why any additional steps are necessary to integrate with CodeCommit, etc.

#---------------------------------------------------------------
# ARGOCD WORKLOAD APPLICATION
#---------------------------------------------------------------
# workload_repo = "https://github.com/aws-samples/eks-blueprints-workloads.git"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't quite follow what is happening here - what should users do, what sequence of events, etc.

workload_repo = aws_codecommit_repository.workloads_repo_cc.clone_url_http
```

Update main.tf and enable workloads and addons (if not enabled yet).
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do they need to change this, shouldn't this just be set in the pattern/example?

- Configure kubectl using output

```sh
terraform output configure_kubectl
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy boiler plate text from other examples - this looks a bit different here

- Clone [EKS Blueprints Workloads Repo](https://github.com/aws-samples/eks-blueprints-workloads) from Github to AWS CodeCommit (clone2cc.sh)

```sh
pushd ../../../..
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Why do we need to go up to root?
  2. We should ensure any local copies are cleaned up

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Why only copy over the workloads repo? What about the repository where the Terraform code is defined (i.e. - eks-blueprints), and the repository where the ArgoCD manifests are located (i.e. - eks-addons)?

user_name = aws_iam_user.argocd_user.name
}

resource "aws_iam_user_policy" "argocd_user_codecommit_ro" {
Copy link
Contributor

Choose a reason for hiding this comment

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

switch this to create an standalone policy and not an inline policy

]
}

resource "kubectl_manifest" "repo_creds_platform_https" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets switch this to create a secret in SecretManager and use external secrets to pull

trigger {
name = "all"
events = ["all"]
custom_data = var.argocd_url
Copy link
Contributor

Choose a reason for hiding this comment

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

map output here to replace variable which will map an implicit dependency (i.e. - can then remove the depends_on)

})
}

resource "aws_iam_role" "iam_for_lambda" {
Copy link
Contributor

Choose a reason for hiding this comment

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

All of the lambda resources can be removed - not required for this example, ArgoCD will sync

@@ -0,0 +1,98 @@
resource "aws_codecommit_repository" "workloads_repo_cc" {
repository_name = "eks-blueprints-workloads-cc"
Copy link
Contributor

Choose a reason for hiding this comment

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

this would be a good local variable

@github-actions
Copy link
Contributor

This PR has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this PR will be closed in 10 days

@github-actions github-actions bot added the stale label Apr 29, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 9, 2023

Pull request closed due to inactivity.

@github-actions github-actions bot closed this May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Example of AWS CodeCommit as a repository for ArgoCD workloads
3 participants