Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding Apache pinot support #353

Merged
merged 21 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
511ff5a
first draft - adding support for apache pinot
wahab-io May 5, 2023
ccbb1a8
updates to the terraform code for apache pinot
wahab-io Sep 5, 2023
14003b9
Merge branch 'main' into apache-pinot
wahab-io Oct 9, 2023
b778e63
fix: cleanup and updating pinot helm release
wahab-io Oct 10, 2023
5fd6520
feat: Adding apache pinot support
wahab-io Oct 11, 2023
64cd394
feat: Enabling kube-prometheus-stack for Apache Pinot Observability
wahab-io Oct 19, 2023
807bdbd
feat: Adding prometheus scrap config
wahab-io Oct 20, 2023
cd0765f
Merge branch 'main' into apache-pinot
wahab-io Oct 20, 2023
54e2760
feat: Adding blueprint documentation
wahab-io Oct 24, 2023
9b1e04e
fix: Cleanup script, Install Script and remove external load balancers
wahab-io Oct 25, 2023
83dd0cb
fix: Updating EKS cluster version
wahab-io Oct 25, 2023
11a1d0a
fix: Updating Apache Pinot docs to remove EBS volume as part of cleanup
wahab-io Oct 25, 2023
a787137
fix: Updating eks-data-addon module version
wahab-io Nov 28, 2023
35ce784
fix: Removing data.tf and local.tf files
wahab-io Nov 28, 2023
f85f372
fix: Updated k8s version and default aws region
wahab-io Nov 29, 2023
0a2e964
fix: Updated pinot components storageclass to gp3
wahab-io Nov 29, 2023
7b21d5b
Merge branch 'awslabs:main' into apache-pinot
wahab-io Dec 12, 2023
18618d3
fix: Adding separate node groups for pinot deployment
wahab-io Dec 20, 2023
fec1128
fix: Renaming resource gp2_default to disable_gp2
wahab-io Dec 20, 2023
04dfb1a
fix: removing VPC CNI self-managed addon
wahab-io Dec 20, 2023
0815271
fix: Spelling mistakes
wahab-io Dec 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
203 changes: 203 additions & 0 deletions distributed-databases/pinot/addons.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
#---------------------------------------------------------------
# IRSA for EBS CSI Driver
#---------------------------------------------------------------
module "ebs_csi_driver_irsa" {
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
version = "~> 5.14"
role_name = format("%s-%s", local.name, "ebs-csi-driver")
attach_ebs_csi_policy = true
oidc_providers = {
main = {
provider_arn = module.eks.oidc_provider_arn
namespace_service_accounts = ["kube-system:ebs-csi-controller-sa"]
}
}
tags = local.tags
}

#---------------------------------------------------------------
# GP3 Encrypted Storage Class
wahab-io marked this conversation as resolved.
Show resolved Hide resolved
#---------------------------------------------------------------
resource "kubernetes_annotations" "disable_gp2" {
annotations = {
"storageclass.kubernetes.io/is-default-class" : "false"
}
api_version = "storage.k8s.io/v1"
kind = "StorageClass"
metadata {
name = "gp2"
}
force = true

depends_on = [module.eks]
}

resource "kubernetes_storage_class" "ebs_csi_encrypted_gp3_storage_class" {
metadata {
name = "gp3"
annotations = {
"storageclass.kubernetes.io/is-default-class" : "true"
}
}

storage_provisioner = "ebs.csi.aws.com"
reclaim_policy = "Delete"
allow_volume_expansion = true
volume_binding_mode = "WaitForFirstConsumer"
parameters = {
fsType = "xfs"
encrypted = true
type = "gp3"
}

depends_on = [kubernetes_annotations.disable_gp2]
}

