diff --git a/service/k3s/ip-floater.tf b/service/k3s/ip-floater.tf deleted file mode 100644 index 032ba81..0000000 --- a/service/k3s/ip-floater.tf +++ /dev/null @@ -1,38 +0,0 @@ -variable "floating_ip_auth" { - description = "Provider credentials to use for authenticating" - default = "" -} - -locals { - ip-floater = templatefile("${path.module}/templates/ip-floater.yaml", { - hcloud_token = lookup(var.floating_ip, "provider_auth", "") - provider = lookup(var.floating_ip, "provider", "") - floating_ip = local.floating_ip - }) -} - -resource "null_resource" "ip-floater_apply" { - # Skip if use_ip-floater is false. - count = var.node_count > 0 && lookup(var.install_app, "ip-floater", false) == true ? 1 : 0 - triggers = { - k3s_id = join(" ", null_resource.k3s.*.id) - ip-floater = md5(local.ip-floater) - ssh_key_path = local.ssh_key_path - master_public_ip = local.master_public_ip - } - - # Use master(s) - connection { - host = self.triggers.master_public_ip - user = "root" - agent = false - private_key = file(self.triggers.ssh_key_path) - } - - # Upload ip-floater - provisioner "file" { - content = local.ip-floater - destination = "/var/lib/rancher/k3s/server/manifests/ip-floater.yaml" - } -} - diff --git a/service/k3s/templates/ip-floater.yaml b/service/k3s/templates/ip-floater.yaml deleted file mode 100644 index 6a93589..0000000 --- a/service/k3s/templates/ip-floater.yaml +++ /dev/null @@ -1,91 +0,0 @@ ---- -apiVersion: v1 -kind: Namespace -metadata: - name: hcloud-ip-floater ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - app.kubernetes.io/name: hcloud-ip-floater - name: hcloud-ip-floater - namespace: hcloud-ip-floater ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: hcloud-ip-floater - name: hcloud-ip-floater -rules: -- apiGroups: - - "" - resources: - - services - verbs: - - get - - watch - - list -- apiGroups: - - "" - resources: - - pods - verbs: - - get - - watch - - list ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRoleBinding -metadata: - labels: - app.kubernetes.io/name: hcloud-ip-floater - name: hcloud-ip-floater -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: hcloud-ip-floater -subjects: -- kind: ServiceAccount - name: hcloud-ip-floater - namespace: hcloud-ip-floater ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app.kubernetes.io/name: hcloud-ip-floater - name: hcloud-ip-floater - namespace: hcloud-ip-floater -spec: - replicas: 1 - selector: - matchLabels: - app.kubernetes.io/name: hcloud-ip-floater - strategy: - type: Recreate - template: - metadata: - labels: - app.kubernetes.io/name: hcloud-ip-floater - spec: - containers: - - envFrom: - - secretRef: - name: hcloud-ip-floater-secret-env - - configMapRef: - name: hcloud-ip-floater-config-env - optional: true - image: costela/hcloud-ip-floater:v0.1.4 - name: hcloud-ip-floater - serviceAccountName: hcloud-ip-floater ---- -apiVersion: v1 -kind: Secret -metadata: - name: hcloud-ip-floater-secret-env - namespace: hcloud-ip-floater -stringData: - HCLOUD_IP_FLOATER_HCLOUD_TOKEN: ${hcloud_token} - HCLOUD_IP_FLOATER_LOG_LEVEL: info \ No newline at end of file