Skip to content

Commit

Permalink
Merge pull request #15 from nimbux911/add_k8s_auth_api_input
Browse files Browse the repository at this point in the history
### Added
- Input to define k8s authentication api for tf providers

### Fixed
- Removed dependency between ingress-nginx serviceMonitor and Prometheus helm chart
  • Loading branch information
qemanuel authored Jul 6, 2022
2 parents c7cffed + b589176 commit 6f26a77
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [3.1.7] - 2022-07-06

### Added
- Input to define k8s authentication api for tf providers

### Fixed
- Add default values for `controller.metrics.enabled` and `controller.metrics.serviceMonitor.enabled` to ingress-nginx Helm release in order to allow deploying it without having Prometheus as a dependency.
- Removed dependency between ingress-nginx serviceMonitor and Prometheus helm chart

## [3.1.6] - 2022-06-28

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ module "eks_main" {
| environment | Environment name of the resources. | `string` | `""` | yes |
| cluster\_name | Cluster name | `string` | `""` | yes |
| cluster\_version | Kubernetes version of the cluster. | `string` | `""` | yes |
| k8s\_auth\_api | Kubernetes authentication API for Terraform providers. | `string` | `client.authentication.k8s.io/v1alpha1` | no |
| vpc\_id | VPC ID where cluster will be deployed. | `string` | `""` | yes |
| subnets\_ids | Subnets ids from the VPC ID where the workers will be deployed. They must be, at least, from 2 differents AZs. | `list[string]` | `[]` | yes |
| instance\_type | Instance type of the EC2 workers. | `string` | `""` | yes |
Expand All @@ -171,6 +172,7 @@ module "eks_main" {
| helm\_ingress\_ngnix\_enabled | Set if ingress-nginx Helm chart will be installed on the cluster. | `bool` | `false` | no |
| ingress\_http\_nodeport | Set port for ingress http nodePort | `int` | `32080` | no |
| ingress\_https\_nodeport | Set port for ingress https nodePort | `int` | `32443` | no |
| ingress\_service\_monitor\_enabled | Enable serviceMonitor for ingress-nginx helm chart | `bool` | `false` | no |
| helm\_cluster\_autoscaler\_enabled | Set if cluster-autoscaler Helm chart will be installed on the cluster. | `bool` | `false` | no |
| helm\_metrics\_server\_enabled | Set if metrics-server Helm chart will be installed on the cluster. | `bool` | `false` | no |
| helm\_cert\_manager\_enabled | Set if cert-manager helm chart will be installed on the cluster | `bool` | `false` | no |
Expand Down
17 changes: 7 additions & 10 deletions helm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@ resource "helm_release" "ingress_nginx" {
file("${path.module}/helm-values/ingress-nginx.yaml")
]

dynamic "set" {
content {
name = "controller.metrics.enabled"
value = var.helm_prometheus_enabled
}
set {
name = "controller.metrics.enabled"
value = var.ingress_service_monitor_enabled
}

dynamic "set" {
content {
name = "controller.metrics.serviceMonitor.enabled"
value = var.helm_prometheus_enabled
}
set {
name = "controller.metrics.serviceMonitor.enabled"
value = var.ingress_service_monitor_enabled
}


set {
name = "controller.service.nodePorts.http"
value = var.ingress_http_nodeport
Expand Down
4 changes: 2 additions & 2 deletions provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ provider "kubernetes" {
host = aws_eks_cluster.main.endpoint
cluster_ca_certificate = base64decode(aws_eks_cluster.main.certificate_authority.0.data)
exec {
api_version = "client.authentication.k8s.io/v1alpha1"
api_version = var.k8s_auth_api
args = ["eks", "get-token", "--cluster-name", var.cluster_name]
command = "aws"
}
Expand All @@ -35,7 +35,7 @@ provider "helm" {
host = aws_eks_cluster.main.endpoint
cluster_ca_certificate = base64decode(aws_eks_cluster.main.certificate_authority.0.data)
exec {
api_version = "client.authentication.k8s.io/v1alpha1"
api_version = var.k8s_auth_api
args = ["eks", "get-token", "--cluster-name", var.cluster_name]
command = "aws"
}
Expand Down
8 changes: 8 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ variable "ignore_desired_capacity" {
default = false
}
variable "eks_worker_ami_id" {}

variable "k8s_auth_api" {
default = "client.authentication.k8s.io/v1alpha1"
}
variable "target_group_arns" {
default = []
}
Expand Down Expand Up @@ -77,6 +81,10 @@ variable "ingress_https_nodeport" {
default = 32443
}

variable "ingress_service_monitor_enabled" {
default = false
}

# cluster-autoscaler
variable "helm_cluster_autoscaler_enabled" {
default = false
Expand Down

0 comments on commit 6f26a77

Please sign in to comment.