Skip to content

Commit 7eb3b5d

Browse files
feat: AL-3844 Add sameSite configuration to happy_sticky_session cookie
- configuration is optional with a default of "Lax"
1 parent 79781a6 commit 7eb3b5d

File tree

6 files changed

+13
-8
lines changed

6 files changed

+13
-8
lines changed

terraform/modules/happy-ingress-eks/variables.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ variable "routing" {
100100
enabled = optional(bool, false),
101101
duration_seconds = optional(number, 600),
102102
cookie_name = optional(string, "happy_sticky_session"),
103+
cookie_samesite = optional(string, "Lax"),
103104
}), {})
104105
})
105106
description = "Routing configuration for the ingress"
@@ -145,4 +146,4 @@ variable "additional_annotations" {
145146
type = map(string)
146147
description = "Additional annotations to apply to the ingress resource"
147148
default = {}
148-
}
149+
}

terraform/modules/happy-nginx-ingress-eks/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ No modules.
3131
| <a name="input_ingress_name"></a> [ingress\_name](#input\_ingress\_name) | Name of the ingress resource | `string` | n/a | yes |
3232
| <a name="input_k8s_namespace"></a> [k8s\_namespace](#input\_k8s\_namespace) | K8S namespace for this service | `string` | n/a | yes |
3333
| <a name="input_labels"></a> [labels](#input\_labels) | Labels to apply to ingress resource | `map(string)` | n/a | yes |
34-
| <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 |
34+
| <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 |
3535
| <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 |
3636
| <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 |
3737
| <a name="input_timeout"></a> [timeout](#input\_timeout) | Timeout for the ingress resource | `number` | `60` | no |
3838

3939
## Outputs
4040

4141
No outputs.
42-
<!-- END -->
42+
<!-- END -->

terraform/modules/happy-nginx-ingress-eks/main.tf

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11

22
locals {
33
sticky_annotations = {
4-
"nginx.ingress.kubernetes.io/affinity" = "cookie"
5-
"nginx.ingress.kubernetes.io/session-cookie-name" = var.sticky_sessions.cookie_name
6-
"nginx.ingress.kubernetes.io/session-cookie-max-age" = var.sticky_sessions.duration_seconds
4+
"nginx.ingress.kubernetes.io/affinity" = "cookie"
5+
"nginx.ingress.kubernetes.io/session-cookie-name" = var.sticky_sessions.cookie_name
6+
"nginx.ingress.kubernetes.io/session-cookie-max-age" = var.sticky_sessions.duration_seconds
7+
"nginx.ingress.kubernetes.io/session-cookie-samesite" = var.sticky_sessions.cookie_samesite
78
}
89

910
base_annotations = {
@@ -50,4 +51,4 @@ resource "kubernetes_ingress_v1" "ingress" {
5051
}
5152
}
5253
}
53-
}
54+
}

terraform/modules/happy-nginx-ingress-eks/variables.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ variable "sticky_sessions" {
4747
enabled = optional(bool, true),
4848
duration_seconds = optional(number, 600),
4949
cookie_name = optional(string, "happy_sticky_session"),
50+
cookie_samesite = optional(string, "Lax"),
5051
})
5152
description = "Sticky session configuration"
5253
default = {}
53-
}
54+
}

terraform/modules/happy-service-eks/variables.tf

+1
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ variable "routing" {
334334
enabled = optional(bool, false),
335335
duration_seconds = optional(number, 600),
336336
cookie_name = optional(string, "happy_sticky_session"),
337+
cookie_samesite = optional(string, "Lax"),
337338
}), {})
338339
})
339340
description = "Routing configuration for the ingress"

terraform/modules/happy-stack-eks/variables.tf

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ variable "services" {
119119
enabled = optional(bool, false),
120120
duration_seconds = optional(number, 600),
121121
cookie_name = optional(string, "happy_sticky_session"),
122+
cookie_samesite = optional(string, "Lax"),
122123
}), {})
123124
sidecars = optional(map(object({
124125
image = string

0 commit comments

Comments
 (0)