Skip to content

Commit ddf1d3e

Browse files
committed
Update with Environnement
1 parent 120e8d6 commit ddf1d3e

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/epsilon/server/instance_provider.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::k8s::label::Label;
22
use crate::{EResult, Kube};
3+
use std::env;
34

45
use crate::epsilon::epsilon_error::EpsilonError;
56
use crate::epsilon::server::instance::{Instance, InstanceJson};
@@ -87,7 +88,8 @@ impl InstanceProvider {
8788

8889
pub async fn get_template_host(&self, route: &str) -> String {
8990
format!(
90-
"http://epsilon-template.epsilon.svc.cluster.local:8000/{}",
91+
"http://{}:8000/{}",
92+
env::var("HOST_TEMPLATE").unwrap(),
9193
route
9294
)
9395
}

src/k8s/kube.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::k8s::label::Label;
2+
use std::env;
23

34
use k8s_openapi::api::core::v1::Pod;
45
use k8s_openapi::apimachinery::pkg::version::Info;
@@ -74,8 +75,13 @@ impl Kube {
7475
"restartPolicy": "Never",
7576
"containers": [{
7677
"name": "main",
77-
"image": format!("{}/{}", "docker-registry.epsilon.svc.cluster.local:30000", template),
78+
"image": format!("{}/{}", env::var("HOST_REGISTRY").unwrap(), template),
7879
"imagePullPolicy": "Always",
80+
"envFrom": [{
81+
"configMapRef": {
82+
"name": "epsilon-configuration"
83+
}
84+
}],
7985
"ports": [
8086
{
8187
"containerPort": port,

src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::tasks::task_builder::TaskBuilder;
1515
use env_logger::fmt::Color;
1616
use k8s_openapi::chrono::Local;
1717
use log::{Level, LevelFilter};
18+
use std::env;
1819
use std::io::Write;
1920
use std::sync::Arc;
2021

@@ -72,7 +73,11 @@ async fn main() -> EResult<()> {
7273

7374
println!("{}", epsilon.replace("{}", env!("CARGO_PKG_VERSION")));
7475

75-
let kube = Kube::new("epsilon").await;
76+
let namespace = env::var("KUBE_NAMESPACE").unwrap();
77+
78+
info!("Kube listen in namespace: {}", namespace);
79+
80+
let kube = Kube::new(&namespace).await;
7681

7782
info!(
7883
"Kube client has been started (Namespace={}, Version={})",

0 commit comments

Comments
 (0)