diff --git a/src/ocp_postprocess/cluster_domain_rename/etcd_rename.rs b/src/ocp_postprocess/cluster_domain_rename/etcd_rename.rs index b7e71894..640b5b4f 100644 --- a/src/ocp_postprocess/cluster_domain_rename/etcd_rename.rs +++ b/src/ocp_postprocess/cluster_domain_rename/etcd_rename.rs @@ -461,23 +461,25 @@ pub(crate) async fn fix_console_config(etcd_client: &Arc, clust pub(crate) async fn fix_console_public_config(etcd_client: &Arc, cluster_domain: &str) -> Result<()> { let k8s_resource_location = K8sResourceLocation::new(Some("openshift-config-managed"), "Configmap", "console-public", "v1"); - let mut configmap = get_etcd_json(etcd_client, &k8s_resource_location) - .await? - .context("could not find console-public")?; - let data = &mut configmap.pointer_mut("/data"); - if let Some(data) = data { - let data = data.as_object_mut().context("data not an object")?; + // Some clusters have console disabled, and the entire configmap is missing, not just the + // consoleURL key + if let Some(mut configmap) = get_etcd_json(etcd_client, &k8s_resource_location).await? { + let data = &mut configmap.pointer_mut("/data"); - // Some clusters have console disabled, so there's nothing to replace - if data.contains_key("consoleURL") { - data.insert( - "consoleURL".to_string(), - serde_json::Value::String(format!("https://console-openshift-console.apps.{cluster_domain}")), - ) - .context("could not find original consoleURL")?; + if let Some(data) = data { + let data = data.as_object_mut().context("data not an object")?; - put_etcd_yaml(etcd_client, &k8s_resource_location, configmap).await?; + // Some clusters have console disabled, so there's nothing to replace + if data.contains_key("consoleURL") { + data.insert( + "consoleURL".to_string(), + serde_json::Value::String(format!("https://console-openshift-console.apps.{cluster_domain}")), + ) + .context("could not find original consoleURL")?; + + put_etcd_yaml(etcd_client, &k8s_resource_location, configmap).await?; + } } } @@ -489,20 +491,21 @@ pub(crate) async fn fix_console_cluster_config(etcd_client: &Arc