forked from yevgenis-shapiro/terraform-terrakube-deployment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metallb.tf
47 lines (44 loc) · 1.16 KB
/
metallb.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
data "external" "subnet" {
program = ["/bin/bash", "-c", "docker network inspect -f '{{json .IPAM.Config}}' kind | jq .[0]"]
depends_on = [
kind_cluster.default
]
}
resource "helm_release" "metallb" {
name = "metallb"
repository = "https://metallb.github.io/metallb"
chart = "metallb"
namespace = "metallb"
version = "0.10.3"
create_namespace = true
timeout = 300
values = [
<<-EOF
configInline:
address-pools:
- name: default
protocol: layer2
addresses:
# - ${cidrhost(data.external.subnet.result.Subnet, 150)}-${cidrhost(data.external.subnet.result.Subnet, 200)}
- 172.18.255.1-172.18.255.250
EOF
]
depends_on = [
kind_cluster.default
]
}
resource "null_resource" "wait_for_metallb" {
triggers = {
key = uuid()
}
provisioner "local-exec" {
command = <<EOF
printf "\nWaiting for the metallb controller...\n"
kubectl wait --namespace ${helm_release.metallb.namespace} \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=speaker \
--timeout=90s
EOF
}
depends_on = [helm_release.metallb]
}