Skip to content

Commit

Permalink
Support proxy change in clusters without storage
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
omertuc committed Apr 18, 2024
1 parent f069cc4 commit 2916e4d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/ocp_postprocess/proxy_rename/etcd_rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 2916e4d

Please sign in to comment.