fix check to ensure prometheus operator is installed

This commit is contained in:
Ian Letourneau 2025-08-02 11:10:20 -04:00
parent 056152a1e5
commit 9403581be5

View File

@ -271,11 +271,11 @@ impl K8sAnywhereTopology {
&self, &self,
sender: &CRDPrometheus, sender: &CRDPrometheus,
) -> Result<Outcome, InterpretError> { ) -> Result<Outcome, InterpretError> {
let output = Command::new("sh") let status = Command::new("sh")
.args(["-c", "kubectl get crd -A | grep -i prometheuses"]) .args(["-c", "kubectl get crd -A | grep -i prometheuses"])
.output() .status()
.map_err(|e| InterpretError::new(format!("could not connect to cluster: {}", e)))?; .map_err(|e| InterpretError::new(format!("could not connect to cluster: {}", e)))?;
if output.status.success() && output.stdout.is_empty() { if !status.success() {
if let Some(Some(k8s_state)) = self.k8s_state.get() { if let Some(Some(k8s_state)) = self.k8s_state.get() {
match k8s_state.source { match k8s_state.source {
K8sSource::LocalK3d => { K8sSource::LocalK3d => {
@ -300,7 +300,9 @@ impl K8sAnywhereTopology {
return Ok(Outcome::noop()); return Ok(Outcome::noop());
} }
} }
debug!("Prometheus operator is already present, skipping install"); debug!("Prometheus operator is already present, skipping install");
Ok(Outcome::success( Ok(Outcome::success(
"prometheus operator present in cluster".to_string(), "prometheus operator present in cluster".to_string(),
)) ))