reset
This commit is contained in:
parent
45b10fdf25
commit
9d40b8c64c
@ -104,12 +104,7 @@ impl HelmChartInterpret {
|
|||||||
|
|
||||||
fn run_helm_command(args: &[&str]) -> Result<Output, InterpretError> {
|
fn run_helm_command(args: &[&str]) -> Result<Output, InterpretError> {
|
||||||
let command_str = format!("helm {}", args.join(" "));
|
let command_str = format!("helm {}", args.join(" "));
|
||||||
<<<<<<< HEAD
|
|
||||||
||||||| parent of 54062fa (make separate modules)
|
|
||||||
impl HelmChartInterpret {}
|
|
||||||
=======
|
|
||||||
debug!("Got KUBECONFIG: `{}`", std::env::var("KUBECONFIG").unwrap());
|
debug!("Got KUBECONFIG: `{}`", std::env::var("KUBECONFIG").unwrap());
|
||||||
>>>>>>> 54062fa (make separate modules)
|
|
||||||
debug!("Running Helm command: `{}`", command_str);
|
debug!("Running Helm command: `{}`", command_str);
|
||||||
|
|
||||||
let output = Command::new("helm")
|
let output = Command::new("helm")
|
||||||
@ -165,14 +160,6 @@ impl<T: Topology + HelmCommand> Interpret<T> for HelmChartInterpret {
|
|||||||
|
|
||||||
self.add_repo()?;
|
self.add_repo()?;
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
let helm_executor = DefaultHelmExecutor::new();
|
|
||||||
||||||| parent of 54062fa (make separate modules)
|
|
||||||
// let mut helm_options = Vec::new();
|
|
||||||
// if self.score.create_namespace {
|
|
||||||
// helm_options.push(NonBlankString::from_str("--create-namespace").unwrap());
|
|
||||||
// }
|
|
||||||
=======
|
|
||||||
let helm_executor = DefaultHelmExecutor::new_with_opts(
|
let helm_executor = DefaultHelmExecutor::new_with_opts(
|
||||||
&NonBlankString::from_str("helm").unwrap(),
|
&NonBlankString::from_str("helm").unwrap(),
|
||||||
None,
|
None,
|
||||||
@ -180,62 +167,11 @@ impl<T: Topology + HelmCommand> Interpret<T> for HelmChartInterpret {
|
|||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
>>>>>>> 54062fa (make separate modules)
|
|
||||||
|
|
||||||
let mut helm_options = Vec::new();
|
let mut helm_options = Vec::new();
|
||||||
if self.score.create_namespace {
|
if self.score.create_namespace {
|
||||||
helm_options.push(NonBlankString::from_str("--create-namespace").unwrap());
|
helm_options.push(NonBlankString::from_str("--create-namespace").unwrap());
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
if self.score.install_only {
|
|
||||||
let chart_list = match helm_executor.list(Some(ns)) {
|
|
||||||
Ok(charts) => charts,
|
|
||||||
Err(e) => {
|
|
||||||
return Err(InterpretError::new(format!(
|
|
||||||
"Failed to list scores in namespace {:?} because of error : {}",
|
|
||||||
self.score.namespace, e
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if chart_list
|
|
||||||
.iter()
|
|
||||||
.any(|item| item.name == self.score.release_name.to_string())
|
|
||||||
{
|
|
||||||
info!(
|
|
||||||
"Release '{}' already exists in namespace '{}'. Skipping installation as install_only is true.",
|
|
||||||
self.score.release_name, ns
|
|
||||||
);
|
|
||||||
|
|
||||||
return Ok(Outcome::new(
|
|
||||||
InterpretStatus::SUCCESS,
|
|
||||||
format!(
|
|
||||||
"Helm Chart '{}' already installed to namespace {ns} and install_only=true",
|
|
||||||
self.score.release_name
|
|
||||||
),
|
|
||||||
));
|
|
||||||
} else {
|
|
||||||
info!(
|
|
||||||
"Release '{}' not found in namespace '{}'. Proceeding with installation.",
|
|
||||||
self.score.release_name, ns
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let res = helm_executor.install_or_upgrade(
|
|
||||||
&ns,
|
|
||||||
&self.score.release_name,
|
|
||||||
&self.score.chart_name,
|
|
||||||
self.score.chart_version.as_ref(),
|
|
||||||
self.score.values_overrides.as_ref(),
|
|
||||||
yaml_path,
|
|
||||||
Some(&helm_options),
|
|
||||||
);
|
|
||||||
||||||| parent of 54062fa (make separate modules)
|
|
||||||
let res = helm_executor.generate();
|
|
||||||
=======
|
|
||||||
>>>>>>> 54062fa (make separate modules)
|
|
||||||
|
|
||||||
if self.score.install_only {
|
if self.score.install_only {
|
||||||
let chart_list = match helm_executor.list(Some(ns)) {
|
let chart_list = match helm_executor.list(Some(ns)) {
|
||||||
|
|||||||
@ -135,8 +135,6 @@ impl<T: Topology + K8sclient + HelmCommand> Interpret<T> for LAMPInterpret {
|
|||||||
|
|
||||||
info!("LAMP deployment_score {deployment_score:?}");
|
info!("LAMP deployment_score {deployment_score:?}");
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
let lamp_ingress = K8sIngressScore {
|
let lamp_ingress = K8sIngressScore {
|
||||||
name: fqdn!("lamp-ingress"),
|
name: fqdn!("lamp-ingress"),
|
||||||
host: fqdn!("test"),
|
host: fqdn!("test"),
|
||||||
@ -160,36 +158,6 @@ impl<T: Topology + K8sclient + HelmCommand> Interpret<T> for LAMPInterpret {
|
|||||||
|
|
||||||
info!("LAMP lamp_ingress {lamp_ingress:?}");
|
info!("LAMP lamp_ingress {lamp_ingress:?}");
|
||||||
|
|
||||||
||||||| parent of f7f32d4 (Still WIP but pretty much done)
|
|
||||||
Ok(Outcome::success("Successfully deployed LAMP Stack!".to_string()))
|
|
||||||
=======
|
|
||||||
>>>>>>> f7f32d4 (Still WIP but pretty much done)
|
|
||||||
||||||| parent of ad7ca39 (reset)
|
|
||||||
=======
|
|
||||||
let lamp_ingress = K8sIngressScore {
|
|
||||||
name: fqdn!("lamp-ingress"),
|
|
||||||
host: fqdn!("test"),
|
|
||||||
backend_service: fqdn!(
|
|
||||||
<LAMPScore as Score<T>>::name(&self.score)
|
|
||||||
.to_case(Case::Kebab)
|
|
||||||
.as_str()
|
|
||||||
),
|
|
||||||
port: 8080,
|
|
||||||
path: Some(ingress_path!("/")),
|
|
||||||
path_type: None,
|
|
||||||
namespace: self
|
|
||||||
.get_namespace()
|
|
||||||
.map(|nbs| fqdn!(nbs.to_string().as_str())),
|
|
||||||
};
|
|
||||||
|
|
||||||
lamp_ingress
|
|
||||||
.create_interpret()
|
|
||||||
.execute(inventory, topology)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
info!("LAMP lamp_ingress {lamp_ingress:?}");
|
|
||||||
|
|
||||||
>>>>>>> ad7ca39 (reset)
|
|
||||||
Ok(Outcome::success(
|
Ok(Outcome::success(
|
||||||
"Successfully deployed LAMP Stack!".to_string(),
|
"Successfully deployed LAMP Stack!".to_string(),
|
||||||
))
|
))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user