From 86da75aaf24372c939b7586ffeca4ae4b627be46 Mon Sep 17 00:00:00 2001 From: shockrah Date: Fri, 26 Jul 2024 16:38:57 -0700 Subject: [PATCH] commiting defunct project for now --- infra/vultr-kubernetes/k8s/ingress.tf | 24 +++++++++++++++++++++- infra/vultr-kubernetes/k8s/shockrah-xyz.tf | 21 ++----------------- infra/vultr-kubernetes/k8s/variables.tf | 6 ++++++ 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/infra/vultr-kubernetes/k8s/ingress.tf b/infra/vultr-kubernetes/k8s/ingress.tf index 36eccb9..78846f1 100644 --- a/infra/vultr-kubernetes/k8s/ingress.tf +++ b/infra/vultr-kubernetes/k8s/ingress.tf @@ -1,12 +1,14 @@ resource kubernetes_ingress_v1 athens { metadata { name = var.shockrahxyz.name + namespace = kubernetes_namespace.websites.metadata.0.name labels = { - app = var.shockrahxyz.name + app = "websites" } } spec { rule { + host = "test.shockrah.xyz" http { path { backend { @@ -25,4 +27,24 @@ resource kubernetes_ingress_v1 athens { } +resource kubernetes_service athens_lb { + metadata { + name = "athens-websites" + namespace = kubernetes_namespace.websites.metadata.0.name + labels = { + app = "websites" + } + } + spec { + selector = { + app = kubernetes_ingress_v1.athens.metadata.0.labels.app + } + port { + port = 80 + target_port = 80 + } + type = "LoadBalancer" + external_ips = [ var.cluster.ip ] + } +} diff --git a/infra/vultr-kubernetes/k8s/shockrah-xyz.tf b/infra/vultr-kubernetes/k8s/shockrah-xyz.tf index de25bb4..ec76454 100644 --- a/infra/vultr-kubernetes/k8s/shockrah-xyz.tf +++ b/infra/vultr-kubernetes/k8s/shockrah-xyz.tf @@ -1,4 +1,4 @@ -# Plain nginx for now so that we can test out reverse dns +Plain nginx for now so that we can test out reverse dns resource kubernetes_pod shockrah { metadata { name = var.shockrahxyz.name @@ -18,21 +18,4 @@ resource kubernetes_pod shockrah { } } -resource kubernetes_service shockrah { - metadata { - name = var.shockrahxyz.name - namespace = kubernetes_namespace.websites.metadata.0.name - labels = { - app = var.shockrahxyz.name - } - } - spec { - selector = { - app = kubernetes_pod.shockrah.metadata.0.name - } - port { - port = 80 - } - type = "LoadBalancer" - } -} + diff --git a/infra/vultr-kubernetes/k8s/variables.tf b/infra/vultr-kubernetes/k8s/variables.tf index 0d726f1..02bc9a5 100644 --- a/infra/vultr-kubernetes/k8s/variables.tf +++ b/infra/vultr-kubernetes/k8s/variables.tf @@ -27,3 +27,9 @@ variable shockrahxyz { }) } +variable cluster { + type = object({ + ip = string + }) +} +