Skip to content

Commit

Permalink
added variable for efs, added feature (#5)
Browse files Browse the repository at this point in the history
* Added variable which works with EFS and  Update main.tf
  • Loading branch information
RohitSquareops authored May 30, 2023
1 parent 1bbe31d commit 546c5fe
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 17 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module "eks_bootstrap" {
eks_cluster_name = "cluster_name"
reloader_enabled = true
karpenter_enabled = true
private_subnet_ids = [""]
single_az_sc_config = [{ name = "infra-service-sc", zone = "ap-south-1" }]
kubeclarity_enabled = false
kubeclarity_hostname = ""
Expand Down Expand Up @@ -61,6 +62,14 @@ module "eks_bootstrap" {
```

## Compatibility

| Release | Kubernetes 1.23 | Kubernetes 1.24 | Kubernetes 1.25 |
|------------------|------------------|------------------|----------------------|
| Release 1.0.0 | ✔ | ✗ | ✗ |
| Release 1.0.1 | ✔ | ✔ | ✔ |
| Release 1.1.0 | ✔ | ✔ | ✔ |

## IAM Permissions
The required IAM permissions to create resources from this module can be found [here](https://github.com/squareops/terraform-aws-eks-bootstrap/blob/main/IAM.md)

Expand Down Expand Up @@ -201,7 +210,6 @@ Velero is designed to work with cloud native environments, making it a popular c
| [kubernetes_namespace.internal_nginx](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |
| [aws_eks_cluster.eks](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster) | data source |
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
| [aws_subnet_ids.private_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source |
| [kubernetes_service.internal-nginx-ingress](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/data-sources/service) | data source |
| [kubernetes_service.nginx-ingress](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/data-sources/service) | data source |

Expand Down Expand Up @@ -242,6 +250,7 @@ Velero is designed to work with cloud native environments, making it a popular c
| <a name="input_metrics_server_helm_version"></a> [metrics\_server\_helm\_version](#input\_metrics\_server\_helm\_version) | Version of the metrics server helm chart | `string` | `"3.8.2"` | no |
| <a name="input_name"></a> [name](#input\_name) | Specify the name prefix of the EKS cluster resources. | `string` | `""` | no |
| <a name="input_node_termination_handler_version"></a> [node\_termination\_handler\_version](#input\_node\_termination\_handler\_version) | Specify the version of node termination handler | `string` | `"0.21.0"` | no |
| <a name="input_private_subnet_ids"></a> [private\_subnet\_ids](#input\_private\_subnet\_ids) | Private subnets of the VPC which can be used by EFS | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| <a name="input_reloader_enabled"></a> [reloader\_enabled](#input\_reloader\_enabled) | Enable or disable Reloader, a Kubernetes controller to watch changes in ConfigMap and Secret objects and trigger an application reload on their changes. | `bool` | `false` | no |
| <a name="input_service_monitor_crd_enabled"></a> [service\_monitor\_crd\_enabled](#input\_service\_monitor\_crd\_enabled) | Enable or disable the installation of Custom Resource Definitions (CRDs) for Prometheus Service Monitor. | `bool` | `false` | no |
| <a name="input_single_az_ebs_gp3_storage_class_enabled"></a> [single\_az\_ebs\_gp3\_storage\_class\_enabled](#input\_single\_az\_ebs\_gp3\_storage\_class\_enabled) | Whether to enable the Single AZ storage class or not. | `bool` | `false` | no |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: karpenter-provisioner
spec:
labels:
App-Services: "true"
Management-Services: "true"
requirements:
- key: karpenter.sh/capacity-type # optional, set to on-demand by default, spot if both are listed
operator: In
Expand Down
3 changes: 2 additions & 1 deletion examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

### [SquareOps Technologies](https://squareops.com/) Your DevOps Partner for Accelerating cloud journey.
<br>
Terraform module to create EKS cluster addons for workload deployment on AWS Cloud.
This example will be very useful for users who are new to a module and want to quickly learn how to use it. By reviewing the examples, users can gain a better understanding of how the module works, what features it supports, and how to customize it to their specific needs.
<br>
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

Expand Down
3 changes: 2 additions & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ locals {
environment = "prod"
name = "addons"
additional_tags = {
Owner = "SquareOps"
Owner = "Organization_Name"
Expires = "Never"
Department = "Engineering"
}
Expand All @@ -21,6 +21,7 @@ module "eks_bootstrap" {
eks_cluster_name = ""
reloader_enabled = true
karpenter_enabled = true
private_subnet_ids = [""]
single_az_sc_config = [{ name = "infra-service-sc", zone = "us-east-2a" }]
kubeclarity_enabled = false
kubeclarity_hostname = ""
Expand Down
17 changes: 5 additions & 12 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ module "service_monitor_crd" {
source = "./addons/service_monitor_crd"
}

data "aws_subnet_ids" "private_subnet_ids" {
vpc_id = var.vpc_id # Replace with your VPC ID
tags = {
Subnet-group = "private"
}
}

resource "aws_iam_instance_profile" "karpenter_profile" {
role = var.worker_iam_role_name
name_prefix = var.eks_cluster_name
Expand Down Expand Up @@ -177,7 +170,7 @@ module "efs" {
region = data.aws_region.current.name
environment = var.environment
kms_key_id = var.kms_key_arn
private_subnet_ids = data.aws_subnet_ids.private_subnet_ids.ids
private_subnet_ids = var.private_subnet_ids
}

data "kubernetes_service" "nginx-ingress" {
Expand Down Expand Up @@ -246,10 +239,10 @@ data "kubernetes_service" "internal-nginx-ingress" {
}

##KUBECLARITY
resource "kubernetes_namespace" "internal_nginx" {
resource "kubernetes_namespace" "kube_clarity" {
count = var.kubeclarity_enabled ? 1 : 0
metadata {
name = var.namespace
name = var.kubeclarity_namespace
}
}

Expand All @@ -258,12 +251,12 @@ resource "helm_release" "kubeclarity" {
name = "kubeclarity"
chart = "kubeclarity"
version = "2.18.0"
namespace = "kubeclarity"
namespace = var.kubeclarity_namespace
repository = "https://openclarity.github.io/kubeclarity"
values = [
templatefile("${path.module}/addons/kubeclarity/values.yaml", {
hostname = var.kubeclarity_hostname
namespace = var.namespace
namespace = var.kubeclarity_namespace
})
]
}
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ output "internal_nginx_ingress_controller_dns_hostname" {
}

output "kubeclarity_hostname" {
value = var.hostname
value = var.kubeclarity_hostname
description = "Hostname for the kubeclarity."
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ variable "efs_storage_class_enabled" {
type = bool
}

variable "private_subnet_ids" {
description = "Private subnets of the VPC which can be used by EFS"
default = [""]
type = list(string)
}

variable "keda_enabled" {
description = "Enable or disable Kubernetes Event-driven Autoscaling (KEDA) add-on for autoscaling workloads."
type = bool
Expand Down

0 comments on commit 546c5fe

Please sign in to comment.