Skip to content

Commit 7f5bcc8

Browse files
committed
[OSPRH-17456] Fix namespace handling for operator references
1 parent 6c01a7d commit 7f5bcc8

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

controllers/operator/openstack_controller.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,12 @@ func (r *OpenStackReconciler) postCleanupObsoleteResources(ctx context.Context,
697697
Log.Info("Deleting operator reference", "Reference", ref)
698698
obj := uns.Unstructured{}
699699
obj.SetName(refData["name"].(string))
700-
obj.SetNamespace(refData["namespace"].(string))
700+
701+
// Some of the references are not namespaced, so we need to check if the namespace is present
702+
if namespace, ok := refData["namespace"]; ok {
703+
obj.SetNamespace(namespace.(string))
704+
}
705+
701706
apiParts := strings.Split(refData["apiVersion"].(string), "/")
702707
objGvk := schema.GroupVersionResource{
703708
Group: apiParts[0],

0 commit comments

Comments
 (0)