Updated map ids in Kubernetes
World service will create logic instance with a log level that can be adjusted at runtime
This commit is contained in:
@@ -91,6 +91,10 @@ services:
|
||||
env:
|
||||
SERVICE_PORT: 50054
|
||||
LOG_LEVEL: "debug"
|
||||
LOGIC_LOG_LEVEL: "debug"
|
||||
# MAP_IDS: "1,2,3,4,5,6,8,9,10,11,15,16,17,18,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,40,42,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,70,71,72,73,74,75,76,77,78,79,80"
|
||||
MAP_IDS: "1,2,3,4,5,6,8,9,10,11,15,16,17,18,20"
|
||||
WORLD_SERVICE_NAME: "Athena"
|
||||
service:
|
||||
annotations:
|
||||
name: "Athena"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use std::env;
|
||||
use kube::{
|
||||
api::{Api, PostParams, DeleteParams},
|
||||
Client,
|
||||
@@ -21,6 +22,10 @@ pub struct K8sOrchestrator {
|
||||
namespace: String,
|
||||
}
|
||||
|
||||
fn get_log_level() -> String {
|
||||
env::var("LOGIC_LOG_LEVEL").unwrap_or_else(|_| env::var("LOG_LEVEL").unwrap_or_else(|_| "info".to_string()))
|
||||
}
|
||||
|
||||
impl K8sOrchestrator {
|
||||
/// Creates a new orchestrator for the given namespace.
|
||||
pub async fn new(namespace: &str) -> Result<Self, Box<dyn Error>> {
|
||||
@@ -61,10 +66,16 @@ impl K8sOrchestrator {
|
||||
"containerPort": 50056,
|
||||
"name": "grpc"
|
||||
}],
|
||||
"env": [{
|
||||
"name": "MAP_ID",
|
||||
"value": map_id_str
|
||||
}],
|
||||
"env": [
|
||||
{
|
||||
"name": "MAP_ID",
|
||||
"value": map_id_str
|
||||
},
|
||||
{
|
||||
"name": "LOG_LEVEL",
|
||||
"value": get_log_level()
|
||||
}
|
||||
],
|
||||
"volumeMounts": [{
|
||||
"name": "game-data",
|
||||
"mountPath": "/opt/data",
|
||||
|
||||
@@ -49,7 +49,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
Err(e) => {
|
||||
if e.to_string().contains("AlreadyExists") {
|
||||
info!("Game-logic instance already exists: {}", e);
|
||||
warn!("Game-logic instance already exists: {}", e);
|
||||
// No reason to return an error here.
|
||||
//TODO: We may want to check to make sure the pod is working correctly.
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user