Skip to content

Commit

Permalink
fix: Update crossplane aws provider location (#1150)
Browse files Browse the repository at this point in the history
  • Loading branch information
askulkarni2 authored Nov 10, 2022
1 parent 20f8c0a commit 7082a63
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 414 deletions.
3 changes: 2 additions & 1 deletion .github/scripts/plan-examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def get_examples():
'examples/fully-private-eks-cluster/vpc', # skipping until issue #711 is addressed
'examples/fully-private-eks-cluster/eks',
'examples/fully-private-eks-cluster/add-ons',
'examples/ai-ml/ray', # excluded until #887 is fixed
'examples/ai-ml/ray', # excluded until #887 is fixed,
'examples/crossplane' #example removed
}

projects = {
Expand Down
193 changes: 2 additions & 191 deletions examples/crossplane/README.md
Original file line number Diff line number Diff line change
@@ -1,192 +1,3 @@
# Crossplane Add-on
# Crossplane Blueprints

This example deploys the following Basic EKS Cluster with VPC

- Creates a new sample VPC, 3 Private Subnets and 3 Public Subnets
- Creates Internet gateway for Public Subnets and NAT Gateway for Private Subnets
- Creates EKS Cluster Control plane with one managed node group
- Crossplane Add-on to EKS Cluster
- AWS Provider for Crossplane
- Terrajet AWS Provider for Crossplane

## Crossplane Design

```mermaid
graph TD;
subgraph AWS Cloud
id1(VPC)-->Private-Subnet1;
id1(VPC)-->Private-Subnet2;
id1(VPC)-->Private-Subnet3;
id1(VPC)-->Public-Subnet1;
id1(VPC)-->Public-Subnet2;
id1(VPC)-->Public-Subnet3;
Public-Subnet1-->InternetGateway
Public-Subnet2-->InternetGateway
Public-Subnet3-->InternetGateway
Public-Subnet3-->Single-NATGateway
Private-Subnet1-->EKS{{"EKS #9829;"}}
Private-Subnet2-->EKS
Private-Subnet3-->EKS
EKS==>ManagedNodeGroup;
ManagedNodeGroup-->|enable_crossplane=true|id2([Crossplane]);
subgraph Kubernetes Add-ons
id2([Crossplane])-.->|crossplane_aws_provider.enable=true|id3([AWS-Provider]);
id2([Crossplane])-.->|crossplane_jet_aws_provider.enable=true|id4([Terrajet-AWS-Provider]);
end
end
```

## How to Deploy

### Prerequisites:

Ensure that you have installed the following tools in your Mac or Windows Laptop before start working with this module and run Terraform Plan and Apply

1. [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html)
2. [Kubectl](https://Kubernetes.io/docs/tasks/tools/)
3. [Terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli)

### Deployment Steps

#### Step 1: Clone the repo using the command below

```sh
git clone https://github.com/aws-ia/terraform-aws-eks-blueprints.git
```

#### Step 2: Run Terraform INIT

Initialize a working directory with configuration files

```sh
cd examples/crossplane/
terraform init
```

#### Step 3: Run Terraform PLAN

Verify the resources created by this execution

```sh
export AWS_REGION=<ENTER YOUR REGION> # Select your own region
terraform plan
```

#### Step 4: Finally, Terraform APPLY

**Deploy the pattern**

```sh
terraform apply
```

Enter `yes` to apply.

### Configure `kubectl` and test cluster

EKS Cluster details can be extracted from terraform output or from AWS Console to get the name of cluster.
This following command used to update the `kubeconfig` in your local machine where you run kubectl commands to interact with your EKS Cluster.

#### Step 5: Run `update-kubeconfig` command

`~/.kube/config` file gets updated with cluster details and certificate from the below command

```sh
aws eks --region <enter-your-region> update-kubeconfig --name <cluster-name>
```

#### Step 6: List all the worker nodes by running the command below

```sh
kubectl get nodes
```

#### Step 7: List all the pods running in `crossplane-system` namespace

```sh
kubectl get pods -n crossplane-system
```

### AWS Provider for Crossplane

This example shows how to deploy S3 bucket using Crossplane AWS provider

- Open the file below

```sh
vi ~/examples/crossplane/crossplane-aws-examples/aws-provider-s3.yaml
```

- Edit the below `aws-provider-s3.yaml` to update the new bucket name

- Enter the new `bucket name` and `region` in YAML file. Save the file using :wq!

- Apply the K8s manifest

```sh
cd ~/examples/crossplane/crossplane-aws-examples/
kubectl apply -f aws-provider-s3.yaml
```

- Login to AWS Console and verify the new S3 bucket

To Delete the bucket

```sh
cd ~/examples/crossplane/crossplane-aws-examples/
kubectl delete -f aws-provider-s3.yaml
```

### Terrajet AWS Provider for Crossplane

This example shows how to deploy S3 bucket using Crossplane Terrajet AWS Provider

- Open the file below

```sh
vi ~/examples/crossplane/crossplane-aws-examples/jet-aws-provider-s3.yaml
```

- Edit the below `jet-aws-provider-s3.yaml` to update the new bucket name

- Enter the new `bucket name` and `region` in YAML file. Save the file using :wq!

- Apply the K8s manifest

```sh
cd ~/examples/crossplane/crossplane-aws-examples/
kubectl apply -f jet-aws-provider-s3.yaml
```

- Login to AWS Console and verify the new S3 bucket

To Delete the bucket

```sh
cd ~/examples/crossplane/crossplane-aws-examples/
kubectl delete -f jet-aws-provider-s3.yaml
```

## How to Destroy

The following command destroys the resources created by `terraform apply`

Step 1: Delete resources created by Crossplane

Step 2: Terraform Destroy

To clean up your environment, destroy the Terraform modules in reverse order.

Destroy the Kubernetes Add-ons, EKS cluster with Node groups and VPC

```sh
terraform destroy -target="module.eks_blueprints_kubernetes_addons" -auto-approve
terraform destroy -target="module.eks_blueprints" -auto-approve
terraform destroy -target="module.vpc" -auto-approve
```

Finally, destroy any additional resources that are not in the above modules

```sh
terraform destroy -auto-approve
```
Visit [crossplane-on-eks](https://github.com/awslabs/crossplane-on-eks/tree/main/bootstrap/terraform) GitHub Repository to see example of a Blueprint that deploys Crossplane on Amazon EKS.
19 changes: 0 additions & 19 deletions examples/crossplane/crossplane-aws-examples/aws-provider-s3.yaml

This file was deleted.

This file was deleted.

151 changes: 0 additions & 151 deletions examples/crossplane/main.tf

This file was deleted.

4 changes: 0 additions & 4 deletions examples/crossplane/outputs.tf

This file was deleted.

Empty file removed examples/crossplane/variables.tf
Empty file.
Loading

0 comments on commit 7082a63

Please sign in to comment.