-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'awslabs:main' into streaming_redpanda
- Loading branch information
Showing
67 changed files
with
4,207 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
69 changes: 69 additions & 0 deletions
69
ai-ml/jark-stack/terraform/helm-values/kubecost-values.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
|
||
# KubeCost WebUI -> kubectl port-forward --namespace kubecost deployment/kubecost-cost-analyzer 9090 | ||
|
||
global: | ||
# pricingCsv: | ||
# enabled: false | ||
# location: | ||
# provider: "AWS" | ||
# region: "us-east-1" | ||
# URI: s3://kc-csv-test/pricing_schema.csv # a valid file URI | ||
# csvAccessCredentials: pricing-schema-access-secret | ||
|
||
prometheus: | ||
enabled: true # Kubecost depends on Prometheus data, it is not optional. When enabled: false, Prometheus will not be installed and you must configure your own Prometheus to scrape kubecost as well as provide the fqdn below. -- Warning: Before changing this setting, please read to understand the risks https://docs.kubecost.com/install-and-configure/install/custom-prom | ||
fqdn: http://cost-analyzer-prometheus-server.default.svc # example address of a prometheus to connect to. Include protocol (http:// or https://) Ignored if enabled: true | ||
|
||
grafana: | ||
enabled: true # If false, Grafana will not be installed | ||
domainName: cost-analyzer-grafana.default.svc # example grafana domain Ignored if enabled: true | ||
scheme: "http" # http or https, for the domain name above. | ||
proxy: true # If true, the kubecost frontend will route to your grafana through its service endpoint | ||
|
||
kubecostFrontend: | ||
image: public.ecr.aws/kubecost/frontend | ||
resources: | ||
requests: | ||
cpu: "200m" | ||
memory: "512Mi" | ||
|
||
kubecostMetrics: | ||
emitPodAnnotations: true | ||
emitNamespaceAnnotations: true | ||
|
||
kubecostModel: | ||
image: public.ecr.aws/kubecost/cost-model | ||
resources: | ||
requests: | ||
cpu: "500m" | ||
memory: "512Mi" | ||
|
||
forecasting: | ||
fullImageName: public.ecr.aws/kubecost/kubecost-modeling:v0.1.6 | ||
|
||
networkCosts: | ||
image: | ||
repository: public.ecr.aws/kubecost/kubecost-network-costs | ||
|
||
clusterController: | ||
image: | ||
repository: public.ecr.aws/kubecost/cluster-controller | ||
|
||
prometheus: | ||
server: | ||
image: | ||
repository: public.ecr.aws/kubecost/prometheus | ||
|
||
configmapReload: | ||
prometheus: | ||
image: | ||
repository: public.ecr.aws/kubecost/prometheus-config-reloader | ||
|
||
reporting: | ||
productAnalytics: false | ||
|
||
# Define persistence volume for cost-analyzer | ||
persistentVolume: | ||
size: 32Gi | ||
dbSize: 32.0Gi | ||
enabled: true # Note that setting this to false means configurations will be wiped out on pod restart. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
## Requirements | ||
|
||
For security reasons, ALB is deployed as internal one and it can be changed to internet-facing during the deployment, if needed. | ||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.36.0 | | ||
| <a name="provider_helm"></a> [helm](#provider\_helm) | 2.12.1 | | ||
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | 2.25.2 | | ||
| <a name="provider_null"></a> [null](#provider\_null) | 3.2.2 | | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_ebs_csi_driver_irsa"></a> [ebs\_csi\_driver\_irsa](#module\_ebs\_csi\_driver\_irsa) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | ~> 5.20 | | ||
| <a name="module_eks"></a> [eks](#module\_eks) | terraform-aws-modules/eks/aws | ~> 19.15 | | ||
| <a name="module_eks_blueprints_addons"></a> [eks\_blueprints\_addons](#module\_eks\_blueprints\_addons) | aws-ia/eks-blueprints-addons/aws | ~> 1.2 | | ||
| <a name="module_lb_role"></a> [lb\_role](#module\_lb\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | 5.37.1 | | ||
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [helm_release.alb_controller](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | ||
| [helm_release.superset](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | ||
| [kubernetes_ingress_class_v1.aws_alb](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/ingress_class_v1) | resource | | ||
| [kubernetes_ingress_v1.superset](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/ingress_v1) | resource | | ||
| [kubernetes_namespace.superset](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | | ||
| [kubernetes_service_account.service_account](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/service_account) | resource | | ||
| [null_resource.add_superset_repo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | ||
| [null_resource.helm_update_repos](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | ||
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_eks_cluster_version"></a> [eks\_cluster\_version](#input\_eks\_cluster\_version) | EKS Cluster version | `string` | `"1.28"` | no | | ||
| <a name="input_name"></a> [name](#input\_name) | Name of the VPC and EKS Cluster | `string` | `"superset-on-eks"` | no | | ||
| <a name="input_region"></a> [region](#input\_region) | Region | `string` | `"us-east-1"` | no | | ||
| <a name="input_secondary_cidr_blocks"></a> [secondary\_cidr\_blocks](#input\_secondary\_cidr\_blocks) | Secondary CIDR blocks to be attached to VPC | `list(string)` | <pre>[<br> "100.64.0.0/16"<br>]</pre> | no | | ||
| <a name="input_vpc_cidr"></a> [vpc\_cidr](#input\_vpc\_cidr) | VPC CIDR. This should be a valid private (RFC 1918) CIDR range | `string` | `"10.1.0.0/21"` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_configure_kubectl"></a> [configure\_kubectl](#output\_configure\_kubectl) | Configure kubectl: make sure you're logged in with the correct AWS profile and run the following command to update your kubeconfig | | ||
| <a name="output_superset_url"></a> [superset\_url](#output\_superset\_url) | Configure kubectl: Once the kubeconfig is configured as above, use the below command to get the Superset URL | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
#--------------------------------------------------------------- | ||
# GP3 Encrypted Storage Class | ||
#--------------------------------------------------------------- | ||
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.eks_cluster_id] | ||
} | ||
|
||
resource "kubernetes_storage_class" "default_gp3" { | ||
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 = "ext4" | ||
encrypted = true | ||
type = "gp3" | ||
} | ||
|
||
depends_on = [kubernetes_annotations.disable_gp2] | ||
} | ||
|
||
#--------------------------------------------------------------- | ||
# 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.20" | ||
role_name_prefix = 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 | ||
} | ||
|
||
module "eks_blueprints_addons" { | ||
source = "aws-ia/eks-blueprints-addons/aws" | ||
version = "~> 1.2" | ||
|
||
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 | ||
} | ||
} | ||
|
||
#--------------------------------------- | ||
# AWS Load Balancer Controller Add-on | ||
#--------------------------------------- | ||
enable_aws_load_balancer_controller = true | ||
# turn off the mutating webhook for services because we are using | ||
# service.beta.kubernetes.io/aws-load-balancer-type: external | ||
aws_load_balancer_controller = { | ||
set = [{ | ||
name = "enableServiceMutatorWebhook" | ||
value = "false" | ||
}] | ||
} | ||
|
||
tags = local.tags | ||
} | ||
|
||
module "eks_data_addons" { | ||
source = "aws-ia/eks-data-addons/aws" | ||
version = "~> 1.31.5" # ensure to update this to the latest/desired version | ||
|
||
oidc_provider_arn = module.eks.oidc_provider_arn | ||
|
||
#--------------------------------------- | ||
# AWS Apache Superset Add-on | ||
#--------------------------------------- | ||
enable_superset = true | ||
superset_helm_config = { | ||
values = [templatefile("${path.module}/helm-values/superset-values.yaml", {})] | ||
} | ||
depends_on = [module.eks_blueprints_addons] | ||
|
||
} | ||
|
||
#------------------------------------------------------------ | ||
# Create AWS Application Load balancer with Ingres | ||
#------------------------------------------------------------ | ||
resource "kubernetes_ingress_class_v1" "aws_alb" { | ||
metadata { | ||
name = "aws-alb" | ||
} | ||
|
||
spec { | ||
controller = "ingress.k8s.aws/alb" | ||
} | ||
|
||
depends_on = [module.eks.cluster_id] | ||
} | ||
|
||
resource "kubernetes_ingress_v1" "superset" { | ||
metadata { | ||
name = "superset-ingress3" | ||
namespace = "superset" | ||
annotations = { | ||
"alb.ingress.kubernetes.io/scheme" = "internet-facing" | ||
"alb.ingress.kubernetes.io/target-type" = "ip" | ||
} | ||
} | ||
spec { | ||
ingress_class_name = "aws-alb" | ||
rule { | ||
http { | ||
path { | ||
path = "/*" | ||
backend { | ||
service { | ||
name = "superset" | ||
port { | ||
number = 8088 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
depends_on = [module.eks_blueprints_addons, module.eks_data_addons] | ||
} |
Oops, something went wrong.