Compare commits
25 Commits
cfe631eba7
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| eea4c61537 | |||
| ee860c6e1f | |||
| 1c11410c2d | |||
| 4d71994b85 | |||
| 79cb4eb1a6 | |||
| e8817fe093 | |||
| 97bffd2042 | |||
| 37305fd74e | |||
| 555124bf2f | |||
| e209da949b | |||
| caa2eba639 | |||
| 982669ed4a | |||
| 4446ef813f | |||
| 9dc2f1d769 | |||
| 01b7b4ced8 | |||
| 29cdfcb695 | |||
| bbbc9ed477 | |||
| d64c5526e6 | |||
| 469b3d08ce | |||
| 7f5b3205d0 | |||
| 67ff5ce729 | |||
| 6aadb47c61 | |||
| 0624161f53 | |||
| c6b2a062e9 | |||
| 718647f617 |
@@ -38,6 +38,9 @@ locals {
|
|||||||
{ name = "resume.shockrah.xyz", records = [ var.vultr_host ] },
|
{ name = "resume.shockrah.xyz", records = [ var.vultr_host ] },
|
||||||
{ name = "git.shockrah.xyz", records = [ var.vultr_host ] },
|
{ name = "git.shockrah.xyz", records = [ var.vultr_host ] },
|
||||||
{ name = "sanity.shockrah.xyz", records = [ var.vke_lb ] },
|
{ name = "sanity.shockrah.xyz", records = [ var.vke_lb ] },
|
||||||
|
{ name = "uptime.shockrah.xyz", records = [ var.vke_lb ] },
|
||||||
|
{ name = "code.shockrah.xyz", records = [ var.vke_lb ] },
|
||||||
|
{ name = "wiki.shockrah.xyz", records = [ var.vke_lb ] },
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,3 +33,11 @@ resource "aws_route53_record" "temper-tv-mx" {
|
|||||||
"50 fb.mail.gandi.net.",
|
"50 fb.mail.gandi.net.",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "aws_route53_record" "temper-tv-test" {
|
||||||
|
zone_id = aws_route53_zone.temper-tv.id
|
||||||
|
name = "test.temper.tv"
|
||||||
|
type = "A"
|
||||||
|
ttl = 300
|
||||||
|
records = [ var.vke_lb ]
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
aws = {
|
aws = {
|
||||||
source = "hashicorp/aws"
|
source = "hashicorp/aws"
|
||||||
version = "5.98.0"
|
version = "6.27.0"
|
||||||
}
|
}
|
||||||
vultr = {
|
vultr = {
|
||||||
source = "vultr/vultr"
|
source = "vultr/vultr"
|
||||||
@@ -17,7 +17,7 @@ terraform {
|
|||||||
}
|
}
|
||||||
kubernetes = {
|
kubernetes = {
|
||||||
source = "hashicorp/kubernetes"
|
source = "hashicorp/kubernetes"
|
||||||
version = "2.37.1"
|
version = "3.0.1"
|
||||||
}
|
}
|
||||||
kubectl = {
|
kubectl = {
|
||||||
source = "gavinbunney/kubectl"
|
source = "gavinbunney/kubectl"
|
||||||
@@ -27,11 +27,14 @@ terraform {
|
|||||||
source = "hashicorp/helm"
|
source = "hashicorp/helm"
|
||||||
version = "3.0.2"
|
version = "3.0.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
tls = {
|
tls = {
|
||||||
source = "hashicorp/tls"
|
source = "hashicorp/tls"
|
||||||
version = "4.1.0"
|
version = "4.1.0"
|
||||||
}
|
}
|
||||||
|
random = {
|
||||||
|
source = "hashicorp/random"
|
||||||
|
version = "3.7.2"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ resource vultr_kubernetes athens {
|
|||||||
label = var.cluster.pools["main"].label
|
label = var.cluster.pools["main"].label
|
||||||
min_nodes = var.cluster.pools["main"].min_nodes
|
min_nodes = var.cluster.pools["main"].min_nodes
|
||||||
max_nodes = var.cluster.pools["main"].max_nodes
|
max_nodes = var.cluster.pools["main"].max_nodes
|
||||||
|
auto_scaler = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,16 +8,3 @@
|
|||||||
# port = each.value
|
# port = each.value
|
||||||
# }
|
# }
|
||||||
|
|
||||||
resource vultr_firewall_group bastion {
|
|
||||||
description = "For connections into and out of the bastion host"
|
|
||||||
}
|
|
||||||
|
|
||||||
resource vultr_firewall_rule bastion_inbound {
|
|
||||||
firewall_group_id = vultr_firewall_group.bastion.id
|
|
||||||
protocol = "tcp"
|
|
||||||
ip_type = "v4"
|
|
||||||
subnet = "0.0.0.0"
|
|
||||||
subnet_size = 0
|
|
||||||
port = 22
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
74
infra/vultr-kubernetes/git.tf
Normal file
74
infra/vultr-kubernetes/git.tf
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
# NOTE: this is a simple deployment for demo purposes only.
|
||||||
|
# Currently it does support SSH access and lacks Gitea runners.
|
||||||
|
# However a fully working setup can be found at: https://git.shockrah.xyz
|
||||||
|
resource kubernetes_deployment gitea {
|
||||||
|
metadata {
|
||||||
|
name = "gitea"
|
||||||
|
namespace = var.playground.namespace
|
||||||
|
labels = {
|
||||||
|
"app" = "gitea"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
replicas = 1
|
||||||
|
selector {
|
||||||
|
match_labels = {
|
||||||
|
"app" = "gitea"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template {
|
||||||
|
metadata {
|
||||||
|
labels = {
|
||||||
|
"app" = "gitea"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
container {
|
||||||
|
name = "gitea"
|
||||||
|
image = "gitea/gitea:latest"
|
||||||
|
port {
|
||||||
|
container_port = 3000
|
||||||
|
name = "gitea-main"
|
||||||
|
}
|
||||||
|
port {
|
||||||
|
container_port = 2222
|
||||||
|
name = "gitea-ssh"
|
||||||
|
}
|
||||||
|
volume_mount {
|
||||||
|
name = "gitea"
|
||||||
|
mount_path = "/data"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
volume {
|
||||||
|
name = "gitea"
|
||||||
|
persistent_volume_claim {
|
||||||
|
claim_name = kubernetes_persistent_volume_claim_v1.gitea.metadata[0].name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
resource kubernetes_service gitea {
|
||||||
|
metadata {
|
||||||
|
name = "gitea"
|
||||||
|
namespace = var.playground.namespace
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
selector = {
|
||||||
|
"app" = "gitea"
|
||||||
|
}
|
||||||
|
port {
|
||||||
|
target_port = "gitea-main"
|
||||||
|
port = 3000
|
||||||
|
name = "http"
|
||||||
|
}
|
||||||
|
port {
|
||||||
|
target_port = "gitea-ssh"
|
||||||
|
port = 2222
|
||||||
|
name = "ssh"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
resource kubernetes_deployment health {
|
resource kubernetes_deployment_v1 health {
|
||||||
metadata {
|
metadata {
|
||||||
name = "health"
|
name = "health"
|
||||||
namespace = var.playground.namespace
|
namespace = var.playground.namespace
|
||||||
@@ -29,7 +29,7 @@ resource kubernetes_deployment health {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource kubernetes_service health {
|
resource kubernetes_service_v1 health {
|
||||||
metadata {
|
metadata {
|
||||||
name = "health"
|
name = "health"
|
||||||
namespace = var.playground.namespace
|
namespace = var.playground.namespace
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
locals {
|
||||||
|
services = {
|
||||||
|
"code.shockrah.xyz" = kubernetes_service.gitea
|
||||||
|
"sanity.shockrah.xyz" = kubernetes_service_v1.health
|
||||||
|
"uptime.shockrah.xyz" = kubernetes_service.kuma
|
||||||
|
"wiki.shockrah.xyz" = kubernetes_service.otterwiki
|
||||||
|
}
|
||||||
|
}
|
||||||
resource kubernetes_ingress_v1 health {
|
resource kubernetes_ingress_v1 health {
|
||||||
metadata {
|
metadata {
|
||||||
name = "health-ingress"
|
name = "health-ingress"
|
||||||
@@ -9,25 +17,31 @@ resource kubernetes_ingress_v1 health {
|
|||||||
}
|
}
|
||||||
spec {
|
spec {
|
||||||
ingress_class_name = "nginx"
|
ingress_class_name = "nginx"
|
||||||
tls {
|
dynamic tls {
|
||||||
hosts = [ "sanity.shockrah.xyz" ]
|
for_each = local.services
|
||||||
secret_name = "shockrah"
|
content {
|
||||||
|
hosts = [tls.key]
|
||||||
|
secret_name = "${tls.value.metadata[0].name}-secret"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rule {
|
dynamic "rule" {
|
||||||
host = "sanity.shockrah.xyz"
|
for_each = local.services
|
||||||
|
content {
|
||||||
|
host = "${rule.key}"
|
||||||
http {
|
http {
|
||||||
path {
|
path {
|
||||||
path = "/"
|
path = "/"
|
||||||
backend {
|
backend {
|
||||||
service {
|
service {
|
||||||
name = kubernetes_service.health.metadata[0].name
|
name = rule.value.metadata[0].name
|
||||||
port {
|
port {
|
||||||
number = kubernetes_service.health.spec[0].port[0].port
|
number = rule.value.spec[0].port[0].port
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,4 +5,6 @@ resource kubernetes_namespace playground {
|
|||||||
}
|
}
|
||||||
name = var.playground.namespace
|
name = var.playground.namespace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
61
infra/vultr-kubernetes/uptime.tf
Normal file
61
infra/vultr-kubernetes/uptime.tf
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
resource kubernetes_deployment kuma {
|
||||||
|
metadata {
|
||||||
|
name = "kuma"
|
||||||
|
namespace = var.playground.namespace
|
||||||
|
labels = {
|
||||||
|
"app" = "kuma"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
replicas = 1
|
||||||
|
selector {
|
||||||
|
match_labels = {
|
||||||
|
"app" = "kuma"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template {
|
||||||
|
metadata {
|
||||||
|
labels = {
|
||||||
|
"app" = "kuma"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
container {
|
||||||
|
name = "kuma"
|
||||||
|
image = "louislam/uptime-kuma:2"
|
||||||
|
port {
|
||||||
|
container_port = 3001
|
||||||
|
name = "uptime-kuma"
|
||||||
|
}
|
||||||
|
volume_mount {
|
||||||
|
name = "kuma-data"
|
||||||
|
mount_path = "/app/data"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
volume {
|
||||||
|
name = "kuma-data"
|
||||||
|
persistent_volume_claim {
|
||||||
|
claim_name = kubernetes_persistent_volume_claim_v1.kuma.metadata[0].name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource kubernetes_service kuma {
|
||||||
|
metadata {
|
||||||
|
name = "kuma"
|
||||||
|
namespace = var.playground.namespace
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
selector = {
|
||||||
|
"app" = "kuma"
|
||||||
|
}
|
||||||
|
port {
|
||||||
|
target_port = "uptime-kuma"
|
||||||
|
port = 3001
|
||||||
|
name = "http"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,22 +40,10 @@ variable cluster {
|
|||||||
variable playground {
|
variable playground {
|
||||||
type = object({
|
type = object({
|
||||||
namespace = string
|
namespace = string
|
||||||
health = object({
|
# TODO: Re-incorporate this var for templating later
|
||||||
dns = string
|
|
||||||
})
|
|
||||||
tls = object({
|
tls = object({
|
||||||
email = string
|
email = string
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
variable bastion {
|
|
||||||
type = object({
|
|
||||||
plan = string
|
|
||||||
os = string
|
|
||||||
label = string
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
cluster = {
|
cluster = {
|
||||||
region = "lax"
|
region = "lax"
|
||||||
label = "athens-cluster"
|
label = "athens-cluster"
|
||||||
version = "v1.33.0+3"
|
version = "v1.34.1+2"
|
||||||
pools = {
|
pools = {
|
||||||
main = {
|
main = {
|
||||||
node_quantity = 1
|
node_quantity = 1
|
||||||
@@ -18,17 +18,7 @@ playground = {
|
|||||||
namespace = "playground"
|
namespace = "playground"
|
||||||
# Sanity check service that is used purely for the sake of ensuring
|
# Sanity check service that is used purely for the sake of ensuring
|
||||||
# things are ( at a basic level ) functional
|
# things are ( at a basic level ) functional
|
||||||
health = {
|
|
||||||
dns = "health"
|
|
||||||
}
|
|
||||||
tls = {
|
tls = {
|
||||||
email = "dev@shockrah.xyz"
|
email = "dev@shockrah.xyz"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bastion = {
|
|
||||||
plan = "vc2-1c-2gb"
|
|
||||||
label = "bastion"
|
|
||||||
os = "1743"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,49 @@
|
|||||||
resource kubernetes_persistent_volume_claim_v1 gitea {
|
resource kubernetes_persistent_volume_claim_v1 kuma {
|
||||||
metadata {
|
metadata {
|
||||||
name = "gitea"
|
name = "kuma-data"
|
||||||
namespace = var.playground.namespace
|
namespace = var.playground.namespace
|
||||||
}
|
}
|
||||||
spec {
|
spec {
|
||||||
access_modes = [ "ReadWriteMany"]
|
volume_mode = "Filesystem"
|
||||||
resources {
|
access_modes = [ "ReadWriteOnce"]
|
||||||
requests = {
|
resources {
|
||||||
storage = "10Gi"
|
requests = {
|
||||||
}
|
storage = "10Gi"
|
||||||
}
|
}
|
||||||
storage_class_name = "vultr-vfs-storage"
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
resource kubernetes_persistent_volume_claim_v1 gitea {
|
||||||
|
metadata {
|
||||||
|
name = "gitea-data"
|
||||||
|
namespace = var.playground.namespace
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
volume_mode = "Filesystem"
|
||||||
|
access_modes = [ "ReadWriteOnce"]
|
||||||
|
resources {
|
||||||
|
requests = {
|
||||||
|
storage = "10Gi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
resource kubernetes_persistent_volume_claim_v1 otterwiki {
|
||||||
|
metadata {
|
||||||
|
name = "otterwiki-data"
|
||||||
|
namespace = var.playground.namespace
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
volume_mode = "Filesystem"
|
||||||
|
access_modes = [ "ReadWriteOnce"]
|
||||||
|
resources {
|
||||||
|
requests = {
|
||||||
|
storage = "10Gi"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
63
infra/vultr-kubernetes/wiki.tf
Normal file
63
infra/vultr-kubernetes/wiki.tf
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
resource kubernetes_deployment otterwiki {
|
||||||
|
metadata {
|
||||||
|
name = "otterwiki"
|
||||||
|
namespace = var.playground.namespace
|
||||||
|
labels = {
|
||||||
|
"app" = "otterwiki"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
replicas = 1
|
||||||
|
selector {
|
||||||
|
match_labels = {
|
||||||
|
"app" = "otterwiki"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template {
|
||||||
|
metadata {
|
||||||
|
labels = {
|
||||||
|
"app" = "otterwiki"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
container {
|
||||||
|
name = "otterwiki"
|
||||||
|
image = "redimp/otterwiki:2"
|
||||||
|
port {
|
||||||
|
container_port = 8080
|
||||||
|
name = "otterwiki-main"
|
||||||
|
}
|
||||||
|
volume_mount {
|
||||||
|
name = "otterwiki-data"
|
||||||
|
mount_path = "/var/lib/otterwiki"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
volume {
|
||||||
|
name = "otterwiki-data"
|
||||||
|
persistent_volume_claim {
|
||||||
|
claim_name = kubernetes_persistent_volume_claim_v1.otterwiki.metadata[0].name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource kubernetes_service otterwiki {
|
||||||
|
metadata {
|
||||||
|
name = "otterwiki"
|
||||||
|
namespace = var.playground.namespace
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
selector = {
|
||||||
|
"app" = "otterwiki"
|
||||||
|
}
|
||||||
|
port {
|
||||||
|
port = 80
|
||||||
|
target_port = "otterwiki-main"
|
||||||
|
protocol = "TCP"
|
||||||
|
name = "http"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user