Skip to content

Commit 0583545

Browse files
abaysopenshift-cherrypick-robot
authored andcommitted
Fix namespace handling for operator references
1 parent 76c45a9 commit 0583545

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

controllers/operator/openstack_controller.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,12 @@ func (r *OpenStackReconciler) postCleanupObsoleteResources(ctx context.Context,
864864
Log.Info("Deleting operator reference", "Reference", ref)
865865
obj := uns.Unstructured{}
866866
obj.SetName(refData["name"].(string))
867-
obj.SetNamespace(refData["namespace"].(string))
867+
868+
// Some of the references are not namespaced, so we need to check if the namespace is present
869+
if namespace, ok := refData["namespace"]; ok {
870+
obj.SetNamespace(namespace.(string))
871+
}
872+
868873
apiParts := strings.Split(refData["apiVersion"].(string), "/")
869874
objGvk := schema.GroupVersionResource{
870875
Group: apiParts[0],

0 commit comments

Comments
 (0)