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:
@@ -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