message: Fix in-cluster kube_host_port generation for IPv6
diff: @@ -60,8 +60,13 @@ pub fn kube_dns() -> http::Uri {
  fn kube_host_port() -> Option<String> {
  let host = kube_host()?;
  let port = kube_port()?;
  + if host.contains(":") {
  + // IPv6 cluster
  + Some(format!("https://[{}]:{}", host, port))
  + } else {
  Some(format!("https://{}:{}", host, port))
  }
  +}
  fn kube_host() -> Option<String> {
  env::var(SERVICE_HOSTENV).ok()
  @@ -109,3 +114,15 @@ fn test_kube_server() {
  env::set_var(SERVICE_PORTENV, port);
  assert_eq!(kube_server().unwrap(), "https://fake.io:8080");
  }
  +
  +#[test]
  +fn test_kube_server_ipv6() {
  + let host = "2001:0db8:85a3:0000:0000:8a2e:0370:7334";
  + let port = "8080";
  + env::set_var(SERVICE_HOSTENV, host);
  + env::set_var(SERVICE_PORTENV, port);
  + assert_eq!(
  + kube_server().unwrap(),
  + "https://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:8080"
  + );
  +}
  