#---------------------------------------------------------------
# EKS Blueprints Kubernetes Addons
#---------------------------------------------------------------
module "eks_blueprints_kubernetes_addons" {
source = "aws-ia/eks-blueprints-addons/aws"
version = "~> 1.0"

cluster_name = module.eks.cluster_name
cluster_endpoint = module.eks.cluster_endpoint
cluster_version = module.eks.cluster_version
oidc_provider_arn = module.eks.oidc_provider_arn

#---------------------------------------------------------------
# Amazon EKS Managed Add-ons
#---------------------------------------------------------------
eks_addons = {
aws-ebs-csi-driver = {
service_account_role_arn = module.ebs_csi_driver_irsa.iam_role_arn
}
coredns = {
preserve = true
}
vpc-cni = {
preserve = true
}
kube-proxy = {
preserve = true
}
}
#---------------------------------------
# Kubernetes Add-ons
#---------------------------------------

enable_kube_prometheus_stack = true
kube_prometheus_stack = {
namespace = "monitoring"
name = "prometheus"
chart_version = "48.1.1"
set_sensitive = [
{
name = "grafana.adminPassword"
value = data.aws_secretsmanager_secret_version.admin_password_version.secret_string
}]

values = [
templatefile("${path.module}/helm/kube-prometheus-stack-values.yaml", {
storage_class_type = kubernetes_storage_class.ebs_csi_encrypted_gp3_storage_class.id,
})
]
}

#---------------------------------------
# AWS for FluentBit - DaemonSet
#---------------------------------------
enable_aws_for_fluentbit = true
aws_for_fluentbit_cw_log_group = {
use_name_prefix = false
name = "/${local.name}/aws-fluentbit-logs" # Add-on creates this log group
retention_in_days = 30
}
aws_for_fluentbit = {
values = [templatefile("${path.module}/helm/aws-for-fluentbit-values.yaml", {
region = local.region,
cloudwatch_log_group = "/${local.name}/aws-fluentbit-logs"
cluster_name = module.eks.cluster_name
})]
}
#---------------------------------------
# AWS Load Balancer Controller
#---------------------------------------
enable_aws_load_balancer_controller = false


tags = local.tags
}

#---------------------------------------------------------------
# Apache Pinot
#---------------------------------------------------------------

resource "random_string" "random_suffix" {
length = 10
special = false
upper = false
}

resource "random_password" "sensitive_key" {
length = 16
special = false
}

module "eks_data_addons" {
source = "aws-ia/eks-data-addons/aws"
version = "~> 1.2.6"

oidc_provider_arn = module.eks.oidc_provider_arn

#---------------------------------------------------------------
# Apache Pinot Add-on
#---------------------------------------------------------------
enable_pinot = true
pinot_helm_config = {
namespace = "pinot"
values = [templatefile("${path.module}/helm/pinot-values.yaml", {})]
set = [
{
name = "cluster.name"
value = local.cluster_name
},
{
name = "controller.replicaCount"
value = 3
},
{
name = "controller.persistence.storageClass"
value = "gp3"
},
{
name = "broker.replicaCount"
value = 3
},
{
name = "server.replicaCount"
value = 3
},
{
name = "server.persistence.storageClass"
value = "gp3"
},
{
name = "minionStateless.replicaCount"
value = 3
},
{
name = "minionStateless.persistence.storageClass"
value = "gp3"
},
{
name = "zookeeper.replicaCount"
value = 3
},
{
name = "zookeeper.persistence.storageClass"
value = "gp3"
}
]
}
}
28 changes: 28 additions & 0 deletions distributed-databases/pinot/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
set -o errexit
set -o pipefail

# Make sure you have `terraform.tfvars` file with the desired region.
# Otherwise script will ask you to input your region each time it runs `terraform destroy`

targets=(
"module.eks_data_addons"
"module.eks_blueprints_kubernetes_addons"
"module.vpc_cni_irsa"
"module.ebs_csi_driver_irsa"
"module.eks"
"module.vpc"
)

#-------------------------------------------
# Terraform destroy per module target
#-------------------------------------------
for target in "${targets[@]}"
do
terraform destroy -target="$target" -auto-approve
done

#-------------------------------------------
# Terraform destroy full
#-------------------------------------------
terraform destroy -auto-approve
Loading
Loading