chore: add constant for lables used in kubernetes
This commit is contained in:
parent
bb60a21050
commit
8a7c3f5203
1 changed files with 6 additions and 4 deletions
|
|
@ -18,6 +18,8 @@ use crate::{
|
||||||
packets::{clientbound::status::StatusTrait, SendPacket},
|
packets::{clientbound::status::StatusTrait, SendPacket},
|
||||||
OpaqueError,
|
OpaqueError,
|
||||||
};
|
};
|
||||||
|
const MAIN_LABEL: &str = "tami.moe/minecraft";
|
||||||
|
const PORT_LABEL: &str = "tami.moe/minecraft-port";
|
||||||
|
|
||||||
/// This is the layer who is respinsible for caching requests.
|
/// This is the layer who is respinsible for caching requests.
|
||||||
///
|
///
|
||||||
|
|
@ -57,12 +59,12 @@ impl KubeCache {
|
||||||
}
|
}
|
||||||
async fn get_deploys(&self) -> ObjectList<Deployment> {
|
async fn get_deploys(&self) -> ObjectList<Deployment> {
|
||||||
// let lp: ListParams = ListParams::default();
|
// let lp: ListParams = ListParams::default();
|
||||||
let lp: ListParams = ListParams::default().labels("tami.moe/minecraft");
|
let lp: ListParams = ListParams::default().labels(MAIN_LABEL);
|
||||||
self.deployments.list(&lp).await.unwrap()
|
self.deployments.list(&lp).await.unwrap()
|
||||||
}
|
}
|
||||||
async fn get_srvs(&self) -> ObjectList<Service> {
|
async fn get_srvs(&self) -> ObjectList<Service> {
|
||||||
// let lp: ListParams = ListParams::default();
|
// let lp: ListParams = ListParams::default();
|
||||||
let lp: ListParams = ListParams::default().labels("tami.moe/minecraft");
|
let lp: ListParams = ListParams::default().labels(MAIN_LABEL);
|
||||||
self.services.list(&lp).await.unwrap()
|
self.services.list(&lp).await.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -453,8 +455,8 @@ where
|
||||||
res.labels()
|
res.labels()
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|(key, value)| match key.as_str() {
|
.filter(|(key, value)| match key.as_str() {
|
||||||
"tami.moe/minecraft" => value.as_str() == addr,
|
MAIN_LABEL => value.as_str() == addr,
|
||||||
"tami.moe/minecraft-port" => {
|
PORT_LABEL => {
|
||||||
found_port = true;
|
found_port = true;
|
||||||
value.as_str() == port
|
value.as_str() == port
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue