Skip to content

Commit

Permalink
include certificate and Cloudwatch on terrraform
Browse files Browse the repository at this point in the history
Signed-off-by: Luiz Oliveira <ziuloliveira@gmail.com>
  • Loading branch information
Ziul committed Sep 21, 2023
1 parent cb27d2f commit c316092
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 38 deletions.
38 changes: 17 additions & 21 deletions deploy/kubernetes/terraform/addons.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
data "aws_acm_certificate" "kubeshark_crt" {
domain = "*.kubehq.org"
statuses = ["ISSUED"]
most_recent = true
}

module "eks_blueprints_addons" {
source = "aws-ia/eks-blueprints-addons/aws"
version = "~> 1.0" #ensure to update this to the latest/desired version
Expand All @@ -7,27 +13,13 @@ module "eks_blueprints_addons" {
cluster_version = module.eks.cluster_version
oidc_provider_arn = module.eks.oidc_provider_arn

# eks_addons = {
# aws-ebs-csi-driver = {
# most_recent = true
# }
# coredns = {
# most_recent = true
# }
# vpc-cni = {
# most_recent = true
# }
# kube-proxy = {
# most_recent = true
# }
# }

enable_kube_prometheus_stack = var.enable_kube_prometheus_stack
enable_aws_cloudwatch_metrics = var.enable_aws_cloudwatch_metrics
enable_ingress_nginx = var.enable_ingress_nginx
enable_aws_load_balancer_controller = true
enable_kube_prometheus_stack = false
enable_metrics_server = true
enable_external_secrets = false
enable_ingress_nginx = false
enable_argocd = true
enable_argocd = false
enable_cluster_proportional_autoscaler = false
enable_external_dns = false
enable_karpenter = false
Expand Down Expand Up @@ -64,10 +56,14 @@ resource "helm_release" "kubeshark" {
name = "kubeshark"
repository = "https://helm.kubeshark.co"
chart = "kubeshark"
values = [templatefile("${path.module}/values/kubeshark.yaml", {})]
values = [templatefile("${path.module}/values/kubeshark.yaml", {
certificate_arn = data.aws_acm_certificate.kubeshark_crt.arn
})]
count = var.enable_kubeshark ? 1 : 0
}

resource "kubectl_manifest" "sock-shop" {
yaml_body = templatefile("${path.module}/values/sock-shop-demo.yaml", {})
resource "kubectl_manifest" "sock_shop" {
yaml_body = templatefile("${path.module}/../complete-demo.yaml", {})
wait_for_rollout = true
count = var.enable_sock_shop ? 1 : 0
}
3 changes: 2 additions & 1 deletion deploy/kubernetes/terraform/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ locals {
azs = slice(data.aws_availability_zones.available.names, 0, 3)

tags = {
Example = local.name
Release = local.name
Kind = "demo"
GithubRepo = "terraform-aws-eks"
GithubOrg = "terraform-aws-modules"
}
Expand Down
8 changes: 7 additions & 1 deletion deploy/kubernetes/terraform/values/ingress-nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ controller:
enabled: true
service:
externalTrafficPolicy: Local
type: LoadBalancer
targetPorts:
http: http
https: http
Expand All @@ -11,4 +12,9 @@ controller:
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "http"
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https"
service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: '3600'
service.beta.kubernetes.io/aws-load-balancer-internal: false
service.beta.kubernetes.io/aws-load-balancer-internal: false
service.beta.kubernetes.io/aws-load-balancer-type: external
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
service.beta.kubernetes.io/aws-load-balancer-healthcheck-protocol: http
service.beta.kubernetes.io/aws-load-balancer-healthcheck-path: /healthz
service.beta.kubernetes.io/aws-load-balancer-healthcheck-port: 10254
4 changes: 3 additions & 1 deletion deploy/kubernetes/terraform/values/kubeshark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ tap:
ingress:
enabled: true
classname: alb
host: demo.kubehq.org
annotations:
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/certificate-arn : "${certificate_arn}"
14 changes: 0 additions & 14 deletions deploy/kubernetes/terraform/values/sock-shop-demo.yaml

This file was deleted.

31 changes: 31 additions & 0 deletions deploy/kubernetes/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,34 @@ variable "region" {
type = string
default = "us-east-2"
}

variable "enable_kubeshark" {
description = "Enables Kubeshark installation"
type = bool
default = false
}

variable "enable_sock_shop" {
description = "Enables Sock Shop installation"
type = bool
default = false
}

variable "enable_kube_prometheus_stack" {
description = "Enables Prometheus Stack installation"
type = bool
default = true
}

variable "enable_aws_cloudwatch_metrics" {
description = "Enables Cloudwatch Metrics installation"
type = bool
default = true
}

variable "enable_ingress_nginx" {
description = "Enables Ingress Nginx installation"
type = bool
default = false
}

0 comments on commit c316092

Please sign in to comment.