From bb71672bca724c50edf3fdfa2f5b324635c2e7c3 Mon Sep 17 00:00:00 2001 From: Omer Tuchfeld Date: Thu, 18 Apr 2024 02:19:20 +0200 Subject: [PATCH] Support proxy change in clusters without storage We had a too strict condition, see diff comment Prevents the follow error: ``` Caused by: 0: performing ocp specific post-processing 1: renaming proxy 2: renaming all 3: renaming etcd resources 4: fixing storages 5: no "/kubernetes.io/operator.openshift.io/storages/cluster" : exit status 1 ``` --- src/ocp_postprocess/proxy_rename/etcd_rename.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ocp_postprocess/proxy_rename/etcd_rename.rs b/src/ocp_postprocess/proxy_rename/etcd_rename.rs index 34f086d4..c6fb8fbc 100644 --- a/src/ocp_postprocess/proxy_rename/etcd_rename.rs +++ b/src/ocp_postprocess/proxy_rename/etcd_rename.rs @@ -245,9 +245,14 @@ pub(crate) async fn fix_containers(etcd_client: &InMemoryK8sEtcd, proxy: &Proxy) pub(crate) async fn fix_storages(etcd_client: &InMemoryK8sEtcd, proxy: &Proxy) -> Result<()> { let k8s_resource_location = K8sResourceLocation::new(None, "Storage", "cluster", "operator.openshift.io/v1"); - let mut storage = get_etcd_json(etcd_client, &k8s_resource_location) - .await? - .context(format!("no {:?}", k8s_resource_location.as_etcd_key()))?; + let mut storage = match get_etcd_json(etcd_client, &k8s_resource_location).await? { + Some(value) => value, + None => { + // Some clusters don't have a storage resource because they disabled the storage + // capability, that's OK + return Ok(()); + } + }; let spec = storage .pointer_mut("/spec/observedConfig/targetconfig/proxy")