Skip to content

Commit

Permalink
Refactor for kubecon (#35)
Browse files Browse the repository at this point in the history
refactor for kubecon na 2023
  • Loading branch information
csantanapr authored Oct 29, 2023
1 parent 40227ea commit 45bad15
Show file tree
Hide file tree
Showing 78 changed files with 2,534 additions and 1,289 deletions.
51 changes: 31 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
# GitOps Bridge

The GitOps Bridge is a community project to show best practices and patterms on how to bridge the process of creating a Kubernetes Cluster to then delegate everything after that to GitOps using [ArgoCD](https://www.cncf.io/projects/argo/) or [FluxCD](https://www.cncf.io/projects/flux/) both CNCF graduated projects.
The [GitOps Bridge](https://github.com/gitops-bridge-dev/gitops-bridge) is a community project that aims to showcase best practices and patterns for bridging the process of creating a Kubernetes cluster to subsequently managing everything through GitOps. It focuses on using [ArgoCD](https://www.cncf.io/projects/argo/) or [FluxCD](https://www.cncf.io/projects/flux/), both of which are CNCF-graduated projects.

See the git repository [GitOps Control Plane](https://github.com/gitops-bridge-dev/gitops-bridge-argocd-control-plane-template) for an example template on bootstrapping ArgoCD
For an example template on bootstrapping ArgoCD, see the GitHub repository [GitOps Control Plane](https://github.com/gitops-bridge-dev/gitops-bridge-argocd-control-plane-template).

There are many tools to create Kubernetes clusters, this include roll your own like kubeadmin/minikube/kind or a cloud managed service like Amazon EKS. It should not matter how the the cluster is created in terms of GitOps, GitOps engines should be compatible with any tool that the user choose to use to create the cluster include cases using Kubernetes to create other Kubernetes clusters like CAPI/CAPA, Crossplane, ACK, or any tool running inside Kubernetes to deploy Kubernetes.
There are many tools available for creating Kubernetes clusters. These include "roll-your-own" solutions like `kubeadm`, `minikube`, and `kind`, as well as cloud-managed services like Amazon EKS. The method of cluster creation should not impact GitOps compatibility; GitOps engines should work with any tool that the user chooses for cluster creation. This includes scenarios where Kubernetes is used to create other Kubernetes clusters, such as with CAPI/CAPA, Crossplane, ACK, or any tool running inside Kubernetes to deploy Kubernetes.

The GitOps Bridge becomes extremely important for cloud managed kubernetes, this cluster have integrations with cloud services. When using GitOps to install a tool in this cases, the tool usually via helm needs to be configure with metadata about resources or workload identity (IAM) that is available as a result of running a IaC tool such terraform, cloudformation, or cloud cli. The GitOps Bridge would show patterns on how to bridge this metadata about the cluster to GitOps using features specific GitOps engine combined.
The GitOps Bridge becomes extremely important in the context of cloud-managed Kubernetes clusters, as these clusters often have integrations with cloud services. When using GitOps to install a tool in such cases, the tool—usually configured via Helm—needs to be set up with metadata about resources or workload identities (like IAM). This metadata is often available as a result of running an Infrastructure as Code (IaC) tool such as Terraform, CloudFormation, or a cloud CLI. The GitOps Bridge provides patterns for bridging this metadata to GitOps, using features specific to the GitOps engine in use.

The GitOps Bridge should also be compatible with GitOps engines that run as SaaS and are not installed inside the cluster, such as the Akuity Platform, CodeFresh, Weaveworks, and others.


<img src="https://raw.githubusercontent.com/gitops-bridge-dev/gitops-bridge/addons-variables/argocd/iac/terraform/examples/eks/getting-started/static/gitops-bridge.drawio.png" width=100%>


The [GitOps Bridge Pattern](https://github.com/gitops-bridge-dev) enables Kubernetes administrators to utilize Infrastructure as Code (IaC) and GitOps tools for deploying Kubernetes Addons and Workloads. Addons often depend on Cloud resources that are external to the cluster. The configuration metadata for these external resources is required by the Addons' Helm charts. While IaC is used to create these cloud resources, it is not used to install the Helm charts. Instead, the IaC tool stores this metadata either within GitOps resources in the cluster or in a Git repository. The GitOps tool then extracts these metadata values and passes them to the Helm chart during the Addon installation process. This mechanism forms the bridge between IaC and GitOps, hence the term "GitOps Bridge."

Try out the [Getting Started](https://github.com/gitops-bridge-dev/gitops-bridge/tree/main/argocd/iac/terraform/examples/eks/getting-started) example.

Additional examples available on the [GitOps Bridge Pattern](https://github.com/gitops-bridge-dev):
- [argocd-ingress](https://github.com/gitops-bridge-dev/gitops-bridge/tree/main/argocd/iac/terraform/examples/eks/argocd-ingress)
- [aws-secrets-manager](https://github.com/gitops-bridge-dev/gitops-bridge/tree/main/argocd/iac/terraform/examples/eks/aws-secrets-manager)
- [crossplane](https://github.com/gitops-bridge-dev/gitops-bridge/tree/main/argocd/iac/terraform/examples/eks/crossplane)
- [external-secrets](https://github.com/gitops-bridge-dev/gitops-bridge/tree/main/argocd/iac/terraform/examples/eks/external-secrets)
- [multi-cluster/distributed](https://github.com/gitops-bridge-dev/gitops-bridge/tree/main/argocd/iac/terraform/examples/eks/multi-cluster/distributed)
- [multi-cluster/hub-spoke](https://github.com/gitops-bridge-dev/gitops-bridge/tree/main/argocd/iac/terraform/examples/eks/multi-cluster/hub-spoke)
- [multi-cluster/hub-spoke-shared](https://github.com/gitops-bridge-dev/gitops-bridge/tree/main/argocd/iac/terraform/examples/eks/multi-cluster/hub-spoke-shared)
- [private-git](https://github.com/gitops-bridge-dev/gitops-bridge/tree/main/argocd/iac/terraform/examples/eks/private-git)

The GitOps Bridge should also be compatible with GitOps engines that run as Saas and not install inside the cluster such as Akuity Platform, CodeFresh, Weaveworks and others.

### ArgoCD

Expand All @@ -22,30 +41,22 @@ of the Kubernetes resources, any changes to these resources outside Terraform fo
### ArgoCD Status
| IaC | GitOps | Status |
| :--- | :----: | ---: |
| Terraform | ArgoCD | Stable [try it!](argocd/iac/terraform/examples/eks/) |
| Terraform | ArgoCD | Stable [try it!](argocd/iac/terraform/examples/eks/getting-started) |
| EKSCTL | ArgoCD | |
| CDK | ArgoCD | |
| Crossplane | ArgoCD | |
| CAPI | ArgoCD | |
| Pulumi | ArgoCD | |
| ACK | ArgoCD | |
| CloudFormation | ArgoCD | |
| Kops | ArgoCD | |
| Ansible | ArgoCD | |

### FluxCD Status
| IaC | GitOps | Status |
| :--- | :----: | ---: |
| Terraform | FluxCD | Soon |
| EKSCTL | FluxCD | |
| CDK | FluxCD | |
| Crossplane | FluxCD | |
| CAPI | FluxCD | |
| Pulumi | FluxCD | |
| ACK | FluxCD | |
| CloudFormation | FluxCD | |
| Kops | FluxCD | |
| Ansible | FluxCD | |
| Terraform | FluxCD | [In Progress](https://github.com/gitops-bridge-dev/gitops-bridge/issues/32) |
| EKSCTL | ArgoCD | |
| CDK | ArgoCD | |
| Crossplane | ArgoCD | |
| CAPI | ArgoCD | |
| Pulumi | ArgoCD | |

#### Researched Resources:
- https://docs.akuity.io/tutorials/adv-gitops
Expand Down
44 changes: 0 additions & 44 deletions argocd/iac/terraform/examples/eks/README.md

This file was deleted.

40 changes: 32 additions & 8 deletions argocd/iac/terraform/examples/eks/argocd-ingress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ Example on how to deploy Amazon EKS with addons configured via ArgoCD.
In this example the ArgoCD is configured with ingress using a https domain name managed on Route53


## Prerequisites
Before you begin, make sure you have the following command line tools installed:
- git
- terraform
- kubectl
- argocd

## Fork the Git Repositories

### Fork the Addon GitOps Repo
1. Fork the git repository for addons [here](https://github.com/gitops-bridge-dev/gitops-bridge-argocd-control-plane-template).
2. Update the following environment variables to point to your fork by changing the default values:
```shell
export TF_VAR_gitops_addons_org=https://github.com/gitops-bridge-dev
export TF_VAR_gitops_addons_repo=gitops-bridge-argocd-control-plane-template
```


**Create DNS Hosted Zone in Route 53:**

In this step you will delegate your registered domain DNS to Amazon Route53. You can either delegate the top level domain or a subdomain.
Expand All @@ -18,24 +36,30 @@ aws route53 create-hosted-zone --name $TF_VAR_domain_name --caller-reference "$(
Use the NameServers in the DelegatoinSet to update your registered domain NS records at the registrar.


After creating the Route53 zone deploy the EKS Cluster
## Deploy the EKS Cluster
Initialize Terraform and deploy the EKS cluster:
```shell
terraform init
terraform apply
terraform apply -auto-approve
```
Retrieve `kubectl` config, then execute the output command:
```shell
terraform output -raw configure_kubectl
```

Access Terraform output to configure `kubectl` and `argocd`
### Monitor GitOps Progress for Addons
Wait until all the ArgoCD applications' `HEALTH STATUS` is `Healthy`. Use Crl+C to exit the `watch` command
```shell
terraform output
watch kubectl get applications -n argocd
```

To access ArgoCD thru ingress https use the following command to get URL and passwords
## Access ArgoCD
Access ArgoCD's UI, run the command from the output:
```shell
echo "URL: https://$(kubectl get ing -n argocd argo-cd-argocd-server -o jsonpath='{.spec.tls[0].hosts[0]}')"
echo "Username: admin"
echo "Password: $(kubectl get secrets argocd-initial-admin-secret -n argocd --template="{{index .data.password | base64decode}}")"
terraform output -raw access_argocd
```


Destroy EKS Cluster
```shell
./destroy.sh
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: bootstrap-addons
name: cluster-addons
namespace: argocd
spec:
syncPolicy:
Expand Down
Loading

0 comments on commit 45bad15

Please sign in to comment.