Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add sameSite configuration to happy_sticky_session cookie #3818

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion terraform/modules/happy-ingress-eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ variable "routing" {
enabled = optional(bool, false),
duration_seconds = optional(number, 600),
cookie_name = optional(string, "happy_sticky_session"),
cookie_samesite = optional(string, "Lax"),
}), {})
})
description = "Routing configuration for the ingress"
Expand Down Expand Up @@ -145,4 +146,4 @@ variable "additional_annotations" {
type = map(string)
description = "Additional annotations to apply to the ingress resource"
default = {}
}
}
4 changes: 2 additions & 2 deletions terraform/modules/happy-nginx-ingress-eks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ No modules.
| <a name="input_ingress_name"></a> [ingress\_name](#input\_ingress\_name) | Name of the ingress resource | `string` | n/a | yes |
| <a name="input_k8s_namespace"></a> [k8s\_namespace](#input\_k8s\_namespace) | K8S namespace for this service | `string` | n/a | yes |
| <a name="input_labels"></a> [labels](#input\_labels) | Labels to apply to ingress resource | `map(string)` | n/a | yes |
| <a name="input_sticky_sessions"></a> [sticky\_sessions](#input\_sticky\_sessions) | Sticky session configuration | <pre>object({<br> enabled = optional(bool, true),<br> duration_seconds = optional(number, 600),<br> cookie_name = optional(string, "happy_sticky_session"),<br> })</pre> | `{}` | no |
| <a name="input_sticky_sessions"></a> [sticky\_sessions](#input\_sticky\_sessions) | Sticky session configuration | <pre>object({<br> enabled = optional(bool, true),<br> duration_seconds = optional(number, 600),<br> cookie_name = optional(string, "happy_sticky_session"),<br> cookie_samesite = optional(string, "Lax"),<br> })</pre> | `{}` | no |
| <a name="input_target_service_name"></a> [target\_service\_name](#input\_target\_service\_name) | Name of destination service that the ingress should route to | `string` | n/a | yes |
| <a name="input_target_service_port"></a> [target\_service\_port](#input\_target\_service\_port) | Port of destination service that the ingress should route to | `string` | n/a | yes |
| <a name="input_timeout"></a> [timeout](#input\_timeout) | Timeout for the ingress resource | `number` | `60` | no |

## Outputs

No outputs.
<!-- END -->
<!-- END -->
9 changes: 5 additions & 4 deletions terraform/modules/happy-nginx-ingress-eks/main.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

locals {
sticky_annotations = {
"nginx.ingress.kubernetes.io/affinity" = "cookie"
"nginx.ingress.kubernetes.io/session-cookie-name" = var.sticky_sessions.cookie_name
"nginx.ingress.kubernetes.io/session-cookie-max-age" = var.sticky_sessions.duration_seconds
"nginx.ingress.kubernetes.io/affinity" = "cookie"
"nginx.ingress.kubernetes.io/session-cookie-name" = var.sticky_sessions.cookie_name
"nginx.ingress.kubernetes.io/session-cookie-max-age" = var.sticky_sessions.duration_seconds
"nginx.ingress.kubernetes.io/session-cookie-samesite" = var.sticky_sessions.cookie_samesite
}

base_annotations = {
Expand Down Expand Up @@ -50,4 +51,4 @@ resource "kubernetes_ingress_v1" "ingress" {
}
}
}
}
}
3 changes: 2 additions & 1 deletion terraform/modules/happy-nginx-ingress-eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ variable "sticky_sessions" {
enabled = optional(bool, true),
duration_seconds = optional(number, 600),
cookie_name = optional(string, "happy_sticky_session"),
cookie_samesite = optional(string, "Lax"),
})
description = "Sticky session configuration"
default = {}
}
}
1 change: 1 addition & 0 deletions terraform/modules/happy-service-eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ variable "routing" {
enabled = optional(bool, false),
duration_seconds = optional(number, 600),
cookie_name = optional(string, "happy_sticky_session"),
cookie_samesite = optional(string, "Lax"),
}), {})
})
description = "Routing configuration for the ingress"
Expand Down
1 change: 1 addition & 0 deletions terraform/modules/happy-stack-eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ variable "services" {
enabled = optional(bool, false),
duration_seconds = optional(number, 600),
cookie_name = optional(string, "happy_sticky_session"),
cookie_samesite = optional(string, "Lax"),
}), {})
sidecars = optional(map(object({
image = string
Expand Down
Loading