Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions controllers/operator/openstack_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -871,12 +871,20 @@ func (r *OpenStackReconciler) postCleanupObsoleteResources(ctx context.Context,
obj.SetNamespace(namespace.(string))
}

apiParts := strings.Split(refData["apiVersion"].(string), "/")
apiVersion := refData["apiVersion"].(string)
apiParts := strings.Split(apiVersion, "/")
objGvk := schema.GroupVersionResource{
Group: apiParts[0],
Version: apiParts[1],
Resource: refData["kind"].(string),
}
// Some of the references have an apiVersion that lacks a group prefix
if len(apiParts) > 1 {
objGvk.Group = apiParts[0]
objGvk.Version = apiParts[1]
Log.Info("postCleanupObsoleteResources: Found apiVersion with group prefix", "apiVersion", apiVersion)
} else {
objGvk.Version = apiParts[0]
Log.Info("postCleanupObsoleteResources: Found apiVersion without group prefix", "apiVersion", apiVersion)
}
obj.SetGroupVersionKind(objGvk.GroupVersion().WithKind(refData["kind"].(string)))

// references from CRD's should be removed before this function is called
Expand Down