use std::io::Error as IoError;
use fluvio::FluvioError;
use k8_config::{ConfigError as K8ConfigError};
use k8_client::{ClientError as K8ClientError};
use fluvio_helm::HelmError;
use crate::check::{CheckResults, CheckStatuses};
use fluvio_command::CommandError;
#[derive(thiserror::Error, Debug)]
pub enum ClusterError {
#[error("Failed to install Fluvio on Kubernetes")]
InstallK8(#[from] K8InstallError),
#[error("Failed to install Fluvio locally")]
InstallLocal(#[from] LocalInstallError),
#[error("Failed to install Fluvio system charts")]
InstallSys(#[from] SysInstallError),
#[error("Failed to uninstall Fluvio")]
Uninstall(#[from] UninstallError),
}
#[derive(thiserror::Error, Debug)]
pub enum SysInstallError {
#[error("Helm client error")]
HelmError(#[from] HelmError),
#[error("Missing required config option {0}")]
MissingRequiredConfig(String),
}
#[derive(thiserror::Error, Debug)]
pub enum K8InstallError {
#[error(transparent)]
IoError(#[from] IoError),
#[error("Fluvio client error")]
FluvioError(#[from] FluvioError),
#[error("Kubernetes config error")]
K8ConfigError(#[from] K8ConfigError),
#[error("Kubernetes client error")]
K8ClientError(#[from] K8ClientError),
#[error("Helm client error")]
HelmError(#[from] HelmError),
#[error(transparent)]
CommandError(#[from] CommandError),
#[error("Pre-checks failed during cluster startup")]
FailedPrecheck(CheckStatuses),
#[error("Failed to perform one or more pre-checks")]
PrecheckErrored(CheckResults),
#[error("Expected to find cluster with platform version {0}")]
FailedPlatformVersion(String),
#[error("Timed out when waiting for SC service")]
SCServiceTimeout,
#[error("Timed out when waiting for SC port check")]
SCPortCheckTimeout,
#[error("Timed out when waiting for DNS resolution")]
SCDNSTimeout,
#[error("Timed out when waiting for SPU")]
SPUTimeout,
#[error("Unable to detect Fluvio SC K8 service")]
UnableToDetectService,
#[error("Unable to find chart in Helm: {0}")]
HelmChartNotFound(String),
#[error("Missing required config option {0}")]
MissingRequiredConfig(String),
#[error("An unknown error occurred: {0}")]
Other(String),
}
#[derive(thiserror::Error, Debug)]
pub enum LocalInstallError {
#[error(transparent)]
IoError(#[from] IoError),
#[error("Fluvio client error")]
FluvioError(#[from] FluvioError),
#[error("Kubernetes config error")]
K8ConfigError(#[from] K8ConfigError),
#[error("Kubernetes client error")]
K8ClientError(#[from] K8ClientError),
#[error("Helm client error")]
HelmError(#[from] HelmError),
#[error(transparent)]
CommandError(#[from] CommandError),
#[error("Pre-checks failed during cluster startup")]
FailedPrecheck(CheckStatuses),
#[error("Failed to perform one or more pre-checks")]
PrecheckErrored(CheckResults),
#[error("Timed out when waiting for SC service")]
SCServiceTimeout,
#[error("Timed out when waiting for SC port check")]
SCPortCheckTimeout,
#[error("Timed out when waiting for DNS resolution")]
SCDNSTimeout,
#[error("Timed out when waiting for SPU")]
SPUTimeout,
#[error("Unable to detect Fluvio SC K8 service")]
UnableToDetectService,
#[error("Unable to find chart in Helm: {0}")]
HelmChartNotFound(String),
#[error("Missing required config option {0}")]
MissingRequiredConfig(String),
#[error("An unknown error occurred: {0}")]
Other(String),
}
#[derive(thiserror::Error, Debug)]
pub enum UninstallError {
#[error(transparent)]
IoError(#[from] IoError),
#[error("Fluvio client error")]
FluvioError(#[from] FluvioError),
#[error("Kubernetes config error")]
K8ConfigError(#[from] K8ConfigError),
#[error("Kubernetes client error")]
K8ClientError(#[from] K8ClientError),
#[error("Helm client error")]
HelmError(#[from] HelmError),
#[error("Timed out when waiting for SC service")]
SCServiceTimeout,
#[error("Timed out when waiting for SC port check")]
SCPortCheckTimeout,
#[error("Timed out when waiting for DNS resolution")]
SCDNSTimeout,
#[error("Timed out when waiting for SPU")]
SPUTimeout,
#[error("Unable to detect Fluvio SC K8 service")]
UnableToDetectService,
#[error("Unable to find chart in Helm: {0}")]
HelmChartNotFound(String),
#[error("An unknown error occurred: {0}")]
Other(String),
}