message: Changes for following issue:
  pre_install_check fails when running from inside K8 Pod
diff: @@ -2,6 +2,7 @@ use std::process::Command;
  use std::io::Error as IoError;
  use semver::Version;
  use k8_client::K8Config;
  +use k8_config::KubeContext;
  use std::io::ErrorKind;
  use std::net::{IpAddr};
  use std::str::FromStr;
  @@ -9,23 +10,7 @@ use url::{Url};
  use super::*;
  -fn get_cluster_server_host() -> Result<String, IoError> {
  - let k8_config = K8Config::load().map_err(|err| {
  - IoError::new(
  - ErrorKind::Other,
  - format!("unable to load kube context {}", err),
  - )
  - })?;
  - let kc_config = match k8_config {
  - K8Config::Pod(_) => {
  - return Err(IoError::new(
  - ErrorKind::Other,
  - "Pod config is not valid here",
  - ))
  - }
  - K8Config::KubeConfig(config) => config,
  - };
  -
  +fn get_cluster_server_host(kc_config: KubeContext) -> Result<String, IoError> {
  if let Some(ctx) = kc_config.config.current_cluster() {
  let server_url = ctx.cluster.server.to_owned();
  let url = match Url::parse(&server_url) {
  @@ -90,7 +75,18 @@ fn pre_install_check() -> Result<(), CliError> {
  )));
  }
  - let server_host = match get_cluster_server_host() {
  + let k8_config = K8Config::load().map_err(|err| {
  + IoError::new(
  + ErrorKind::Other,
  + format!("unable to load kube context {}", err),
  + )
  + })?;
  + match k8_config {
  + K8Config::Pod(_) => {
  + // ignore server check for pod
  + }
  + K8Config::KubeConfig(config) => {
  + let server_host = match get_cluster_server_host(config) {
  Ok(server) => server,
  Err(e) => {
  return Err(CliError::Other(format!(
  @@ -99,7 +95,6 @@ fn pre_install_check() -> Result<(), CliError> {
  )))
  }
  };
  -
  if !server_host.trim().is_empty() {
  match IpAddr::from_str(&server_host) {
  Ok(_) => {
  @@ -116,6 +111,8 @@ fn pre_install_check() -> Result<(), CliError> {
  "Cluster in kubectl context cannot have empty hostname".to_owned(),
  ));
  }
  + }
  + };
  Ok(())
  }
  