Skip to content

Commit 27a3778

Browse files
committed
Allow NodePort services for LB
1 parent f7b4001 commit 27a3778

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

14_service.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ variable "service" {
6464
sourceRanges = optional(list(string), [])
6565
annotations = optional(map(string), {})
6666
remapPorts = optional(map(string), {})
67+
forceNodePortType = optional(bool, false)
6768
})), [])
6869
})
6970

@@ -145,7 +146,7 @@ resource "kubernetes_service_v1" "loadBalancer" {
145146
}
146147

147148
spec {
148-
type = "LoadBalancer"
149+
type = var.service.loadBalancer[count.index].forceNodePortType ? "NodePort" : "LoadBalancer"
149150
publish_not_ready_addresses = var.service.loadBalancer[count.index].publishNotReadyAddresses
150151
allocate_load_balancer_node_ports = var.service.loadBalancer[count.index].allocateLoadBalancerNodePorts
151152
session_affinity = var.service.loadBalancer[count.index].sessionAffinity

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [2.2.0] - 2024-03-20
2+
3+
- added boolean `var.service.loadbalancer.forceNodePortType` to allow spawning lb service as type nodeport
4+
15
## [2.1.0] - 2024-01-24
26

37
- add `podResourceTypeConfig.podManagementPolicy`

example/module/submodules/replaceMe/11_service.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ locals {
1919
}
2020
loadBalancer = [
2121
#{
22-
# externalTrafficPolicy = "Cluster"
22+
# forceNodePortType = false
23+
# externalTrafficPolicy = "Cluster"
2324
# publishNotReadyAddresses = false
24-
# sessionAffinity = "None"
25+
# sessionAffinity = "None"
2526
# sourceRanges = [
2627
# ]
2728
# remapPorts = {

0 commit comments

Comments
 (0)