Skip to content

Commit

Permalink
fix: resolve minio url within k8s when using loopback cluster ip
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterPtato committed Mar 21, 2024
1 parent ec3eeb1 commit 843a3c7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/bolt/core/src/context/project.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{
collections::HashMap,
net::Ipv4Addr,
path::{Path, PathBuf},
process::Command,
sync::{Arc, Weak},
Expand Down Expand Up @@ -694,7 +695,17 @@ impl ProjectContextData {
..
} = &self.ns().cluster.kind
{
format!("http://{public_ip}:{minio_port}")
let is_loopback = public_ip
.parse::<Ipv4Addr>()
.ok()
.map(|ip| ip.is_loopback())
.unwrap_or_default();

if is_loopback {
format!("http://minio.minio.svc.cluster.local:{minio_port}")
} else {
format!("http://{public_ip}:{minio_port}")
}
} else {
unreachable!()
}
Expand Down

0 comments on commit 843a3c7

Please sign in to comment.