Skip to content

Commit 3947a97

Browse files
authored
Merge pull request #13 from smarunich/dev-aws
AWS support
2 parents 623b742 + abd305b commit 3947a97

File tree

29 files changed

+357
-230
lines changed

29 files changed

+357
-230
lines changed

Makefile

Lines changed: 88 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,122 @@
44
cluster_id = 1
55
cloud = azure
66
# Functions
7-
azure_jumpbox:
7+
8+
.PHONY : help
9+
help : Makefile
10+
@sed -n 's/^##//p' $<
11+
12+
## init terraform init
13+
.PHONY: init
14+
init:
815
terraform init
16+
17+
## azure_jumpbox deploys jumpbox, pushes tsb repo to acr
18+
.PHONY: azure_jumpbox
19+
azure_jumpbox:
20+
terraform apply -auto-approve -target=module.azure_base -target=module.azure_jumpbox
21+
22+
## aws_jumpbox deploys jumpbox, pushes tsb repo to acr
23+
.PHONY: aws_jumpbox
24+
aws_jumpbox:
25+
terraform apply -auto-approve -target=module.aws_base -target=module.aws_jumpbox
26+
27+
## k8s
28+
.PHONY: k8s
29+
k8s:
930
terraform apply -auto-approve -target=module.azure_base
10-
terraform apply -auto-approve -target=module.azure_jumpbox
31+
terraform apply -auto-approve -target=module.azure_jumpbox
32+
terraform apply -auto-approve -target=module.azure_k8s
33+
terraform apply -auto-approve -target=module.aws_base
34+
terraform apply -auto-approve -target=module.aws_jumpbox
35+
terraform apply -auto-approve -target=module.aws_k8s
36+
37+
## azure_k8s deploys azure k8s cluster for MP and N-number of CPs(*) leveraging AKS
38+
.PHONY: azure_k8s
1139
azure_k8s:
12-
terraform init
1340
terraform apply -auto-approve -target=module.azure_base
14-
terraform apply -auto-approve -target=module.azure_jumpbox
41+
terraform apply -auto-approve -target=module.azure_jumpbox
1542
terraform apply -auto-approve -target=module.azure_k8s
16-
tsb_deps:
17-
terraform init
18-
terraform apply -auto-approve -target=module.cert-manager -var=cluster_id=0
19-
terraform apply -auto-approve -target=module.es
43+
44+
## aws_k8s deploys EKS K8s cluster (CPs only)
45+
.PHONY: aws_k8s
46+
aws_k8s:
47+
terraform apply -auto-approve -target=module.aws_base
48+
terraform apply -auto-approve -target=module.aws_jumpbox
49+
terraform apply -auto-approve -target=module.aws_k8s
50+
51+
.PHONY: tsb_deps
52+
tsb_deps:
53+
## working around the issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/2602
54+
terraform apply -auto-approve -target=module.azure_k8s -target=module.aws_base -target=module.aws_jumpbox
55+
terraform apply -auto-approve -target=module.cert-manager -target=module.es -var=cluster_id=0 -var=cloud=azure
56+
57+
## tsb_mp deploys MP
58+
.PHONY: tsb_mp
2059
tsb_mp:
21-
terraform init
60+
## working around the issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/2602
61+
terraform apply -auto-approve -target=module.azure_k8s -target=module.aws_base -target=module.aws_jumpbox
2262
terraform apply -auto-approve -target=module.tsb_mp.kubectl_manifest.manifests_certs
2363
terraform apply -auto-approve -target=module.tsb_mp
24-
terraform apply -auto-approve -target=module.aws_dns
64+
terraform apply -auto-approve -target=module.aws_dns -var=cluster_id=0 -var=cloud=azure
65+
66+
## tsb_fqdn creates TSB MP FQDN
67+
.PHONY: tsb_fqdn
2568
tsb_fqdn:
26-
terraform apply -auto-approve -target=module.aws_dns
69+
terraform apply -auto-approve -target=module.aws_dns -var=cluster_id=0 -var=cloud=azure
70+
71+
## tsb_cp cluster_id=1 cloud=azure onboards CP on AKS cluster with ID=1
72+
.PHONY: tsb_cp
2773
tsb_cp:
2874
@echo cluster_id is ${cluster_id}
2975
@echo cloud is ${cloud}
30-
terraform init
31-
terraform state list | grep "^module.cert-manager" | grep -v data | tr -d ':' | xargs -I '{}' terraform taint {}
32-
terraform apply -auto-approve -target=module.cert-manager -var=cluster_id=${cluster_id}
76+
#terraform state list | grep "^module.cert-manager" | grep -v data | grep -v manifest | grep -v helm | grep -v wait| tr -d ':' | xargs -I '{}' terraform taint {}
77+
terraform taint -allow-missing "module.cert-manager.time_sleep.wait_90_seconds"
3378
terraform taint -allow-missing "module.tsb_cp.null_resource.jumpbox_tctl"
79+
## working around the issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/2602
80+
terraform apply -auto-approve -target=module.azure_k8s -target=module.aws_base -target=module.aws_jumpbox
81+
terraform apply -auto-approve -target=module.cert-manager -var=cluster_id=${cluster_id} -var=cloud=${cloud}
3482
terraform apply -auto-approve -target=module.tsb_cp -var=cluster_id=${cluster_id} -var=cloud=${cloud}
83+
84+
## argocd cluster_id=1 cloud=azure onboards ArgoCD on AKS cluster with ID=1
85+
.PHONY: argocd
3586
argocd:
3687
@echo cluster_id is ${cluster_id}
3788
@echo cloud is ${cloud}
89+
## working around the issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/2602
90+
terraform apply -auto-approve -target=module.azure_k8s -target=module.aws_base -target=module.aws_jumpbox
3891
terraform apply -auto-approve -target=module.argocd -var=cluster_id=${cluster_id} -var=cloud=${cloud}
92+
93+
.PHONY: keycloak
3994
keycloak:
95+
## working around the issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/2602
96+
terraform apply -auto-approve -target=module.azure_k8s -target=module.aws_base -target=module.aws_jumpbox
4097
terraform apply -auto-approve -target=module.keycloak-helm -var=cluster_id=0
98+
99+
.PHONY: app_bookinfo
41100
app_bookinfo:
42101
@echo cluster_id is ${cluster_id}
43102
@echo cloud is ${cloud}
44-
terraform init
45103
terraform state list | grep "^module.app_bookinfo" | grep -v data | tr -d ':' | xargs -I '{}' terraform taint {}
104+
## working around the issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/2602
105+
terraform apply -auto-approve -target=module.azure_k8s -target=module.aws_base -target=module.aws_jumpbox
46106
terraform apply -auto-approve -target=module.app_bookinfo -var=cluster_id=${cluster_id} -var=cloud=${cloud}
107+
108+
.PHONY: azure_oidc
47109
azure_oidc:
48-
terraform init
49110
terraform apply -auto-approve -target=module.azure_oidc
111+
112+
## destroy destroy the environment
113+
.PHONY: destroy
50114
destroy:
51115
terraform destroy -refresh=false -target=module.aws_dns
52-
terraform destroy -refresh=false -target=module.azure_k8s
53-
terraform destroy -refresh=false -target=module.azure_base
54-
terraform destroy -refresh=false -target=module.azure_jumpbox
116+
terraform state list | grep "^module.tsb" | xargs -I '{}' terraform state rm {}
117+
terraform state list | grep "^module.cert" | xargs -I '{}' terraform state rm {}
118+
terraform state list | grep "^module.argo" | xargs -I '{}' terraform state rm {}
119+
terraform state list | grep "^module.es" | xargs -I '{}' terraform state rm {}
120+
terraform state list | grep "^module.keycloak" | xargs -I '{}' terraform state rm {}
121+
terraform state list | grep "^module.app" | xargs -I '{}' terraform state rm {}
122+
terraform destroy -refresh=false -target=module.aws_k8s -target=module.aws_jumpbox -target=module.aws_base
123+
terraform destroy -refresh=false -target=module.azure_k8s -target=module.azure_jumpbox -target=module.azure_base
55124
terraform destroy -refresh=false
56125
terraform destroy

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ The `Makefile` in this directory provides automated provisioning of k8s clusters
1515
C[make tsb_mp] --> F[make keycloak]
1616
D[make tsb_cp] --> E[make argocd]
1717
D[make tsb_cp] --> Z[make app_bookinfo]
18-
style Z fill:lightgrey
1918
style Y fill:lightgrey
20-
style E fill:lightgrey
2119
style F fill:lightgrey
2220
```
2321
The setup consists of
@@ -50,32 +48,36 @@ terraform.tfvars
5048

5149
```
5250
name_prefix = "juggles"
53-
location = "eastus"
54-
cidr = "172.20.0.0/16"
55-
tsb_image_sync_username = "cloudsmith-apikey"
56-
tsb_image_sync_apikey = "cloudsmith-username"
57-
tsb_helm_username = "cloudsmith-apikey"
58-
tsb_helm_password = "cloudsmith-username"
59-
tsb_fqdn = "mtoa.cx.tetrate.info"
60-
tsb_version = "1.5.0-internal-rc2"
61-
tsb_password = "Tetrate123"
62-
app_clusters_count = "1"
51+
tsb_image_sync_username = "cloudsmith-username"
52+
tsb_image_sync_apikey = "cloudsmith-apikey"
53+
tsb_helm_username = "cloudsmith-username"
54+
tsb_helm_password = "cloudsmith-apikey"
55+
tsb_fqdn = "<YOUR UNIQUE NAME TO BE CREATED>.cx.tetrate.info"
56+
tsb_version = "1.5.0-EA1"
57+
tsb_password = "Tetrate123"
58+
azure_region = "East US"
59+
aws_region = "eu-west-1"
60+
aws_eks_app_clusters_count = 1
61+
azure_aks_app_clusters_count = 1
6362
```
6463

6564
To stand up the demo continue with the steps below:
6665
```bash
66+
# setup modules
67+
make init
6768
# setup underlying clusters
68-
make azure_k8s
69+
make k8s
6970
# deploy TSB dependecies such as elastic, cert-manager
7071
make tsb_deps
7172
# deploy TSB MP using Helm chart
7273
make tsb_mp
7374
# deploy TSB CP using Helm chart
74-
make tsb_cp cluster_id=0
75-
make tsb_cp cluster_id=1
76-
# (optional) deploy ArgoCD
77-
make argocd cluster_id=0
78-
make argocd cluster_id=1
75+
make tsb_cp cluster_id=0 cloud=azure # MP cluster is targetted to be onboarded as Tier1
76+
make tsb_cp cluster_id=1 cloud=azure
77+
make tsb_cp cluster_id=0 cloud=aws
78+
# deploy apps using ArgoCD
79+
make argocd cluster_id=1 cloud=azure
80+
make argocd cluster_id=0 cloud=aws
7981
```
8082

8183
The completion of the above steps will result in:

0 commit comments

Comments
 (0)