diff --git a/meta/lotus-land-story/kuard.tf b/meta/lotus-land-story/kuard.tf new file mode 100644 index 0000000..bd9e988 --- /dev/null +++ b/meta/lotus-land-story/kuard.tf @@ -0,0 +1,84 @@ +resource "kubernetes_deployment" "kuard" { + metadata { + name = "kuard" + } + + spec { + selector { + match_labels = { + app = "kuard" + } + } + replicas = 1 + template { + metadata { + labels = { + app = "kuard" + } + } + spec { + container { + image = "gcr.io/kuar-demo/kuard-amd64:1" + image_pull_policy = "Always" + name = "kuard" + port { + container_port = 8080 + } + } + } + } + } +} + +resource "kubernetes_service" "kuard" { + metadata { + name = "kuard" + } + + spec { + port { + port = 80 + target_port = 8080 + protocol = "TCP" + } + selector = { + app = "kuard" + } + } +} + +resource "kubernetes_ingress_v1" "kuard" { + metadata { + name = "kuard" + annotations = { + "kubernetes.io/ingress.class" = "nginx" + "cert-manager.io/issuer" = "letsencrypt-prod" + } + } + + spec { + tls { + hosts = [ + "kuard.${var.domain}" + ] + secret_name = "kuard-tls" + } + rule { + host = "kuard.${var.domain}" + http { + path { + path = "/" + path_type = "Prefix" + backend { + service { + name = "kuard" + port { + number = 80 + } + } + } + } + } + } + } +} diff --git a/meta/lotus-land-story/main.tf b/meta/lotus-land-story/main.tf index b094a37..a3aa4db 100644 --- a/meta/lotus-land-story/main.tf +++ b/meta/lotus-land-story/main.tf @@ -104,88 +104,3 @@ resource "helm_release" "ingress_nginx" { chart = "ingress-nginx" version = "4.0.13" } - -resource "kubernetes_deployment" "kuard" { - metadata { - name = "kuard" - } - - spec { - selector { - match_labels = { - app = "kuard" - } - } - replicas = 1 - template { - metadata { - labels = { - app = "kuard" - } - } - spec { - container { - image = "gcr.io/kuar-demo/kuard-amd64:1" - image_pull_policy = "Always" - name = "kuard" - port { - container_port = 8080 - } - } - } - } - } -} - -resource "kubernetes_service" "kuard" { - metadata { - name = "kuard" - } - - spec { - port { - port = 80 - target_port = 8080 - protocol = "TCP" - } - selector = { - app = "kuard" - } - } -} - -resource "kubernetes_ingress_v1" "kuard" { - metadata { - name = "kuard" - annotations = { - "kubernetes.io/ingress.class" = "nginx" - "cert-manager.io/issuer" = "letsencrypt-prod" - } - } - - spec { - tls { - hosts = [ - "kuard.${var.domain}" - ] - secret_name = "kuard-tls" - } - rule { - host = "kuard.${var.domain}" - http { - path { - path = "/" - path_type = "Prefix" - backend { - service { - name = "kuard" - port { - number = 80 - } - } - } - } - } - } - } -}