2024-07-16 19:13:04 +00:00
|
|
|
resource "kubernetes_secret" "digitalocean-token" {
|
|
|
|
metadata {
|
|
|
|
name = "digitalocean-token"
|
|
|
|
namespace = kubernetes_namespace.tjo-cloud.metadata[0].name
|
|
|
|
}
|
|
|
|
data = {
|
|
|
|
token = var.digitalocean_token
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "kubernetes_manifest" "tjo-cloud-issuer" {
|
|
|
|
manifest = {
|
|
|
|
apiVersion = "cert-manager.io/v1"
|
|
|
|
kind = "Issuer"
|
|
|
|
metadata = {
|
|
|
|
name = "tjo-cloud"
|
|
|
|
namespace = kubernetes_namespace.tjo-cloud.metadata[0].name
|
|
|
|
}
|
|
|
|
spec = {
|
|
|
|
acme = {
|
|
|
|
email = "tine@tjo.space"
|
|
|
|
server = "https://acme-staging-v02.api.letsencrypt.org/directory"
|
|
|
|
privateKeySecretRef = {
|
|
|
|
name = "tjo-cloud-acme-account"
|
|
|
|
}
|
|
|
|
solvers = [
|
|
|
|
{
|
|
|
|
dns01 = {
|
|
|
|
digitalocean = {
|
|
|
|
tokenSecretRef = {
|
|
|
|
name = kubernetes_secret.digitalocean-token.metadata[0].name
|
|
|
|
key = "token"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-23 18:42:22 +00:00
|
|
|
resource "kubernetes_manifest" "gateway_class_config" {
|
|
|
|
manifest = {
|
|
|
|
apiVersion = "gateway.envoyproxy.io/v1alpha1"
|
|
|
|
kind = "EnvoyProxy"
|
|
|
|
metadata = {
|
|
|
|
name = "daemonset"
|
|
|
|
namespace = kubernetes_namespace.tjo-cloud.metadata[0].name
|
|
|
|
}
|
|
|
|
spec = {
|
|
|
|
provider = {
|
|
|
|
type = "Kubernetes"
|
|
|
|
kubernetes = {
|
|
|
|
envoyDaemonSet = {
|
|
|
|
patch : {
|
|
|
|
type : "StrategicMerge"
|
|
|
|
value : {
|
|
|
|
spec : {
|
|
|
|
template : {
|
|
|
|
spec : {
|
|
|
|
hostNetwork : true
|
|
|
|
dnsPolicy : "ClusterFirstWithHostNet"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pod = {
|
|
|
|
nodeSelector = {
|
|
|
|
"node-role.kubernetes.io/control-plane" = ""
|
|
|
|
}
|
|
|
|
tolerations = [
|
|
|
|
{
|
|
|
|
key = "node-role.kubernetes.io/control-plane"
|
|
|
|
effect = "NoSchedule"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-19 20:48:07 +00:00
|
|
|
resource "kubernetes_manifest" "gateway_class" {
|
2024-07-16 19:13:04 +00:00
|
|
|
manifest = {
|
|
|
|
apiVersion = "gateway.networking.k8s.io/v1"
|
|
|
|
kind = "GatewayClass"
|
|
|
|
metadata = {
|
|
|
|
name = "envoy"
|
|
|
|
}
|
|
|
|
spec = {
|
|
|
|
controllerName : "gateway.envoyproxy.io/gatewayclass-controller"
|
2024-07-23 18:42:22 +00:00
|
|
|
parametersRef : {
|
|
|
|
group : "gateway.envoyproxy.io"
|
|
|
|
kind : "EnvoyProxy"
|
|
|
|
name : kubernetes_manifest.gateway_class_config.object.metadata.name
|
|
|
|
namespace : kubernetes_manifest.gateway_class_config.object.metadata.namespace
|
|
|
|
}
|
2024-07-16 19:13:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "kubernetes_manifest" "gateway" {
|
|
|
|
manifest = {
|
|
|
|
apiVersion = "gateway.networking.k8s.io/v1"
|
|
|
|
kind = "Gateway"
|
|
|
|
metadata = {
|
|
|
|
name = "gateway"
|
|
|
|
namespace = kubernetes_namespace.tjo-cloud.metadata[0].name
|
|
|
|
annotations = {
|
|
|
|
"cert-manager.io/issuer" : "tjo-cloud"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
spec = {
|
2024-07-19 20:48:07 +00:00
|
|
|
gatewayClassName = kubernetes_manifest.gateway_class.object.metadata.name
|
2024-07-16 19:13:04 +00:00
|
|
|
listeners = [
|
|
|
|
{
|
|
|
|
name : "http"
|
2024-07-20 11:09:30 +00:00
|
|
|
hostname : "*.${var.cluster_name}.${var.cluster_domain}"
|
2024-07-16 19:13:04 +00:00
|
|
|
protocol : "HTTPS"
|
|
|
|
port : 443
|
|
|
|
allowedRoutes : {
|
|
|
|
namespaces : {
|
|
|
|
from : "Same"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tls : {
|
|
|
|
mode : "Terminate"
|
|
|
|
certificateRefs : [
|
|
|
|
{
|
|
|
|
name : "tjo-cloud-tls"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|