Skip to content

Commit

Permalink
Add support for node selectors and tolerations.
Browse files Browse the repository at this point in the history
Fixes #4
  • Loading branch information
Benjamin P. Jung committed Oct 11, 2019
1 parent df5f7fe commit b3f006d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.1
3.3.0
31 changes: 31 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,37 @@ resource "kubernetes_deployment" "this" {
}

spec {

dynamic "affinity" {
for_each = length(var.node_selectors) > 0 ? ["placeholder"] : []
content {
node_affinity {
required_during_scheduling_ignored_during_execution {
dynamic "node_selector_term" {
for_each = var.node_selectors
content {
match_expressions {
key = node_selector_term.key
operator = "In"
values = [node_selector_term.value]
}
}
}
}
}
}
}

dynamic "toleration" {
for_each = var.tolerations
content {
key = toleration.value["key"]
operator = toleration.value["operator"]
value = toleration.value["value"]
effect = toleration.value["effect"]
}
}

automount_service_account_token = true

dynamic "volume" {
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,15 @@ variable "tiller_tls" {
}
description = "TLS configuration for Tiller."
}

variable "tolerations" {
type = list(map(string))
default = []
description = "Tolerations to apply to Tiller deployment"
}

variable "node_selectors" {
type = map(string)
default = {}
description = "Map of {label: value} to use as node selector for Tiller deployment"
}

0 comments on commit b3f006d

Please sign in to comment.