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: Make gitops-bridge example to use kubectl to deploy addons and workloads #1886

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions patterns/gitops/getting-started-argocd/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,6 @@ locals {
}
)

argocd_app_of_appsets_addons = var.enable_gitops_auto_addons ? {
addons = file("${path.module}/bootstrap/addons.yaml")
} : {}
argocd_app_of_appsets_workloads = var.enable_gitops_auto_workloads ? {
workloads = file("${path.module}/bootstrap/workloads.yaml")
} : {}

argocd_apps = merge(local.argocd_app_of_appsets_addons, local.argocd_app_of_appsets_workloads)


tags = {
Blueprint = local.name
GithubRepo = "github.com/aws-ia/terraform-aws-eks-blueprints"
Expand All @@ -147,7 +137,6 @@ module "gitops_bridge_bootstrap" {
metadata = local.addons_metadata
addons = local.addons
}
apps = local.argocd_apps
}

################################################################################
Expand Down
12 changes: 0 additions & 12 deletions patterns/gitops/getting-started-argocd/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,3 @@ variable "gitops_workload_path" {
type = string
default = "getting-started-argocd/k8s"
}

variable "enable_gitops_auto_addons" {
description = "Automatically deploy addons"
type = bool
default = false
}

variable "enable_gitops_auto_workloads" {
description = "Automatically deploy addons"
type = bool
default = false
}
26 changes: 23 additions & 3 deletions patterns/gitops/multi-cluster-hub-spoke-argocd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,20 @@ that temporary file with the `kubectl` configuration. This approach offers the
advantage of not altering your existing `kubectl` context, allowing you to work
in other terminal windows without interference.

### Monitor GitOps Progress for Addons
### Deploy ArgoCD Apps of ApplicationSets for Addons

This command verifies the initial ArgoCD installation, ArgoCD will be re-configured when the addons are deployed and configured from git.
```shell
kubectl --context hub get all -n argocd
```
This command creates the application set manifest to deploy the addons.
```shell
kubectl --context hub apply -n argocd -f ../hub/bootstrap/addons.yaml
```
Comment on lines +68 to +71
Copy link
Contributor

Choose a reason for hiding this comment

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

change to kubectl apply with Terraform

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@candonov I don't understand the comment

change to kubectl apply with Terraform

In all our patterns now, we moved away from using terraform providers like kubernertes, helm, or kubectl and instead tell the user to use kubectl apply this way is easier to understand like we have in the single cluster gitops-bridge pattern here https://github.com/aws-ia/terraform-aws-eks-blueprints/tree/main/patterns/gitops/getting-started-argocd#deploy-the-addons

The application sets defined here will then deploy addons to any spoke clusters provisioned later using Terraform


### Monitor GitOps Progress for Addons on Hub EKS Cluster

Wait until all the ArgoCD applications' `HEALTH STATUS` is `Healthy`.
Use `Ctrl+C` or `Cmd+C` to exit the `watch` command. ArgoCD Applications
Expand Down Expand Up @@ -164,15 +177,22 @@ The output have a section `awsAuthConfig` with the `clusterName` and the `roleAR

### Verify the Addons on Spoke Clusters

Verify that the addons are ready:
The addons on the spoke clusters are deployed using the Application Sets created on the EKS Hub Cluster. Verify that the addons are ready:

```shell
for i in dev staging prod ; do echo $i && kubectl --context $i get deployment -n kube-system ; done
```

### Deploy the sample application to EKS Spoke Clusters

This command will deploy the application using kubectl to all clusters connected to the hub cluster, using the manifest files in [./hub/bootstrap/workloads.yaml](./hub/bootstrap/workloads.yaml).
```shell
kubectl --context hub apply -n argocd -f ../hub/bootstrap/workloads.yaml
```
Comment on lines +188 to +191
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, apply with terraform


### Monitor GitOps Progress for Workloads from Hub Cluster (run on Hub Cluster context)

Watch until **all* the Workloads ArgoCD Applications are `Healthy`
Watch until all the Workloads ArgoCD Applications are `Healthy`

```shell
kubectl --context hub get -n argocd applications -w
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ spec:
- clusters:
selector:
matchExpressions:
- key: akuity.io/argo-cd-cluster-name
operator: NotIn
values: [in-cluster]
- key: environment
operator: NotIn
values: [control-plane]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ locals {
}
)

argocd_apps = {
addons = file("${path.module}/bootstrap/addons.yaml")
workloads = file("${path.module}/bootstrap/workloads.yaml")
}

tags = {
Blueprint = local.name
GithubRepo = "github.com/gitops-bridge-dev/gitops-bridge"
Expand All @@ -141,7 +136,7 @@ module "gitops_bridge_bootstrap" {
metadata = local.addons_metadata
addons = local.addons
}
apps = local.argocd_apps

argocd = {
namespace = local.argocd_namespace
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ else
fi

terraform workspace select $env
terraform workspace list
terraform init
terraform apply -var-file="workspaces/${env}.tfvars"
Loading