Skip to content

Commit

Permalink
Merge pull request #19 from holywen/main
Browse files Browse the repository at this point in the history
makefile test error fix, add rds to outputs/readme
  • Loading branch information
ps-ssingh authored Mar 25, 2024
2 parents bb0854c + 8e5c7c7 commit 37847c8
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 11 deletions.
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,14 @@ else
@printf $(MSG_ERROR) "Blueprint $(ROOT) did not complete the Deployment target thus it is not Ready to be validated."
endif

blueprints/$(ROOT)/terraform.output: deploy

.PHONY: test
test: ## Runs a test for blueprint passed as parameters throughout their Terraform Lifecycle. Example: ROOT=02-at-scale make test
test: blueprints/$(ROOT)/terraform.output ## Runs a test for blueprint passed as parameters throughout their Terraform Lifecycle. Example: ROOT=02-at-scale make test
@printf $(MSG_INFO) "Running Test for $(ROOT) blueprint ..."
$(call deploy,$(ROOT))
until ls blueprints/$(ROOT)/terraform.output; do sleep 3 && echo "Waiting for output file..."; done ;
ifneq ("$(wildcard blueprints/$(ROOT)/terraform.output)","")
$(call validate,$(ROOT))
$(call destroy,$(ROOT))
$(call clean,$(ROOT))
else
@printf $(MSG_ERROR) "Blueprint $(ROOT) did not complete the Deployment target thus it is not Ready for the following phases."
endif

.PHONY: test-all
test-all: ## Runs test for all blueprints throughout their Terraform Lifecycle. Example: make test
Expand Down
4 changes: 2 additions & 2 deletions blueprints/01-getting-started/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ locals {

vpc_cidr = "10.0.0.0/16"

#https://docs.cloudbees.com/docs/cloudbees-common/latest/supported-platforms/cloudbees-ci-cloud#_kubernetes
k8s_version = "1.27"
#https://docs.cloudbees.com/docs/cloudbees-common/latest/supported-platforms/cloudbees-cd-k8s#_supported_kubernetes_versions
k8s_version = "1.28"

route53_zone_id = data.aws_route53_zone.this.id
route53_zone_arn = data.aws_route53_zone.this.arn
Expand Down
14 changes: 14 additions & 0 deletions blueprints/02-at-scale/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Once you have familiarized yourself with the [Getting Started blueprint](../01-g
| eks_cluster_arn | EKS cluster ARN |
| kubeconfig_add | Add Kubeconfig to local configuration to access the K8s API. |
| kubeconfig_export | Export KUBECONFIG environment variable to access to access the K8s API. |
| rds_instance_id | DB identifier for CloudBees CD Add-on. |
| rds_snapshot_id | DB snapshot identifier for CloudBees CD Add-on. |
| s3_cbcd_arn | cbcd s3 Bucket Arn |
| s3_cbcd_name | cbcd s3 Bucket Name. It is required by Velero for backup |
| velero_backup_on_demand_team_cd | Take an on-demand velero backup from the schedulle for Team CD. |
Expand Down Expand Up @@ -83,6 +85,18 @@ Additionally, the following is required:

### Backups and Restores

- For Database Storage is based on RDS.

- Create a snapshot of the RDS instance.

```sh
aws rds create-db-snapshot --db-instance-identifier $(terraform output --raw rds_instance_id) --db-snapshot-identifier $(terraform output --raw rds_snapshot_id)
```
- Restore the RDS instance from the snapshot.
```sh
aws rds restore-db-instance-from-db-snapshot --db-instance-identifier $(terraform output --raw rds_instance_id) --db-snapshot-identifier $(terraform output --raw rds_snapshot_id)
```

- For EBS Storage is based on Velero.

- Create a Velero Backup schedule for Team CD to take regular backups.
Expand Down
2 changes: 1 addition & 1 deletion blueprints/02-at-scale/k8s/velero-values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

kubectl:
image:
#Issue #60
#Issue https://github.com/cloudbees/terraform-aws-cloudbees-ci-eks-addon/issues/60
tag: 1.26.14-debian-11-r6
4 changes: 3 additions & 1 deletion blueprints/02-at-scale/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ locals {
velero_s3_backup_location = "${module.cbcd_s3_bucket.s3_bucket_arn}/velero"
velero_bk_demo = "team-cd-bk"

rds_instance_id = "flow-db-${random_string.dbsuffix.result}"
rds_snapshot_id = "flow-db-snapshot-${random_string.dbsuffix.result}"
}

################################################################################
Expand All @@ -47,7 +49,7 @@ locals {
module "db" {
source = "terraform-aws-modules/rds/aws"

identifier = "flow-db-${random_string.dbsuffix.result}"
identifier = local.rds_instance_id

# All available versions: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts
engine = "postgres"
Expand Down
11 changes: 11 additions & 0 deletions blueprints/02-at-scale/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ output "cbcd_namespace" {
description = "Namespace for CloudBees CD Add-on."
value = module.eks_blueprints_addon_cbcd.cbcd_namespace
}

output "cbcd_url" {
description = "URL of the CloudBees CD Operations Center for CloudBees CD Add-on."
value = module.eks_blueprints_addon_cbcd.cbcd_url
Expand All @@ -28,6 +29,16 @@ output "cbcd_password" {
value = module.eks_blueprints_addon_cbcd.cbcd_password
}

output "rds_instance_id" {
description = "DB identifier for CloudBees CD Add-on."
value = local.rds_instance_id
}

output "rds_snapshot_id" {
description = "DB snapshot identifier for CloudBees CD Add-on."
value = local.rds_snapshot_id
}

output "acm_certificate_arn" {
description = "ACM certificate ARN"
value = module.acm.acm_certificate_arn
Expand Down

0 comments on commit 37847c8

Please sign in to comment.