Skip to content

Commit

Permalink
Allow setting ingress-nginx custom configuration options (#48)
Browse files Browse the repository at this point in the history
* Allow setting ingress-nginx custom configuration options

* Add clearer documentation
  • Loading branch information
ivours authored Sep 18, 2024
1 parent 01e0780 commit a35efe2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [5.4.0] - 2024-08-22

- Allow setting ingress-nginx custom configuration options.

## [5.3.0] - 2024-07-29

- Add mixed instances policy.
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ module "eks_main" {
eks_tags = var.eks_tags
health_check_type = "ELB"
# Example for ingress-nginx log format in logfmt using real source ip as client_ip
ingress_custom_configuration = "log-format-upstream: timestamp=$time_iso8601 client_ip=$http_x_forwarded_for method=$request_method uri=$request_uri status=$status http_user_agent=$http_user_agent request_length=$request_length request_time=$request_time proxy_upstream_name=$proxy_upstream_name upstream_addr=$upstream_addr upstream_response_length=$upstream_response_length upstream_response_time=$upstream_response_time upstream_status=$upstream_status req_id=$req_id"
managed_node_groups = [
{
name = "monitoring-${var.cluster_name}"
Expand Down Expand Up @@ -236,6 +239,7 @@ module "eks_main" {
| enabled\_cluster\_log\_types | Enable CloudWatch Logs for control plane components | `list[string]` | `[]` | no |
| helm\_ingress\_nginx\_enabled | Set if ingress-nginx Helm chart will be installed on the cluster. | `bool` | `false` | no |
| ingress\_chart\_version | Set the version for the chart | `string` | `4.0.18` | no |
| ingress\_custom\_configuration | Add custom configuration options (see example above in module call inputs and https://github.com/kubernetes/ingress-nginx/blob/main/charts/ingress-nginx/values.yaml#L52) | `string` | `null` | 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\_https\_traffic\_enabled | Set https traffic for ingress | `bool` | `false` | no |
Expand Down
5 changes: 5 additions & 0 deletions helm-values/ingress-nginx.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@ controller:
values:
- ${nodeAffinityLabelValue}
%{endif}

%{ if customConfiguration != null }
config:
${ customConfiguration }
%{ endif }
3 changes: 2 additions & 1 deletion helm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ resource "helm_release" "ingress_nginx" {
{
enableNodeAffinity = var.ingress_node_affinity["enabled"],
nodeAffinityLabelKey = var.ingress_node_affinity["label_key"],
nodeAffinityLabelValue = var.ingress_node_affinity["label_value"]
nodeAffinityLabelValue = var.ingress_node_affinity["label_value"],
customConfiguration = var.ingress_custom_configuration
})
]

Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ variable "ingress_node_affinity" {
}
}

variable "ingress_custom_configuration" {
type = string
default = null
}

# ================== ingress-nginx-additional =================

variable "helm_ingress_nginx_additional_enabled" {
Expand Down

0 comments on commit a35efe2

Please sign in to comment.