Skip to content

Commit

Permalink
[IBCDPE-1007] Monitoring and security scanning (#14)
Browse files Browse the repository at this point in the history
* Implementing monitoring and security scanning into the cluster
  • Loading branch information
BryanFauble authored Aug 15, 2024
1 parent c91409e commit 847e68f
Show file tree
Hide file tree
Showing 35 changed files with 3,279 additions and 381 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,4 @@ This document describes the abbreviated process below:
}
```
- Add a new `spacelift_aws_integration` resources to the `common-resources/aws-integrations` directory.

1 change: 1 addition & 0 deletions dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ resource "spacelift_space" "development" {
module "dpe-sandbox-spacelift" {
source = "./spacelift/dpe-sandbox"
parent_space_id = spacelift_space.development.id
admin_stack_id = var.admin_stack_id
}
14 changes: 12 additions & 2 deletions dev/spacelift/dpe-sandbox/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ resource "spacelift_stack" "k8s-stack-deployments" {
space_id = spacelift_space.dpe-sandbox.id
}

# resource "spacelift_stack_dependency" "dependency-on-admin-stack" {
# for_each = {
# k8s-stack = spacelift_stack.k8s-stack,
# k8s-stack-deployments = spacelift_stack.k8s-stack-deployments
# }

# stack_id = each.value.id
# depends_on_stack_id = var.admin_stack_id
# }

resource "spacelift_context_attachment" "k8s-kubeconfig-hooks" {
context_id = "kubernetes-deployments-kubeconfig"
stack_id = spacelift_stack.k8s-stack-deployments.id
Expand Down Expand Up @@ -118,15 +128,15 @@ resource "spacelift_stack_destructor" "k8s-stack-destructor" {

resource "spacelift_aws_integration_attachment" "k8s-aws-integration-attachment" {
# org-sagebase-dnt-dev-aws-integration
integration_id = "01J3DNYVM4AWWSDY3QEVRMQ076"
integration_id = "01J3R9GX6DC09QV7NV872DDYR3"
stack_id = spacelift_stack.k8s-stack.id
read = true
write = true
}

resource "spacelift_aws_integration_attachment" "k8s-deployments-aws-integration-attachment" {
# org-sagebase-dnt-dev-aws-integration
integration_id = "01J3DNYVM4AWWSDY3QEVRMQ076"
integration_id = "01J3R9GX6DC09QV7NV872DDYR3"
stack_id = spacelift_stack.k8s-stack-deployments.id
read = true
write = true
Expand Down
5 changes: 5 additions & 0 deletions dev/spacelift/dpe-sandbox/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ variable "tags" {
"CostCenter" = "No Program / 000000"
}
}

variable "admin_stack_id" {
description = "ID of the admin stack"
type = string
}
20 changes: 19 additions & 1 deletion dev/stacks/dpe-sandbox-k8s-deployments/main.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
module "sage-aws-eks-autoscaler" {
source = "spacelift.io/sagebionetworks/sage-aws-eks-autoscaler/aws"
version = "0.3.2"
version = "0.4.2"

cluster_name = var.cluster_name
cluster_name = var.cluster_name
private_vpc_subnet_ids = var.private_subnet_ids
vpc_id = var.vpc_id
node_security_group_id = var.node_security_group_id
spotinst_account = var.spotinst_account
# desired_capacity = 2
}

module "victoria-metrics" {
source = "spacelift.io/sagebionetworks/victoria-metrics/aws"
version = "0.0.7"
}

module "trivy-operator" {
source = "spacelift.io/sagebionetworks/trivy-operator/aws"
version = "0.0.12"
}

module "airflow" {
source = "spacelift.io/sagebionetworks/airflow/aws"
version = "0.0.1"
cluster_name = var.cluster_name
}
14 changes: 12 additions & 2 deletions dev/stacks/dpe-sandbox-k8s/main.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module "sage-aws-vpc" {
source = "spacelift.io/sagebionetworks/sage-aws-vpc/aws"
version = "0.3.3"
version = "0.3.4"
vpc_name = "dpe-sandbox"
capture_flow_logs = true
flow_log_retention = 1
}

module "sage-aws-eks" {
source = "spacelift.io/sagebionetworks/sage-aws-eks/aws"
version = "0.3.9"
version = "0.4.0"

cluster_name = "dpe-k8-sandbox"
private_vpc_subnet_ids = module.sage-aws-vpc.private_subnet_ids
Expand All @@ -20,4 +20,14 @@ module "sage-aws-eks" {
pod_security_group_enforcing_mode = "standard"
aws_account_id = "631692904429"
private_subnet_cidrs = module.sage-aws-vpc.vpc_private_subnet_cidrs
cluster_name = "dpe-k8-sandbox"
private_vpc_subnet_ids = module.sage-aws-vpc.private_subnet_ids
vpc_id = module.sage-aws-vpc.vpc_id
vpc_security_group_id = module.sage-aws-vpc.vpc_security_group_id
enable_policy_event_logs = true
capture_cloudwatch_logs = true
cloudwatch_retention = 1
pod_security_group_enforcing_mode = "standard"
aws_account_id = "631692904429"
private_subnet_cidrs = module.sage-aws-vpc.vpc_private_subnet_cidrs
}
5 changes: 5 additions & 0 deletions dev/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ variable "parent_space_id" {
description = "ID of the parent spacelift space"
type = string
}

variable "admin_stack_id" {
description = "ID of the admin stack"
type = string
}
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resource "spacelift_stack" "root_administrative_stack" {

administrative = true
autodeploy = true
branch = "main"
branch = "ibcdpe-1007-monitoring"
description = "Manages other spacelift resources"
name = "Root Spacelift Administrative Stack"
project_root = ""
Expand Down Expand Up @@ -56,4 +56,5 @@ module "dev-resources" {
module.terraform-registry,
]
parent_space_id = spacelift_space.environment.id
admin_stack_id = spacelift_stack.root_administrative_stack.id
}
7 changes: 0 additions & 7 deletions modules/apache-airflow/data.tf

This file was deleted.

18 changes: 0 additions & 18 deletions modules/apache-airflow/variables.tf

This file was deleted.

55 changes: 0 additions & 55 deletions modules/internal-k8-infra/data.tf

This file was deleted.

128 changes: 0 additions & 128 deletions modules/internal-k8-infra/main.tf

This file was deleted.

21 changes: 0 additions & 21 deletions modules/internal-k8-infra/provider.tf

This file was deleted.

20 changes: 0 additions & 20 deletions modules/internal-k8-infra/templates/airflow-values.yaml

This file was deleted.

Loading

0 comments on commit 847e68f

Please sign in to comment.