Skip to content

Commit 4dd61ff

Browse files
committed
Install calico via terraform
This will be disabled by default to have the old behaviour Signed-off-by: solidnerd <[email protected]>
1 parent f92413c commit 4dd61ff

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ $ KUBECONFIG=secrets/admin.conf kubectl expose deploy nginx --port=80 --type Nod
4242
| `docker_version` | `18.06` | Docker CE version that will be installed | No |
4343
| `kubernetes_version` | `1.12.0` | Kubernetes version that will be installed | No |
4444
| `core_dns` | `false` | Enables CoreDNS as Service Discovery | No |
45-
45+
| `calico_enabled` | `false` | Installs Calico Network Provider after the master comes up | No |
4646
All variables cloud be passed through `environment variables` or a `tfvars` file.
4747

4848
An example for a `tfvars` file would be the following `terraform.tfvars`

install-calico.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
resource "null_resource" "calico" {
2+
count = "${var.calico_enabled ? 1 : 0}"
3+
4+
connection {
5+
host = "${hcloud_server.master.*.ipv4_address}"
6+
private_key = "${file(var.ssh_private_key)}"
7+
}
8+
9+
provisioner "remote-exec" {
10+
inline = <<EOF
11+
kubectl apply -f https://docs.projectcalico.org/v3.2/getting-started/kubernetes/installation/hosted/etcd.yaml
12+
kubectl apply -f https://docs.projectcalico.org/v3.2/getting-started/kubernetes/installation/rbac.yaml
13+
kubectl apply -f https://docs.projectcalico.org/v3.2/getting-started/kubernetes/installation/hosted/calico.yaml
14+
EOF
15+
}
16+
17+
depends_on = ["hcloud_server.master"]
18+
}

variables.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,9 @@ variable "kubernetes_version" {
4343
}
4444

4545
variable "core_dns" {
46-
default = "false"
46+
default = false
47+
}
48+
49+
variable "calico_enabled" {
50+
default = false
4751
}

0 commit comments

Comments
 (0)