-
Notifications
You must be signed in to change notification settings - Fork 0
/
k3s.tf.stop
33 lines (26 loc) · 1.28 KB
/
k3s.tf.stop
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
resource "ssh_resource" "install_k3s" {
host = var.server.host
user = var.server.user
private_key = file(var.server.private_key)
# agent = true
commands = [
"curl -sfL ${local.k3s.download_url} | INSTALL_K3S_VERSION='${local.k3s.version}' sh -s - --write-kubeconfig-mode 644 --disable=servicelb --flannel-backend=none --disable-network-policy"
# TODO: For HA k3s cluster setup
# "curl -sfL ${local.k3s.download_url} | INSTALL_K3S_VERSION='${local.k3s.version}' sh -s - server --cluster-init --docker --write-kubeconfig-mode 644 --disable=traefik"
]
timeout = "10m"
depends_on = [ ssh_resource.files ]
}
resource "time_sleep" "wait_30_seconds_2" {
destroy_duration = "30s"
}
# Note: Removed waiting for k3s server to be ready
resource "ssh_resource" "uninstall_k3s" {
when = "destroy"
host = var.server.host
user = var.server.user
private_key = file(var.server.private_key)
# agent = true
commands = ["bash -c 'ip link delete cilium_host; ip link delete cilium_net; ip link delete cilium_vxlan; iptables-save | grep -iv cilium | iptables-restore; ip6tables-save | grep -iv cilium | ip6tables-restore; /usr/local/bin/k3s-killall.sh; /usr/local/bin/k3s-uninstall.sh;'"]
depends_on = [ time_sleep.wait_30_seconds_2 ]
}