Skip to content

Commit

Permalink
Fix error of missing networkoperator annotation
Browse files Browse the repository at this point in the history
In OCP 4.15 recert with the IP replacement enabled fails due to this
networkoperator annotation missing. This change makes this IP
replacement a soft one, but we should still verify whether it should
actually be a soft one or not.

Signed-off-by: Michail Resvanis <mresvani@redhat.com>
  • Loading branch information
mresvanis committed Feb 13, 2024
1 parent e7f7bd3 commit 4d224c3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/ocp_postprocess/ip_rename/etcd_rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,18 +358,18 @@ pub(crate) async fn fix_networks_cluster(etcd_client: &Arc<InMemoryK8sEtcd>, ip:
.await?
.context("getting networks/cluster")?;

let annotations = cluster
.pointer_mut("/metadata/annotations")
.context("no /metadata/annotations")?
.as_object_mut()
.context("/metadata/annotations not an object")?;
// TODO: We observed that in OCP 4.15 there is no such annotation. Nevertheless, we should
// verify whether this should be a soft replacement or not.
if let Some(annotations) = cluster.pointer_mut("/metadata/annotations") {
let annotations = annotations.as_object_mut().context("/metadata/annotations not an object")?;
let key = "networkoperator.openshift.io/ovn-cluster-initiator";

annotations.insert(
"networkoperator.openshift.io/ovn-cluster-initiator".to_string(),
serde_json::Value::String(ip.to_string()),
);
if annotations.contains_key(key) {
annotations.insert(key.to_string(), Value::String(ip.to_string()));

put_etcd_yaml(etcd_client, &k8s_resource_location, cluster).await?;
put_etcd_yaml(etcd_client, &k8s_resource_location, cluster).await?;
}
}

Ok(())
}
Expand Down

0 comments on commit 4d224c3

Please sign in to comment.