Compare commits
	
		
			No commits in common. "ee23406f494100231008a9b8fca3151a71f509f1" and "f5f670e5f2fe2ee6b41c3387fda131d1526e4d0d" have entirely different histories.
		
	
	
		
			ee23406f49
			...
			f5f670e5f2
		
	
		
@ -1,58 +0,0 @@
 | 
				
			|||||||
resource kubernetes_namespace admin-servers {
 | 
					 | 
				
			||||||
    metadata {
 | 
					 | 
				
			||||||
        name = var.admin_services.namespace
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
resource kubernetes_pod admin {
 | 
					 | 
				
			||||||
    for_each = var.admin_services.configs
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    metadata {
 | 
					 | 
				
			||||||
        name = each.key
 | 
					 | 
				
			||||||
        namespace = var.admin_services.namespace
 | 
					 | 
				
			||||||
        labels = {
 | 
					 | 
				
			||||||
            app = each.key
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    spec {
 | 
					 | 
				
			||||||
        container {
 | 
					 | 
				
			||||||
            image = each.value.image
 | 
					 | 
				
			||||||
            name  = coalesce(each.value.name, each.key)
 | 
					 | 
				
			||||||
            resources {
 | 
					 | 
				
			||||||
                limits = {
 | 
					 | 
				
			||||||
                    cpu    = each.value.cpu
 | 
					 | 
				
			||||||
                    memory = each.value.mem
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            port {
 | 
					 | 
				
			||||||
                container_port = each.value.port.internal
 | 
					 | 
				
			||||||
                protocol       = coalesce(each.value.proto, "TCP")
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
resource kubernetes_service admin {
 | 
					 | 
				
			||||||
    for_each = var.admin_services.configs
 | 
					 | 
				
			||||||
    metadata {
 | 
					 | 
				
			||||||
        name = each.key
 | 
					 | 
				
			||||||
        namespace = var.admin_services.namespace
 | 
					 | 
				
			||||||
        labels = {
 | 
					 | 
				
			||||||
            app = each.key
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    # TODO: don't make these NodePorts since we're gonna want them
 | 
					 | 
				
			||||||
    # to be purely internal to the Cluster.
 | 
					 | 
				
			||||||
    # WHY? Because we want to keep dashboards as unexposed as possible
 | 
					 | 
				
			||||||
    spec {
 | 
					 | 
				
			||||||
        selector = {
 | 
					 | 
				
			||||||
            app = each.key
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        port {
 | 
					 | 
				
			||||||
            target_port        = each.value.port.internal
 | 
					 | 
				
			||||||
            port               = each.value.port.expose
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        type = "NodePort"
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -17,16 +17,3 @@ resource vultr_firewall_rule game-server-inbound {
 | 
				
			|||||||
  subnet_size = 0
 | 
					  subnet_size = 0
 | 
				
			||||||
  port = each.value.port.expose
 | 
					  port = each.value.port.expose
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
resource vultr_firewall_rule admin-service-inbound {
 | 
					 | 
				
			||||||
  for_each = var.admin_services.configs
 | 
					 | 
				
			||||||
  firewall_group_id = vultr_kubernetes.athens.firewall_group_id
 | 
					 | 
				
			||||||
  protocol = "tcp"
 | 
					 | 
				
			||||||
  ip_type = "v4"
 | 
					 | 
				
			||||||
  subnet = "0.0.0.0"
 | 
					 | 
				
			||||||
  subnet_size = 0
 | 
					 | 
				
			||||||
  notes = each.value.port.notes
 | 
					 | 
				
			||||||
  port = each.value.port.expose
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -52,21 +52,3 @@ variable game_servers {
 | 
				
			|||||||
  })
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
variable admin_services {
 | 
					 | 
				
			||||||
  type = object({
 | 
					 | 
				
			||||||
    namespace = string
 | 
					 | 
				
			||||||
    configs = map(object({
 | 
					 | 
				
			||||||
      name  = string
 | 
					 | 
				
			||||||
      image = string
 | 
					 | 
				
			||||||
      cpu   = string
 | 
					 | 
				
			||||||
      mem   = string
 | 
					 | 
				
			||||||
      port  = object({
 | 
					 | 
				
			||||||
        notes = optional(string)
 | 
					 | 
				
			||||||
        internal = number
 | 
					 | 
				
			||||||
        expose   = number
 | 
					 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
      proto = optional(string)
 | 
					 | 
				
			||||||
    }))
 | 
					 | 
				
			||||||
  })
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -23,21 +23,4 @@ game_servers = {
 | 
				
			|||||||
    #   }
 | 
					    #   }
 | 
				
			||||||
    # }
 | 
					    # }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
admin_services = {
 | 
					 | 
				
			||||||
  namespace = "admin-services"
 | 
					 | 
				
			||||||
  configs = {
 | 
					 | 
				
			||||||
    health = {
 | 
					 | 
				
			||||||
      image = "nginx:latest"
 | 
					 | 
				
			||||||
      name  = "health"
 | 
					 | 
				
			||||||
      cpu   = "200m"
 | 
					 | 
				
			||||||
      mem   = "64Mi"
 | 
					 | 
				
			||||||
      port  = {
 | 
					 | 
				
			||||||
        notes    = "Basic nginx sanity check service"
 | 
					 | 
				
			||||||
        expose   = 30800
 | 
					 | 
				
			||||||
        internal = 80
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user